[Mesa-dev] [PATCH 75/78] i965/nir/vec4: Implement nir_texop_txd texture op

Eduardo Lima Mitev elima at igalia.com
Fri Jun 26 01:07:31 PDT 2015


The code has been taken almost as-is from vec4_visitor.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89580
---
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 9a31e6c..e9bdf02 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -1630,7 +1630,27 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
          }
          inst->mlen++;
       } else if (instr->op == nir_texop_txd) {
-         /* @TODO: not yet implemented */
+         const brw_reg_type type = lod.type;
+
+         lod.swizzle = BRW_SWIZZLE4(SWIZZLE_X,SWIZZLE_X,SWIZZLE_Y,SWIZZLE_Y);
+         lod2.swizzle = BRW_SWIZZLE4(SWIZZLE_X,SWIZZLE_X,SWIZZLE_Y,SWIZZLE_Y);
+         emit(MOV(dst_reg(MRF, param_base + 1, type, WRITEMASK_XZ), lod));
+         emit(MOV(dst_reg(MRF, param_base + 1, type, WRITEMASK_YW), lod2));
+         inst->mlen++;
+
+         if (dest_type->vector_elements == 3 || shadow_compare) {
+            lod.swizzle = BRW_SWIZZLE_ZZZZ;
+            lod2.swizzle = BRW_SWIZZLE_ZZZZ;
+            emit(MOV(dst_reg(MRF, param_base + 2, type, WRITEMASK_X), lod));
+            emit(MOV(dst_reg(MRF, param_base + 2, type, WRITEMASK_Y), lod2));
+            inst->mlen++;
+
+            if (shadow_compare) {
+               emit(MOV(dst_reg(MRF, param_base + 2,
+                                shadow_comparitor.type, WRITEMASK_Z),
+                        shadow_comparitor));
+            }
+         }
       } else if (instr->op == nir_texop_tg4) {
          /* @TODO: not yet implemented */
       }
-- 
2.1.4



More information about the mesa-dev mailing list