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 <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Kenneth Graunke
2013-10-26 11:14:55 -07:00
parent e095434e52
commit 7232e8bea7
+7 -8
View File
@@ -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);
}