summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_variables.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-06-06 09:53:27 -0500
committerJason Ekstrand <[email protected]>2019-06-19 21:05:54 +0000
commitaa11c2e75e191f8201fe5462ef8c14e81dde964e (patch)
treef5c007cfd5d44fe520518f5133ea9df5b80629c2 /src/compiler/spirv/vtn_variables.c
parent93f4aa98894cbc57325b90ecb128b22e6448de23 (diff)
spirv: Add a vtn_constant_int helper
Reviewed-by: Karol Herbst <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_variables.c')
-rw-r--r--src/compiler/spirv/vtn_variables.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 925d2549d4c..1a9ca0745fa 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -2403,23 +2403,7 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
struct vtn_value *link_val = vtn_untyped_value(b, w[i]);
if (link_val->value_type == vtn_value_type_constant) {
chain->link[idx].mode = vtn_access_mode_literal;
- const unsigned bit_size = glsl_get_bit_size(link_val->type->type);
- switch (bit_size) {
- case 8:
- chain->link[idx].id = link_val->constant->values[0][0].i8;
- break;
- case 16:
- chain->link[idx].id = link_val->constant->values[0][0].i16;
- break;
- case 32:
- chain->link[idx].id = link_val->constant->values[0][0].i32;
- break;
- case 64:
- chain->link[idx].id = link_val->constant->values[0][0].i64;
- break;
- default:
- vtn_fail("Invalid bit size: %u", bit_size);
- }
+ chain->link[idx].id = vtn_constant_int(b, w[i]);
} else {
chain->link[idx].mode = vtn_access_mode_id;
chain->link[idx].id = w[i];