summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2019-07-25 10:57:43 -0700
committerSagar Ghuge <sagar.ghuge@intel.com>2019-07-30 10:42:20 -0700
commit154c789ad5510de12456507223515861e9e7900a (patch)
tree901a3e3b2eb6d09d5d023efbc17a365873a6abbd
parentd80a74fb99cc16fb09a28ffba73cd88b260e011b (diff)
glsl: Allow _textureCubeArrayShadow function to accept ir_texture_opcode
This will be used to support one of the function from Ext_texture_shadow_lod specification. With the help of Sagar, Ian and Ivan. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/compiler/glsl/builtin_functions.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index b1ffafa1acf..53265269fd1 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -1031,7 +1031,9 @@ private:
const glsl_type *sampler_type,
const glsl_type *coord_type,
int flags = 0);
- BA1(textureCubeArrayShadow);
+ ir_function_signature *_textureCubeArrayShadow(ir_texture_opcode opcode,
+ builtin_available_predicate avail,
+ const glsl_type *x);
ir_function_signature *_texelFetch(builtin_available_predicate avail,
const glsl_type *return_type,
const glsl_type *sampler_type,
@@ -2166,7 +2168,7 @@ builtin_builder::create_builtins()
/* samplerCubeArrayShadow is special; it has an extra parameter
* for the shadow comparator since there is no vec5 type.
*/
- _textureCubeArrayShadow(texture_cube_map_array, glsl_type::samplerCubeArrayShadow_type),
+ _textureCubeArrayShadow(ir_tex, texture_cube_map_array, glsl_type::samplerCubeArrayShadow_type),
_texture(ir_tex, v130, glsl_type::vec4_type, glsl_type::sampler2DRect_type, glsl_type::vec2_type),
_texture(ir_tex, v130, glsl_type::ivec4_type, glsl_type::isampler2DRect_type, glsl_type::vec2_type),
@@ -6093,7 +6095,8 @@ builtin_builder::_texture(ir_texture_opcode opcode,
}
ir_function_signature *
-builtin_builder::_textureCubeArrayShadow(builtin_available_predicate avail,
+builtin_builder::_textureCubeArrayShadow(ir_texture_opcode opcode,
+ builtin_available_predicate avail,
const glsl_type *sampler_type)
{
ir_variable *s = in_var(sampler_type, "sampler");
@@ -6101,12 +6104,24 @@ builtin_builder::_textureCubeArrayShadow(builtin_available_predicate avail,
ir_variable *compare = in_var(glsl_type::float_type, "compare");
MAKE_SIG(glsl_type::float_type, avail, 3, s, P, compare);
- ir_texture *tex = new(mem_ctx) ir_texture(ir_tex);
+ ir_texture *tex = new(mem_ctx) ir_texture(opcode);
tex->set_sampler(var_ref(s), glsl_type::float_type);
tex->coordinate = var_ref(P);
tex->shadow_comparator = var_ref(compare);
+ if (opcode == ir_txb) {
+ ir_variable *bias = in_var(glsl_type::float_type, "bias");
+ sig->parameters.push_tail(bias);
+ tex->lod_info.bias = var_ref(bias);
+ }
+
+ if (opcode == ir_txl) {
+ ir_variable *lod = in_var(glsl_type::float_type, "lod");
+ sig->parameters.push_tail(lod);
+ tex->lod_info.lod = var_ref(lod);
+ }
+
body.emit(ret(tex));
return sig;