diff options
author | Kenneth Graunke <[email protected]> | 2013-10-26 11:14:55 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-10-31 11:04:37 -0700 |
commit | 7232e8bea71c281090a4c378156bde856782078e (patch) | |
tree | d900517a29fa5721e32f721d1a31b098ed0455f0 /src | |
parent | e095434e520f1130fb59af28da40c50c6739adb2 (diff) |
i965: Explicitly maintain a count of SO_DECL structures emitted.
Currently, we emit one SO_DECL structure per output, so we use the index
in the Outputs[] array as the index into the so_decl[] array as well.
In order to support the fake "gl_SkipComponents[1234]" varyings from
ARB_transform_feedback3, we'll need to emit SO_DECLs to fill in the
holes between successive outputs. This means we'll likely emit more
SO_DECLs than there are outputs, so we need to count it explicitly.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_sol_state.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_sol_state.c b/src/mesa/drivers/dri/i965/gen7_sol_state.c index af46472bc9e..b192d5d6c03 100644 --- a/src/mesa/drivers/dri/i965/gen7_sol_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sol_state.c @@ -108,17 +108,17 @@ gen7_upload_3dstate_so_decl_list(struct brw_context *brw, /* BRW_NEW_TRANSFORM_FEEDBACK */ const struct gl_transform_feedback_info *linked_xfb_info = &vs_prog->LinkedTransformFeedback; - int i; uint16_t so_decl[128]; int buffer_mask = 0; int next_offset[4] = {0, 0, 0, 0}; + int decls = 0; STATIC_ASSERT(ARRAY_SIZE(so_decl) >= MAX_PROGRAM_OUTPUTS); /* Construct the list of SO_DECLs to be emitted. The formatting of the * command is feels strange -- each dword pair contains a SO_DECL per stream. */ - for (i = 0; i < linked_xfb_info->NumOutputs; i++) { + for (int i = 0; i < linked_xfb_info->NumOutputs; i++) { int buffer = linked_xfb_info->Outputs[i].OutputBuffer; uint16_t decl = 0; int varying = linked_xfb_info->Outputs[i].OutputRegister; @@ -147,24 +147,23 @@ gen7_upload_3dstate_so_decl_list(struct brw_context *brw, next_offset[buffer] += components; - so_decl[i] = decl; + so_decl[decls++] = decl; } - BEGIN_BATCH(linked_xfb_info->NumOutputs * 2 + 3); - OUT_BATCH(_3DSTATE_SO_DECL_LIST << 16 | - (linked_xfb_info->NumOutputs * 2 + 1)); + BEGIN_BATCH(decls * 2 + 3); + OUT_BATCH(_3DSTATE_SO_DECL_LIST << 16 | (decls * 2 + 1)); OUT_BATCH((buffer_mask << SO_STREAM_TO_BUFFER_SELECTS_0_SHIFT) | (0 << SO_STREAM_TO_BUFFER_SELECTS_1_SHIFT) | (0 << SO_STREAM_TO_BUFFER_SELECTS_2_SHIFT) | (0 << SO_STREAM_TO_BUFFER_SELECTS_3_SHIFT)); - OUT_BATCH((linked_xfb_info->NumOutputs << SO_NUM_ENTRIES_0_SHIFT) | + OUT_BATCH((decls << SO_NUM_ENTRIES_0_SHIFT) | (0 << SO_NUM_ENTRIES_1_SHIFT) | (0 << SO_NUM_ENTRIES_2_SHIFT) | (0 << SO_NUM_ENTRIES_3_SHIFT)); - for (i = 0; i < linked_xfb_info->NumOutputs; i++) { + for (int i = 0; i < decls; i++) { OUT_BATCH(so_decl[i]); OUT_BATCH(0); } |