i965/fs_nir: Add support for sample_pos and sample_id
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 15 Oct 2014 23:01:04 +0000 (16:01 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:18:59 +0000 (07:18 -0800)
src/mesa/drivers/dri/i965/brw_fs_nir.cpp

index 350cf3fd5fa85fa036827a67ae7bb9f15b4a5a30..aab74298fae0f2e80ee582358a4140925b44a4f5 100644 (file)
@@ -1325,9 +1325,20 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
       break;
    }
 
-   case nir_intrinsic_load_sample_pos:
-   case nir_intrinsic_load_sample_id:
-      assert(!"TODO");
+   case nir_intrinsic_load_sample_pos: {
+      fs_reg *reg = emit_samplepos_setup();
+      dest.type = reg->type;
+      emit(MOV(dest, *reg));
+      emit(MOV(offset(dest, 1), offset(*reg, 1)));
+      break;
+   }
+
+   case nir_intrinsic_load_sample_id: {
+      fs_reg *reg = emit_sampleid_setup();
+      dest.type = reg->type;
+      emit(MOV(dest, *reg));
+      break;
+   }
 
    case nir_intrinsic_load_uniform_vec1:
    case nir_intrinsic_load_uniform_vec2: