From d99b5b2d8218fee49b2305c95efb9ed386e91f74 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Fri, 27 Sep 2013 21:29:01 -0700 Subject: [PATCH] i965/gs: Fix incorrect numbering of DWORDs in 3DSTATE_GS In commit 247f90c77e8f3894e963d796628246ba0bde27b5 (i965/gs: Set control data header size/format appropriately for EndPrimitive()), I incorrectly numbered the DWORDs in the 3DSTATE_GS command starting from 1 instead of starting from 0. This caused the control data format to be programmed into the wrong DWORD, resulting in corruption in some geometry shaders that used an output type of points. This patch numbers the DWORDs starting from 0, as we do for all other commands, which causes the control data format to be programmed into the correct DWORD. Reviewed-by: Chad Versace --- src/mesa/drivers/dri/i965/gen7_gs_state.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_gs_state.c b/src/mesa/drivers/dri/i965/gen7_gs_state.c index 4f18485381f..3dd5896eee8 100644 --- a/src/mesa/drivers/dri/i965/gen7_gs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_gs_state.c @@ -95,7 +95,7 @@ upload_gs_state(struct brw_context *brw) OUT_BATCH(0); } - uint32_t dw5 = + uint32_t dw4 = ((brw->gs.prog_data->output_vertex_size_hwords * 2 - 1) << GEN7_GS_OUTPUT_VERTEX_SIZE_SHIFT) | (brw->gs.prog_data->output_topology << @@ -105,7 +105,7 @@ upload_gs_state(struct brw_context *brw) (0 << GEN6_GS_URB_ENTRY_READ_OFFSET_SHIFT) | (prog_data->dispatch_grf_start_reg << GEN6_GS_DISPATCH_START_GRF_SHIFT); - uint32_t dw6 = + uint32_t dw5 = ((brw->max_gs_threads - 1) << max_threads_shift) | (brw->gs.prog_data->control_data_header_size_hwords << GEN7_GS_CONTROL_DATA_HEADER_SIZE_SHIFT) | @@ -114,6 +114,7 @@ upload_gs_state(struct brw_context *brw) (brw->gs.prog_data->include_primitive_id ? GEN7_GS_INCLUDE_PRIMITIVE_ID : 0) | GEN7_GS_ENABLE; + uint32_t dw6 = 0; if (brw->is_haswell) { dw6 |= brw->gs.prog_data->control_data_format << @@ -123,9 +124,9 @@ upload_gs_state(struct brw_context *brw) IVB_GS_CONTROL_DATA_FORMAT_SHIFT; } + OUT_BATCH(dw4); OUT_BATCH(dw5); OUT_BATCH(dw6); - OUT_BATCH(0); ADVANCE_BATCH(); } else { BEGIN_BATCH(7); -- 2.30.2