aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2013-10-05 18:26:56 +1300
committerChris Forbes <[email protected]>2013-10-06 11:12:29 +1300
commit88ee9bc9d1dd66ddb9721dc44574b8caaa26df70 (patch)
tree703eea9eaceab52cb3820145fe9cc2036bbafb1e /src/glsl/builtin_functions.cpp
parentf93a63bfccf22b64d5f0886b25fce833babdab1c (diff)
glsl: Add support for specifying the component in textureGather
ARB_gpu_shader5 introduces new variants of textureGather* which have an explicit component selector, rather than relying purely on the sampler's swizzle state. This patch adds the GLSL plumbing for the extra parameter. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/builtin_functions.cpp')
-rw-r--r--src/glsl/builtin_functions.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 40084f79f51..75c6da81e31 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -493,6 +493,7 @@ private:
/** Flags to _texture() */
#define TEX_PROJECT 1
#define TEX_OFFSET 2
+#define TEX_COMPONENT 4
ir_function_signature *_texture(ir_texture_opcode opcode,
builtin_available_predicate avail,
@@ -3322,6 +3323,18 @@ builtin_builder::_texture(ir_texture_opcode opcode,
tex->offset = var_ref(offset);
}
+ if (opcode == ir_tg4) {
+ if (flags & TEX_COMPONENT) {
+ ir_variable *component =
+ new(mem_ctx) ir_variable(glsl_type::int_type, "comp", ir_var_const_in);
+ sig->parameters.push_tail(component);
+ tex->lod_info.component = var_ref(component);
+ }
+ else {
+ tex->lod_info.component = imm(0);
+ }
+ }
+
/* The "bias" parameter comes /after/ the "offset" parameter, which is
* inconsistent with both textureLodOffset and textureGradOffset.
*/