diff options
author | Chris Forbes <[email protected]> | 2013-10-10 19:32:34 +1300 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2013-10-26 22:16:19 +1300 |
commit | af1dfd99b7119e0d074fa111e5d2ebeddd5dff93 (patch) | |
tree | 786a0bc4d6d0a6e3f6392313dd335ee130bbf8fb | |
parent | fb08769bb62510b10db61771eaf140194f6cc178 (diff) |
glsl: Add support for separate reference Z for shadow samplers
ARB_gpu_shader5's textureGather*() functions which take shadow samplers
have a separate `refz` parameter rather than adding it to the
coordinate.
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/glsl/builtin_functions.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index db6a0a9bcd4..ef8b7bb57a6 100644 --- a/src/glsl/builtin_functions.cpp +++ b/src/glsl/builtin_functions.cpp @@ -3383,11 +3383,21 @@ builtin_builder::_texture(ir_texture_opcode opcode, if (flags & TEX_PROJECT) tex->projector = swizzle(P, coord_type->vector_elements - 1, 1); - /* The shadow comparitor is normally in the Z component, but a few types - * have sufficiently large coordinates that it's in W. - */ - if (sampler_type->sampler_shadow) - tex->shadow_comparitor = swizzle(P, MAX2(coord_size, SWIZZLE_Z), 1); + if (sampler_type->sampler_shadow) { + if (opcode == ir_tg4) { + /* gather has refz as a separate parameter, immediately after the + * coordinate + */ + ir_variable *refz = in_var(glsl_type::float_type, "refz"); + sig->parameters.push_tail(refz); + tex->shadow_comparitor = var_ref(refz); + } else { + /* The shadow comparitor is normally in the Z component, but a few types + * have sufficiently large coordinates that it's in W. + */ + tex->shadow_comparitor = swizzle(P, MAX2(coord_size, SWIZZLE_Z), 1); + } + } if (opcode == ir_txl) { ir_variable *lod = in_var(glsl_type::float_type, "lod"); |