summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-06-01 11:20:22 -0700
committerEmil Velikov <[email protected]>2016-06-14 15:48:35 +0100
commit09b2be7a51055b1d044e359c58a6dfcfdde26a13 (patch)
tree539751a019de58c819dbdce10524071e22cd0cd9
parent6efd37f30d4983e627ccc8a7f12ae2552812c7d9 (diff)
nir/spirv: Handle the WorkgroupSize builtin decoration
This fixes the 7 dEQP-VK.pipeline.spec_constant.compute.local_size.* tests in the latest dev version of the Vulkan CTS. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]> (cherry picked from commit 1f7b54ed299bea95f774e7d8baa181c11118b3fe)
-rw-r--r--src/compiler/spirv/spirv_to_nir.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index bb7aba4d9d4..cece645c6bc 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -932,6 +932,25 @@ get_specialization(struct vtn_builder *b, struct vtn_value *val,
}
static void
+handle_workgroup_size_decoration_cb(struct vtn_builder *b,
+ struct vtn_value *val,
+ int member,
+ const struct vtn_decoration *dec,
+ void *data)
+{
+ assert(member == -1);
+ if (dec->decoration != SpvDecorationBuiltIn ||
+ dec->literals[0] != SpvBuiltInWorkgroupSize)
+ return;
+
+ assert(val->const_type == glsl_vector_type(GLSL_TYPE_UINT, 3));
+
+ b->shader->info.cs.local_size[0] = val->constant->value.u[0];
+ b->shader->info.cs.local_size[1] = val->constant->value.u[1];
+ b->shader->info.cs.local_size[2] = val->constant->value.u[2];
+}
+
+static void
vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
const uint32_t *w, unsigned count)
{
@@ -1151,6 +1170,9 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
default:
unreachable("Unhandled opcode");
}
+
+ /* Now that we have the value, update the workgroup size if needed */
+ vtn_foreach_decoration(b, val, handle_workgroup_size_decoration_cb, NULL);
}
static void