Mesa (master): glsl/builtins: Fix textureGrad() for Array samplers.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Jun 5 21:41:15 UTC 2012


Module: Mesa
Branch: master
Commit: 25edfbfccfb8af9eecd949c3fc4f2680c5b963b6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=25edfbfccfb8af9eecd949c3fc4f2680c5b963b6

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jun  1 02:56:50 2012 -0700

glsl/builtins: Fix textureGrad() for Array samplers.

We were incorrectly assuming that the coordinate's dimensionality is
equal to the gradient's dimensionality.  For array types, the coordinate
has one more component.

Fixes 12 subcases of oglconform's glsl-bif-tex-grad test.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/builtins/tools/texture_builtins.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py
index 84a144e..94971bc 100755
--- a/src/glsl/builtins/tools/texture_builtins.py
+++ b/src/glsl/builtins/tools/texture_builtins.py
@@ -56,7 +56,7 @@ def get_txs_dim(sampler_type):
 def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0):
     coord_dim = get_coord_dim(sampler_type)
     extra_dim = get_extra_dim(sampler_type, variant & Proj, unused_fields)
-    offset_dim = get_sampler_dim(sampler_type)
+    sampler_dim = get_sampler_dim(sampler_type)
 
     if variant & Single:
         return_type = "float"
@@ -76,12 +76,12 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0):
     elif ((tex_inst == "txf" or tex_inst == "txs") and "Buffer" not in sampler_type and "Rect" not in sampler_type):
         print "\n       (declare (in) int lod)",
     elif tex_inst == "txd":
-        grad_type = vec_type("", coord_dim)
+        grad_type = vec_type("", sampler_dim)
         print "\n       (declare (in) " + grad_type + " dPdx)",
         print "\n       (declare (in) " + grad_type + " dPdy)",
 
     if variant & Offset:
-        print "\n       (declare (const_in) " + vec_type("i", offset_dim) + " offset)",
+        print "\n       (declare (const_in) " + vec_type("i", sampler_dim) + " offset)",
     if tex_inst == "txb":
         print "\n       (declare (in) float bias)",
 




More information about the mesa-commit mailing list