Mesa (master): glsl: add forgotten textureOffset function for sampler2DArrayShadow

Roland Scheidegger sroland at kemper.freedesktop.org
Thu Apr 21 00:39:20 UTC 2016


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Tue Apr 19 02:21:35 2016 +0200

glsl: add forgotten textureOffset function for sampler2DArrayShadow

This was part of EXT_gpu_shader4 - as such it should have been supported
by glsl 130.
It was however forgotten, and not added until glsl 430 - with the wrong
syntax no less (glsl 430 mentions it was overlooked).
glsl 440 (but revision 8 only) fixed this finally for good.
At least nvidia supports this with just version glsl version 1.30 as well
(the spec doesn't explicitly say it should be supported retroactively),
so just add this to the other glsl 130 textureOffset functions.

Passes a (hacked) piglit tex-miplevel-selection test (2DArrayShadow
textureOffset -auto) with llvmpipe.

v2: fix up comment (by Ian), add testing to commit message.

Reviewed-by: Dave Airlie <airlied at gmail.com>

---

 src/compiler/glsl/builtin_functions.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 1f6fb22..25d914d 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -1756,6 +1756,13 @@ builtin_builder::create_builtins()
                 _texture(ir_tex, v130, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET),
 
                 _texture(ir_tex, v130, glsl_type::float_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_OFFSET),
+                /* The next one was forgotten in GLSL 1.30 spec. It's from
+                 * EXT_gpu_shader4 originally. It was added in 4.30 with the
+                 * wrong syntax. This was corrected in 4.40. 4.30 indicates
+                 * that it was intended to be included previously, so allow it
+                 * in 1.30.
+                 */
+                _texture(ir_tex, v130, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_OFFSET),
 
                 _texture(ir_txb, v130_fs_only, glsl_type::vec4_type,  glsl_type::sampler1D_type,  glsl_type::float_type, TEX_OFFSET),
                 _texture(ir_txb, v130_fs_only, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type, TEX_OFFSET),




More information about the mesa-commit mailing list