aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2014-03-06 18:43:44 -0500
committerZack Rusin <[email protected]>2014-03-07 12:49:33 -0500
commitdfa25ea5cd19d5a050a1c94bd7370a2259b9f007 (patch)
tree8ce2db3ceab01311df710c2d7f307f5b708312c5 /src/gallium/drivers
parent7d5903980ed7c4405e20dbc4f5ade9d202c559cb (diff)
gallium: allow setting of the internal stream output offset
D3D10 allows setting of the internal offset of a buffer, which is in general only incremented via actual stream output writes. By allowing setting of the internal offset draw_auto is capable of rendering from buffers which have not been actually streamed out to. Our interface didn't allow. This change functionally shouldn't make any difference to OpenGL where instead of an append_bitmask you just get a real array where -1 means append (like in D3D) and 0 means do not append. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/galahad/glhd_context.c4
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c8
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_so.c12
-rw-r--r--src/gallium/drivers/noop/noop_state.c2
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_state.c7
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state.c7
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h2
-rw-r--r--src/gallium/drivers/radeon/r600_streamout.c5
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_state_so.c2
-rw-r--r--src/gallium/drivers/trace/tr_context.c6
11 files changed, 34 insertions, 25 deletions
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c
index fa743bd1562..2e61e5924a6 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -613,12 +613,12 @@ static INLINE void
galahad_context_set_stream_output_targets(struct pipe_context *_pipe,
unsigned num_targets,
struct pipe_stream_output_target **tgs,
- unsigned append_bitmask)
+ const unsigned *offsets)
{
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->pipe;
- pipe->set_stream_output_targets(pipe, num_targets, tgs, append_bitmask);
+ pipe->set_stream_output_targets(pipe, num_targets, tgs, offsets);
}
static void
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index 43dc34756e9..1b97eaa14c6 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -856,10 +856,11 @@ static void
ilo_set_stream_output_targets(struct pipe_context *pipe,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_bitmask)
+ const unsigned *offset)
{
struct ilo_context *ilo = ilo_context(pipe);
unsigned i;
+ unsigned append_bitmask = 0;
if (!targets)
num_targets = 0;
@@ -868,8 +869,11 @@ ilo_set_stream_output_targets(struct pipe_context *pipe,
if (!ilo->so.count && !num_targets)
return;
- for (i = 0; i < num_targets; i++)
+ for (i = 0; i < num_targets; i++) {
pipe_so_target_reference(&ilo->so.states[i], targets[i]);
+ if (offset[i] == (unsigned)-1)
+ append_bitmask |= 1 << i;
+ }
for (; i < ilo->so.count; i++)
pipe_so_target_reference(&ilo->so.states[i], NULL);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_so.c b/src/gallium/drivers/llvmpipe/lp_state_so.c
index fa58f79c9c1..2af04cdf1c3 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_so.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_so.c
@@ -64,17 +64,17 @@ static void
llvmpipe_set_so_targets(struct pipe_context *pipe,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_bitmask)
+ const unsigned *offsets)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
int i;
for (i = 0; i < num_targets; i++) {
+ const boolean append = (offsets[i] == (unsigned)-1);
pipe_so_target_reference((struct pipe_stream_output_target **)&llvmpipe->so_targets[i], targets[i]);
- /* if we're not appending then lets reset the internal
- data of our so target */
- if (!(append_bitmask & (1 << i)) && llvmpipe->so_targets[i]) {
- llvmpipe->so_targets[i]->internal_offset = 0;
- llvmpipe->so_targets[i]->emitted_vertices = 0;
+ /* If we're not appending then lets set the internal
+ offset to what was requested */
+ if (!append && llvmpipe->so_targets[i]) {
+ llvmpipe->so_targets[i]->internal_offset = offsets[i];
}
}
diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c
index 9c62c27c0a5..5cb37b656de 100644
--- a/src/gallium/drivers/noop/noop_state.c
+++ b/src/gallium/drivers/noop/noop_state.c
@@ -274,7 +274,7 @@ static void noop_stream_output_target_destroy(struct pipe_context *ctx,
static void noop_set_stream_output_targets(struct pipe_context *ctx,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_bitmask)
+ const unsigned *offsets)
{
}
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index c03d72922a9..862636b9a78 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -1055,7 +1055,7 @@ static void
nv50_set_stream_output_targets(struct pipe_context *pipe,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_mask)
+ const unsigned *offsets)
{
struct nv50_context *nv50 = nv50_context(pipe);
unsigned i;
@@ -1066,7 +1066,8 @@ nv50_set_stream_output_targets(struct pipe_context *pipe,
for (i = 0; i < num_targets; ++i) {
const boolean changed = nv50->so_target[i] != targets[i];
- if (!changed && (append_mask & (1 << i)))
+ const boolean append = (offsets[i] == (unsigned)-1);
+ if (!changed && append)
continue;
nv50->so_targets_dirty |= 1 << i;
@@ -1075,7 +1076,7 @@ nv50_set_stream_output_targets(struct pipe_context *pipe,
serialize = FALSE;
}
- if (targets[i] && !(append_mask & (1 << i)))
+ if (targets[i] && !append)
nv50_so_target(targets[i])->clean = TRUE;
pipe_so_target_reference(&nv50->so_target[i], targets[i]);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index dec535532d8..88dbaa1113e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -1031,7 +1031,7 @@ static void
nvc0_set_transform_feedback_targets(struct pipe_context *pipe,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_mask)
+ unsigned *offsets)
{
struct nvc0_context *nvc0 = nvc0_context(pipe);
unsigned i;
@@ -1040,14 +1040,15 @@ nvc0_set_transform_feedback_targets(struct pipe_context *pipe,
assert(num_targets <= 4);
for (i = 0; i < num_targets; ++i) {
- if (nvc0->tfbbuf[i] == targets[i] && (append_mask & (1 << i)))
+ boolean append = (offsets[i] == ((unsigned)-1));
+ if (nvc0->tfbbuf[i] == targets[i] && append)
continue;
nvc0->tfbbuf_dirty |= 1 << i;
if (nvc0->tfbbuf[i] && nvc0->tfbbuf[i] != targets[i])
nvc0_so_target_save_offset(pipe, nvc0->tfbbuf[i], i, &serialize);
- if (targets[i] && !(append_mask & (1 << i)))
+ if (targets[i] && !append)
nvc0_so_target(targets[i])->clean = TRUE;
pipe_so_target_reference(&nvc0->tfbbuf[i], targets[i]);
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index cbd3f0e8c64..a178e9c5719 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -413,7 +413,7 @@ void r600_streamout_buffers_dirty(struct r600_common_context *rctx);
void r600_set_streamout_targets(struct pipe_context *ctx,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_bitmask);
+ unsigned *offset);
void r600_emit_streamout_end(struct r600_common_context *rctx);
void r600_streamout_init(struct r600_common_context *rctx);
diff --git a/src/gallium/drivers/radeon/r600_streamout.c b/src/gallium/drivers/radeon/r600_streamout.c
index adc11e005d7..b6cf8584e2a 100644
--- a/src/gallium/drivers/radeon/r600_streamout.c
+++ b/src/gallium/drivers/radeon/r600_streamout.c
@@ -108,10 +108,11 @@ void r600_streamout_buffers_dirty(struct r600_common_context *rctx)
void r600_set_streamout_targets(struct pipe_context *ctx,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_bitmask)
+ const unsigned *offsets)
{
struct r600_common_context *rctx = (struct r600_common_context *)ctx;
unsigned i;
+ unsigned append_bitmask = 0;
/* Stop streamout. */
if (rctx->streamout.num_targets && rctx->streamout.begin_emitted) {
@@ -122,6 +123,8 @@ void r600_set_streamout_targets(struct pipe_context *ctx,
for (i = 0; i < num_targets; i++) {
pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->streamout.targets[i], targets[i]);
r600_context_add_resource_size(ctx, targets[i]->buffer);
+ if (offsets[i] == ((unsigned)-1))
+ append_bitmask |= 1 << i;
}
for (; i < rctx->streamout.num_targets; i++) {
pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->streamout.targets[i], NULL);
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 06b29d42b8b..6b0ff91c2bc 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -605,7 +605,7 @@ void si_set_ring_buffer(struct pipe_context *ctx, uint shader, uint slot,
static void si_set_streamout_targets(struct pipe_context *ctx,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_bitmask)
+ const unsigned *offsets)
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_buffer_resources *buffers = &sctx->rw_buffers[PIPE_SHADER_VERTEX];
@@ -618,7 +618,7 @@ static void si_set_streamout_targets(struct pipe_context *ctx,
*/
/* Set the VGT regs. */
- r600_set_streamout_targets(ctx, num_targets, targets, append_bitmask);
+ r600_set_streamout_targets(ctx, num_targets, targets, offsets);
/* Set the shader resources.*/
for (i = 0; i < num_targets; i++) {
diff --git a/src/gallium/drivers/softpipe/sp_state_so.c b/src/gallium/drivers/softpipe/sp_state_so.c
index f456237273f..3878e4a5389 100644
--- a/src/gallium/drivers/softpipe/sp_state_so.c
+++ b/src/gallium/drivers/softpipe/sp_state_so.c
@@ -63,7 +63,7 @@ static void
softpipe_set_so_targets(struct pipe_context *pipe,
unsigned num_targets,
struct pipe_stream_output_target **targets,
- unsigned append_bitmask)
+ const unsigned *offsets)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
unsigned i;
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index c10e01017fa..3e995980e92 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1080,7 +1080,7 @@ static INLINE void
trace_context_set_stream_output_targets(struct pipe_context *_pipe,
unsigned num_targets,
struct pipe_stream_output_target **tgs,
- unsigned append_bitmask)
+ const unsigned *offsets)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
@@ -1090,9 +1090,9 @@ trace_context_set_stream_output_targets(struct pipe_context *_pipe,
trace_dump_arg(ptr, pipe);
trace_dump_arg(uint, num_targets);
trace_dump_arg_array(ptr, tgs, num_targets);
- trace_dump_arg(uint, append_bitmask);
+ trace_dump_arg_array(uint, offsets, num_targets);
- pipe->set_stream_output_targets(pipe, num_targets, tgs, append_bitmask);
+ pipe->set_stream_output_targets(pipe, num_targets, tgs, offsets);
trace_dump_call_end();
}