Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
Tested with Mesa i965 driver.
--- dlls/wined3d/adapter_gl.c | 1 + dlls/wined3d/glsl_shader.c | 8 ++++++-- dlls/wined3d/wined3d_gl.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index dd357e62510c..4f4b54ee028f 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -200,6 +200,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_EXT_texture_integer", EXT_TEXTURE_INTEGER }, {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS }, {"GL_EXT_texture_mirror_clamp", EXT_TEXTURE_MIRROR_CLAMP }, + {"GL_EXT_texture_shadow_lod", EXT_TEXTURE_SHADOW_LOD }, {"GL_EXT_texture_shared_exponent", EXT_TEXTURE_SHARED_EXPONENT }, {"GL_EXT_texture_snorm", EXT_TEXTURE_SNORM }, {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB }, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index d5003293e6df..d2a55b83df38 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -6007,7 +6007,7 @@ static void shader_glsl_sample(const struct wined3d_shader_instruction *ins) * comparison for array textures and cube textures. We use textureGrad*() * to implement sample_c_lz. */ -static void shader_glsl_gen_sample_c_lz(const struct wined3d_shader_instruction *ins, +static void shader_glsl_gen_sample_c_lz_emulation(const struct wined3d_shader_instruction *ins, unsigned int sampler_bind_idx, const struct glsl_sample_function *sample_function, unsigned int coord_size, const char *coord_param, const char *ref_param) { @@ -6036,6 +6036,7 @@ static void shader_glsl_gen_sample_c_lz(const struct wined3d_shader_instruction
static void shader_glsl_sample_c(const struct wined3d_shader_instruction *ins) { + const struct wined3d_gl_info *gl_info = ins->ctx->gl_info; unsigned int resource_idx, sampler_idx, sampler_bind_idx; const struct wined3d_shader_resource_info *resource_info; struct glsl_src_param coord_param, compare_param; @@ -6064,10 +6065,11 @@ static void shader_glsl_sample_c(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[3], WINED3DSP_WRITEMASK_0, &compare_param); sampler_bind_idx = shader_glsl_find_sampler(&ins->ctx->reg_maps->sampler_map, resource_idx, sampler_idx); if (ins->handler_idx == WINED3DSIH_SAMPLE_C_LZ + && !gl_info->supported[EXT_TEXTURE_SHADOW_LOD] && (resource_info->type == WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY || resource_info->type == WINED3D_SHADER_RESOURCE_TEXTURE_CUBE)) { - shader_glsl_gen_sample_c_lz(ins, sampler_bind_idx, &sample_function, + shader_glsl_gen_sample_c_lz_emulation(ins, sampler_bind_idx, &sample_function, coord_size, coord_param.param_str, compare_param.param_str); } else @@ -7453,6 +7455,8 @@ static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer, shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n"); if (gl_info->supported[EXT_TEXTURE_ARRAY]) shader_addline(buffer, "#extension GL_EXT_texture_array : enable\n"); + if (gl_info->supported[EXT_TEXTURE_SHADOW_LOD]) + shader_addline(buffer, "#extension GL_EXT_texture_shadow_lod : enable\n"); }
static void shader_glsl_generate_color_output(struct wined3d_string_buffer *buffer, diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 0e5ae5e17213..678ad1a4ef24 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -179,6 +179,7 @@ enum wined3d_gl_extension EXT_TEXTURE_INTEGER, EXT_TEXTURE_LOD_BIAS, EXT_TEXTURE_MIRROR_CLAMP, + EXT_TEXTURE_SHADOW_LOD, EXT_TEXTURE_SHARED_EXPONENT, EXT_TEXTURE_SNORM, EXT_TEXTURE_SRGB,