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 <chrisf@ijw.co.nz> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user