[Mesa-dev] [PATCH 6/6] i965: Enable texture lookups whose return type is 'float'

Chad Versace chad.versace at intel.com
Sat Mar 12 17:49:46 PST 2011


This enables the new shadow texture functions in GLSL 1.30.

Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-01
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-02
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-03
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-04
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-05
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-06
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-07
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-08
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-09
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-10
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-11
Test-case: piglit:spec/glsl-1.30/execution/fs-texture-sampler2dshadow-12

Signed-off-by: Chad Versace <chad.versace at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index ce7959b..e69bfbe 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1472,6 +1472,21 @@ fs_visitor::visit(ir_texture *ir)
       }
       this->result = swizzle_dst;
    }
+
+   if (ir->type == glsl_type::float_type) {
+      assert(ir->sampler->type->sampler_shadow);
+      fs_reg l = fs_reg(this, glsl_type::float_type);
+      fs_reg r = this->result;
+      if (c->key.depth_modes[sampler] == GL_ALPHA) {
+         r.reg_offset = 3;
+      }
+      emit(fs_inst(BRW_OPCODE_MOV, l, r));
+      this->result = l;
+   } else if (ir->type == glsl_type::vec4_type) {
+	   /* do not alter this->result */
+   } else {
+	   assert(0);
+   }
 }
 
 void
-- 
1.7.4



More information about the mesa-dev mailing list