aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_draw_upload.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-08-07 20:31:39 -0700
committerKenneth Graunke <[email protected]>2014-09-10 11:05:08 -0700
commitfdbabf22e183d478cd076215052fa877b125629b (patch)
treeb6f1989aa1497b08453be05a16c4e52ea842cdda /src/mesa/drivers/dri/i965/brw_draw_upload.c
parentc89306983c07e5a88c0d636267e5ccf263cb4213 (diff)
i965: Make gl_BaseVertex available in a buffer object.
This will be used for GL_ARB_shader_draw_parameters, as well as fixing gl_VertexID, which is supposed to include gl_BaseVertex's value. For indirect draws, we simply point at the indirect buffer; for normal draws, we upload the value via the upload buffer. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_draw_upload.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 38b108751ce..37a65bcb3c9 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -607,11 +607,21 @@ brw_prepare_vertices(struct brw_context *brw)
void
brw_prepare_shader_draw_parameters(struct brw_context *brw)
{
+ int *gl_basevertex_value;
if (brw->draw.indexed) {
brw->draw.start_vertex_location += brw->ib.start_vertex_offset;
brw->draw.base_vertex_location += brw->vb.start_vertex_bias;
+ gl_basevertex_value = &brw->draw.base_vertex_location;
} else {
brw->draw.start_vertex_location += brw->vb.start_vertex_bias;
+ gl_basevertex_value = &brw->draw.start_vertex_location;
+ }
+
+ /* For non-indirect draws, upload gl_BaseVertex. */
+ if (brw->vs.prog_data->uses_vertexid && brw->draw.draw_params_bo == NULL) {
+ intel_upload_data(brw, gl_basevertex_value, 4, 4,
+ &brw->draw.draw_params_bo,
+ &brw->draw.draw_params_offset);
}
}