mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
glsl: add support for the textureSamples function
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
fb18ee9ba6
commit
0c7fbcb844
1 changed files with 31 additions and 0 deletions
|
|
@ -427,6 +427,13 @@ shader_image_size(const _mesa_glsl_parse_state *state)
|
|||
state->ARB_shader_image_size_enable;
|
||||
}
|
||||
|
||||
static bool
|
||||
shader_samples(const _mesa_glsl_parse_state *state)
|
||||
{
|
||||
return state->is_version(450, 0) ||
|
||||
state->ARB_shader_texture_image_samples_enable;
|
||||
}
|
||||
|
||||
static bool
|
||||
gs_streams(const _mesa_glsl_parse_state *state)
|
||||
{
|
||||
|
|
@ -666,6 +673,7 @@ private:
|
|||
B1(all);
|
||||
B1(not);
|
||||
BA2(textureSize);
|
||||
B1(textureSamples);
|
||||
|
||||
/** Flags to _texture() */
|
||||
#define TEX_PROJECT 1
|
||||
|
|
@ -1407,6 +1415,16 @@ builtin_builder::create_builtins()
|
|||
_textureSize(texture_multisample_array, glsl_type::ivec3_type, glsl_type::usampler2DMSArray_type),
|
||||
NULL);
|
||||
|
||||
add_function("textureSamples",
|
||||
_textureSamples(glsl_type::sampler2DMS_type),
|
||||
_textureSamples(glsl_type::isampler2DMS_type),
|
||||
_textureSamples(glsl_type::usampler2DMS_type),
|
||||
|
||||
_textureSamples(glsl_type::sampler2DMSArray_type),
|
||||
_textureSamples(glsl_type::isampler2DMSArray_type),
|
||||
_textureSamples(glsl_type::usampler2DMSArray_type),
|
||||
NULL);
|
||||
|
||||
add_function("texture",
|
||||
_texture(ir_tex, v130, glsl_type::vec4_type, glsl_type::sampler1D_type, glsl_type::float_type),
|
||||
_texture(ir_tex, v130, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type),
|
||||
|
|
@ -4169,6 +4187,19 @@ builtin_builder::_textureSize(builtin_available_predicate avail,
|
|||
return sig;
|
||||
}
|
||||
|
||||
ir_function_signature *
|
||||
builtin_builder::_textureSamples(const glsl_type *sampler_type)
|
||||
{
|
||||
ir_variable *s = in_var(sampler_type, "sampler");
|
||||
MAKE_SIG(glsl_type::int_type, shader_samples, 1, s);
|
||||
|
||||
ir_texture *tex = new(mem_ctx) ir_texture(ir_texture_samples);
|
||||
tex->set_sampler(new(mem_ctx) ir_dereference_variable(s), glsl_type::int_type);
|
||||
body.emit(ret(tex));
|
||||
|
||||
return sig;
|
||||
}
|
||||
|
||||
ir_function_signature *
|
||||
builtin_builder::_texture(ir_texture_opcode opcode,
|
||||
builtin_available_predicate avail,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue