summaryrefslogtreecommitdiffstats
path: root/src/vulkan/gen8_pipeline.c
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-01-09 01:03:20 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-01-09 01:03:20 -0800
commita9c0e8f00f2ac7543e69d7e4ec3f55fc4af79872 (patch)
tree679273e359ff2354914ff7e3989f6c0a13409fe6 /src/vulkan/gen8_pipeline.c
parentb538ec5409c88f9fc08e0dbbaf3ae71346a1e398 (diff)
vk: Handle uninitialized FS inputs and gl_PrimitiveID
These show up as varying_to_slot[attr] == -1. Instead of storing -1 - 2 in swiz.Attribute[input_index].SourceAttribute, handle it correctly.
Diffstat (limited to 'src/vulkan/gen8_pipeline.c')
-rw-r--r--src/vulkan/gen8_pipeline.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c
index e6cb145d522..dee3c4049c2 100644
--- a/src/vulkan/gen8_pipeline.c
+++ b/src/vulkan/gen8_pipeline.c
@@ -495,16 +495,30 @@ genX(graphics_pipeline_create)(
if (input_index < 0)
continue;
- /* We have to subtract two slots to accout for the URB entry output
- * read offset in the VS and GS stages.
- */
- int source_attr = fs_input_map->varying_to_slot[attr] - 2;
+ int source_attr = fs_input_map->varying_to_slot[attr];
max_source_attr = MAX2(max_source_attr, source_attr);
if (input_index >= 16)
continue;
- swiz.Attribute[input_index].SourceAttribute = source_attr;
+ if (source_attr == -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 the
+ * vertex shader or it's gl_PrimitiveID. In the first case the value
+ * is undefined, in the second it needs to be gl_PrimitiveID.
+ */
+ swiz.Attribute[input_index].ConstantSource = PRIM_ID;
+ swiz.Attribute[input_index].ComponentOverrideX = true;
+ swiz.Attribute[input_index].ComponentOverrideY = true;
+ swiz.Attribute[input_index].ComponentOverrideZ = true;
+ swiz.Attribute[input_index].ComponentOverrideW = true;
+ } else {
+ /* 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;
+ }
}
anv_batch_emit(&pipeline->batch, GENX(3DSTATE_SBE),