glsl: Add textureSamplesIdenticalEXT built-in functions

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
This commit is contained in:
Ian Romanick 2015-11-17 16:59:40 -08:00
parent 8343583557
commit 06c56f443a

View file

@ -289,6 +289,20 @@ texture_multisample_array(const _mesa_glsl_parse_state *state)
state->OES_texture_storage_multisample_2d_array_enable;
}
static bool
texture_samples_identical(const _mesa_glsl_parse_state *state)
{
return texture_multisample(state) &&
state->EXT_shader_samples_identical_enable;
}
static bool
texture_samples_identical_array(const _mesa_glsl_parse_state *state)
{
return texture_multisample_array(state) &&
state->EXT_shader_samples_identical_enable;
}
static bool
fs_texture_cube_map_array(const _mesa_glsl_parse_state *state)
{
@ -724,6 +738,7 @@ private:
BA2(textureQueryLod);
B1(textureQueryLevels);
BA2(textureSamplesIdentical);
B1(dFdx);
B1(dFdy);
B1(fwidth);
@ -2210,6 +2225,16 @@ builtin_builder::create_builtins()
NULL);
add_function("textureSamplesIdenticalEXT",
_textureSamplesIdentical(texture_samples_identical, glsl_type::sampler2DMS_type, glsl_type::ivec2_type),
_textureSamplesIdentical(texture_samples_identical, glsl_type::isampler2DMS_type, glsl_type::ivec2_type),
_textureSamplesIdentical(texture_samples_identical, glsl_type::usampler2DMS_type, glsl_type::ivec2_type),
_textureSamplesIdentical(texture_samples_identical_array, glsl_type::sampler2DMSArray_type, glsl_type::ivec3_type),
_textureSamplesIdentical(texture_samples_identical_array, glsl_type::isampler2DMSArray_type, glsl_type::ivec3_type),
_textureSamplesIdentical(texture_samples_identical_array, glsl_type::usampler2DMSArray_type, glsl_type::ivec3_type),
NULL);
add_function("texture1D",
_texture(ir_tex, v110, glsl_type::vec4_type, glsl_type::sampler1D_type, glsl_type::float_type),
_texture(ir_txb, v110_fs_only, glsl_type::vec4_type, glsl_type::sampler1D_type, glsl_type::float_type),
@ -4684,6 +4709,25 @@ builtin_builder::_textureQueryLevels(const glsl_type *sampler_type)
return sig;
}
ir_function_signature *
builtin_builder::_textureSamplesIdentical(builtin_available_predicate avail,
const glsl_type *sampler_type,
const glsl_type *coord_type)
{
ir_variable *s = in_var(sampler_type, "sampler");
ir_variable *P = in_var(coord_type, "P");
const glsl_type *return_type = glsl_type::bool_type;
MAKE_SIG(return_type, avail, 2, s, P);
ir_texture *tex = new(mem_ctx) ir_texture(ir_samples_identical);
tex->coordinate = var_ref(P);
tex->set_sampler(var_ref(s), return_type);
body.emit(ret(tex));
return sig;
}
UNOP(dFdx, ir_unop_dFdx, fs_oes_derivatives)
UNOP(dFdxCoarse, ir_unop_dFdx_coarse, fs_derivative_control)
UNOP(dFdxFine, ir_unop_dFdx_fine, fs_derivative_control)