nir: Destination component count of shader_clock intrinsic is 2
authorBoyan Ding <boyan.j.ding@gmail.com>
Wed, 12 Apr 2017 13:14:22 +0000 (21:14 +0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 14 Apr 2017 21:54:06 +0000 (14:54 -0700)
This fixes the following error when using ARB_shader_clock on i965:
vec1 32 ssa_0 = intrinsic shader_clock () () ()
intrinsic store_var (ssa_0) (clock_retval) (3) /* wrmask=xy */
error: src->ssa->num_components == num_components (nir/nir_validate.c:204)

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable@lists.freedesktop.org
src/compiler/glsl/glsl_to_nir.cpp
src/compiler/nir/nir_intrinsics.h

index f0557f985bf4b21aa1930b2f449aa9ad789efe22..870d457681869f81a16cc6618a42a5bb43c8d913 100644 (file)
@@ -930,7 +930,8 @@ nir_visitor::visit(ir_call *ir)
          nir_builder_instr_insert(&b, &instr->instr);
          break;
       case nir_intrinsic_shader_clock:
-         nir_ssa_dest_init(&instr->instr, &instr->dest, 1, 32, NULL);
+         nir_ssa_dest_init(&instr->instr, &instr->dest, 2, 32, NULL);
+         instr->num_components = 2;
          nir_builder_instr_insert(&b, &instr->instr);
          break;
       case nir_intrinsic_store_ssbo: {
index 105c56f759678044be1c0f366bcf14d31bbe4e03..3a519a73dddcabadf36113e2e371c6dc03fb3b3c 100644 (file)
@@ -91,7 +91,7 @@ BARRIER(memory_barrier)
  * The latter can be used as code motion barrier, which is currently not
  * feasible with NIR.
  */
-INTRINSIC(shader_clock, 0, ARR(0), true, 1, 0, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
+INTRINSIC(shader_clock, 0, ARR(0), true, 2, 0, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
 
 /*
  * Memory barrier with semantics analogous to the compute shader