diff options
author | Zack Rusin <[email protected]> | 2014-03-06 18:43:44 -0500 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2014-03-07 12:49:33 -0500 |
commit | dfa25ea5cd19d5a050a1c94bd7370a2259b9f007 (patch) | |
tree | 8ce2db3ceab01311df710c2d7f307f5b708312c5 /src/mesa | |
parent | 7d5903980ed7c4405e20dbc4f5ade9d202c559cb (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/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawtex.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_xformfb.c | 20 |
5 files changed, 17 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 874ff77b50c..e3ba5a88f2d 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -513,7 +513,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, } cso_set_vertex_elements(cso, 3, st->velems_util_draw); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); /* convert Z from [0,1] to [-1,-1] to match viewport Z scale/bias */ z = z * 2.0f - 1.0f; diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 97cc5a232ca..fcd7e1382be 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -307,7 +307,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) } cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); cso_set_sample_mask(st->cso_context, ~0); cso_set_rasterizer(st->cso_context, &st->clear.raster); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 90f34e39e9e..2b363615140 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -788,7 +788,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, } cso_set_vertex_elements(cso, 3, st->velems_util_draw); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); /* texture state: */ cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv); diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 047cf47b0a4..b0a44fd901c 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -244,7 +244,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } cso_set_vertex_elements(cso, numAttribs, velements); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); /* viewport state: viewport matching window dims */ { diff --git a/src/mesa/state_tracker/st_cb_xformfb.c b/src/mesa/state_tracker/st_cb_xformfb.c index e824fe9b3cf..8f75eda8a10 100644 --- a/src/mesa/state_tracker/st_cb_xformfb.c +++ b/src/mesa/state_tracker/st_cb_xformfb.c @@ -113,6 +113,7 @@ st_begin_transform_feedback(struct gl_context *ctx, GLenum mode, struct st_transform_feedback_object *sobj = st_transform_feedback_object(obj); unsigned i, max_num_targets; + unsigned offsets[PIPE_MAX_SO_BUFFERS] = {0}; max_num_targets = MIN2(Elements(sobj->base.Buffers), Elements(sobj->targets)); @@ -145,8 +146,8 @@ st_begin_transform_feedback(struct gl_context *ctx, GLenum mode, } /* Start writing at the beginning of each target. */ - cso_set_stream_outputs(st->cso_context, sobj->num_targets, sobj->targets, - 0); + cso_set_stream_outputs(st->cso_context, sobj->num_targets, + sobj->targets, offsets); } @@ -155,7 +156,7 @@ st_pause_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { struct st_context *st = st_context(ctx); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); } @@ -165,10 +166,15 @@ st_resume_transform_feedback(struct gl_context *ctx, { struct st_context *st = st_context(ctx); struct st_transform_feedback_object *sobj = - st_transform_feedback_object(obj); + st_transform_feedback_object(obj); + unsigned offsets[PIPE_MAX_SO_BUFFERS]; + unsigned i; + + for (i = 0; i < PIPE_MAX_SO_BUFFERS; i++) + offsets[i] = (unsigned)-1; - cso_set_stream_outputs(st->cso_context, sobj->num_targets, sobj->targets, - ~0); + cso_set_stream_outputs(st->cso_context, sobj->num_targets, + sobj->targets, offsets); } @@ -198,7 +204,7 @@ st_end_transform_feedback(struct gl_context *ctx, struct st_transform_feedback_object *sobj = st_transform_feedback_object(obj); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); pipe_so_target_reference(&sobj->draw_count, st_transform_feedback_get_draw_target(obj)); |