summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins/tools
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-03-12 14:07:39 -0700
committerEric Anholt <[email protected]>2012-03-15 16:24:50 -0700
commitc0795742a38e0aab59309c1ec71d980e493237e2 (patch)
tree021d3bc799b2d09a0dd9fbae86bb1a8527c80e2c /src/glsl/builtins/tools
parente06ab8c3632b748ffb59e1a82e7c966010a675e2 (diff)
glsl: Add GLSL 1.40 textureSize() implementations for sampler2DRect.
By setting lod to 0 in the builtin function implementation, we avoid needing to update all the visitors to ignore LOD in this case, when the hardware drivers actually want to ask for LOD 0 for rectangular textures. Fixes piglit spec/GLSL-1.40/textureSize-*Rect. v2: Change style of looking for substrings. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/builtins/tools')
-rwxr-xr-xsrc/glsl/builtins/tools/texture_builtins.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py
index 07d0a1b8d76..cd15dc4b31c 100755
--- a/src/glsl/builtins/tools/texture_builtins.py
+++ b/src/glsl/builtins/tools/texture_builtins.py
@@ -71,7 +71,7 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0):
print "\n (declare (in) " + vec_type("i" if tex_inst == "txf" else "", coord_dim + extra_dim) + " P)",
if tex_inst == "txl":
print "\n (declare (in) float lod)",
- elif tex_inst == "txf" or tex_inst == "txs":
+ elif tex_inst == "txf" or (tex_inst == "txs" and "Rect" not in sampler_type):
print "\n (declare (in) int lod)",
elif tex_inst == "txd":
grad_type = vec_type("", coord_dim)
@@ -115,7 +115,12 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0):
# Bias/explicit LOD/gradient:
if tex_inst == "txb":
print "(var_ref bias)",
- elif tex_inst == "txl" or tex_inst == "txf" or tex_inst == "txs":
+ elif tex_inst == "txs":
+ if "Rect" not in sampler_type:
+ print "(var_ref lod)",
+ else:
+ print "(constant int (0))"
+ elif tex_inst == "txl" or tex_inst == "txf":
print "(var_ref lod)",
elif tex_inst == "txd":
print "((var_ref dPdx) (var_ref dPdy))",
@@ -153,6 +158,8 @@ def generate_texture_functions(fs):
generate_sigs("", "txs", "CubeShadow")
generate_sigs("", "txs", "1DArrayShadow")
generate_sigs("", "txs", "2DArrayShadow")
+ generate_fiu_sigs("txs", "2DRect")
+ generate_sigs("", "txs", "2DRectShadow")
end_function(fs, "textureSize")
start_function("texture")