summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-05 08:45:01 -0800
committerJason Ekstrand <[email protected]>2016-03-05 09:59:28 -0800
commit9a90176d488c00700cbd832a6a2d53a78114a21e (patch)
tree08f2e6dc032f3701df642676b24370a965b4af93
parent81f30e2f509b4fcd79376ff02363aba831918ac6 (diff)
anv/pipeline: Calculate the correct max_source_attr for 3DSTATE_SBE
-rw-r--r--src/intel/vulkan/genX_pipeline_util.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h
index 66250e5d4d6..28b2a032c46 100644
--- a/src/intel/vulkan/genX_pipeline_util.h
+++ b/src/intel/vulkan/genX_pipeline_util.h
@@ -288,13 +288,12 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline)
if (input_index < 0)
continue;
- int source_attr = fs_input_map->varying_to_slot[attr];
- max_source_attr = MAX2(max_source_attr, source_attr);
+ const int slot = fs_input_map->varying_to_slot[attr];
if (input_index >= 16)
continue;
- if (source_attr == -1) {
+ if (slot == -1) {
/* This attribute does not exist in the VUE--that means that the
* vertex shader did not write to it. It could be that it's a
* regular varying read by the fragment shader but not written by
@@ -308,10 +307,13 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline)
swiz.Attribute[input_index].ComponentOverrideZ = true;
swiz.Attribute[input_index].ComponentOverrideW = true;
} else {
+ assert(slot >= 2);
+ const int source_attr = slot - 2;
+ max_source_attr = MAX2(max_source_attr, source_attr);
/* We have to subtract two slots to accout for the URB entry output
* read offset in the VS and GS stages.
*/
- swiz.Attribute[input_index].SourceAttribute = source_attr - 2;
+ swiz.Attribute[input_index].SourceAttribute = source_attr;
}
}