mesa: Enable EXT_shadow_samplers for GLES2
I thought this was just the funny GLES spelling of the extn name, but there's also some ESSL bits you need to add. Most of which you could probably yoink from the old Unity glsl-optimizer (which itself yoinked most of the GLSL compiler from Mesa): https://github.com/aras-p/glsl-optimizer/commit/94a9b2959b885dba4e355aa344adb4d472b00f18 Signed-off-by: Adam Jackson <ajax@redhat.com> Co-authored-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6691>
This commit is contained in:
@@ -230,6 +230,13 @@ texture_external_es3(const _mesa_glsl_parse_state *state)
|
||||
state->is_version(0, 300);
|
||||
}
|
||||
|
||||
static bool
|
||||
texture_shadow2Dext(const _mesa_glsl_parse_state *state)
|
||||
{
|
||||
return state->es_shader &&
|
||||
state->EXT_shadow_samplers_enable;
|
||||
}
|
||||
|
||||
/** True if texturing functions with explicit LOD are allowed. */
|
||||
static bool
|
||||
lod_exists_in_stage(const _mesa_glsl_parse_state *state)
|
||||
@@ -4008,6 +4015,11 @@ builtin_builder::create_builtins()
|
||||
_texture(ir_txb, v110_derivatives_only_deprecated_texture, &glsl_type_builtin_vec4, &glsl_type_builtin_sampler2DShadow, &glsl_type_builtin_vec3),
|
||||
NULL);
|
||||
|
||||
add_function("shadow2DEXT",
|
||||
_texture(ir_tex, texture_shadow2Dext, &glsl_type_builtin_float, &glsl_type_builtin_sampler2DShadow, &glsl_type_builtin_vec3),
|
||||
_texture(ir_txb, texture_shadow2Dext, &glsl_type_builtin_float, &glsl_type_builtin_sampler2DShadow, &glsl_type_builtin_vec3),
|
||||
NULL);
|
||||
|
||||
add_function("shadow2DArray",
|
||||
_texture(ir_tex, texture_array, &glsl_type_builtin_vec4, &glsl_type_builtin_sampler2DArrayShadow, &glsl_type_builtin_vec4),
|
||||
_texture(ir_txb, texture_array_derivs_only, &glsl_type_builtin_vec4, &glsl_type_builtin_sampler2DArrayShadow, &glsl_type_builtin_vec4),
|
||||
@@ -4033,6 +4045,11 @@ builtin_builder::create_builtins()
|
||||
_texture(ir_txb, v110_derivatives_only_deprecated_texture, &glsl_type_builtin_vec4, &glsl_type_builtin_sampler2DShadow, &glsl_type_builtin_vec4, TEX_PROJECT),
|
||||
NULL);
|
||||
|
||||
add_function("shadow2DProjEXT",
|
||||
_texture(ir_tex, texture_shadow2Dext, &glsl_type_builtin_float, &glsl_type_builtin_sampler2DShadow, &glsl_type_builtin_vec4, TEX_PROJECT),
|
||||
_texture(ir_txb, texture_shadow2Dext, &glsl_type_builtin_float, &glsl_type_builtin_sampler2DShadow, &glsl_type_builtin_vec4, TEX_PROJECT),
|
||||
NULL);
|
||||
|
||||
add_function("shadow1DLod",
|
||||
_texture(ir_txl, v110_lod_deprecated_texture, &glsl_type_builtin_vec4, &glsl_type_builtin_sampler1DShadow, &glsl_type_builtin_vec3),
|
||||
NULL);
|
||||
|
||||
@@ -771,6 +771,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
|
||||
EXT(EXT_shader_integer_mix),
|
||||
EXT_AEP(EXT_shader_io_blocks),
|
||||
EXT(EXT_shader_samples_identical),
|
||||
EXT(EXT_shadow_samplers),
|
||||
EXT(EXT_tessellation_point_size),
|
||||
EXT_AEP(EXT_tessellation_shader),
|
||||
EXT(EXT_texture_array),
|
||||
|
||||
@@ -880,6 +880,8 @@ struct _mesa_glsl_parse_state {
|
||||
bool EXT_shader_io_blocks_warn;
|
||||
bool EXT_shader_samples_identical_enable;
|
||||
bool EXT_shader_samples_identical_warn;
|
||||
bool EXT_shadow_samplers_enable;
|
||||
bool EXT_shadow_samplers_warn;
|
||||
bool EXT_tessellation_point_size_enable;
|
||||
bool EXT_tessellation_point_size_warn;
|
||||
bool EXT_tessellation_shader_enable;
|
||||
|
||||
@@ -239,6 +239,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
|
||||
|
||||
ctx->Extensions.EXT_gpu_shader4 = true;
|
||||
ctx->Extensions.EXT_shader_integer_mix = true;
|
||||
ctx->Extensions.EXT_shadow_samplers = true;
|
||||
ctx->Extensions.EXT_texture_array = true;
|
||||
|
||||
ctx->Extensions.MESA_shader_integer_functions = true;
|
||||
|
||||
@@ -189,6 +189,7 @@ struct gl_extensions
|
||||
GLboolean EXT_shader_samples_identical;
|
||||
GLboolean EXT_sRGB;
|
||||
GLboolean EXT_stencil_two_side;
|
||||
GLboolean EXT_shadow_samplers;
|
||||
GLboolean EXT_texture_array;
|
||||
GLboolean EXT_texture_buffer_object;
|
||||
GLboolean EXT_texture_compression_latc;
|
||||
|
||||
@@ -284,6 +284,7 @@ _mesa_init_extensions(struct gl_extensions *extensions)
|
||||
extensions->EXT_EGL_image_storage = GL_TRUE;
|
||||
extensions->EXT_gpu_program_parameters = GL_TRUE;
|
||||
extensions->EXT_provoking_vertex = GL_TRUE;
|
||||
extensions->EXT_shadow_samplers = GL_TRUE;
|
||||
extensions->EXT_stencil_two_side = GL_TRUE;
|
||||
extensions->EXT_texture_env_dot3 = GL_TRUE;
|
||||
|
||||
|
||||
@@ -301,6 +301,7 @@ EXT(EXT_shader_integer_mix , EXT_shader_integer_mix
|
||||
EXT(EXT_shader_io_blocks , dummy_true , x , x , x , 31, 2014)
|
||||
EXT(EXT_shader_samples_identical , EXT_shader_samples_identical , GLL, GLC, x , 31, 2015)
|
||||
EXT(EXT_shadow_funcs , ARB_shadow , GLL, x , x , x , 2002)
|
||||
EXT(EXT_shadow_samplers , ARB_shadow , x , x , x , ES2, 2012)
|
||||
EXT(EXT_stencil_two_side , EXT_stencil_two_side , GLL, x , x , x , 2001)
|
||||
EXT(EXT_stencil_wrap , dummy_true , GLL, x , x , x , 2002)
|
||||
EXT(EXT_subtexture , dummy_true , GLL, x , x , x , 1995)
|
||||
|
||||
Reference in New Issue
Block a user