glsl: Support uint index in lower_vector_insert
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 13 Oct 2015 03:28:28 +0000 (20:28 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Wed, 14 Oct 2015 20:16:35 +0000 (13:16 -0700)
The ES31-CTS.compute_shader.pipeline-compute-chain test case generates
an unsigned index by using gl_LocalInvocationID.x and
gl_LocalInvocationID.y as array indices.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/glsl/lower_vector_insert.cpp

index 6d7cfa94262082751ad9d4d4ba16dcbafc7a502d..26d31b03c128991f6a336b1321e7019743d68502 100644 (file)
@@ -108,9 +108,13 @@ vector_insert_visitor::handle_rvalue(ir_rvalue **rv)
       factory.emit(assign(temp, expr->operands[0]));
       factory.emit(assign(src_temp, expr->operands[1]));
 
+      assert(expr->operands[2]->type == glsl_type::int_type ||
+             expr->operands[2]->type == glsl_type::uint_type);
+
       for (unsigned i = 0; i < expr->type->vector_elements; i++) {
          ir_constant *const cmp_index =
-            new(factory.mem_ctx) ir_constant(int(i));
+            ir_constant::zero(factory.mem_ctx, expr->operands[2]->type);
+         cmp_index->value.u[0] = i;
 
          ir_variable *const cmp_result =
             factory.make_temp(glsl_type::bool_type, "index_condition");