Commit 553149a0 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Ignore wined3d_sampler_desc.srgb_decode if WINED3D_SRGB_READ_WRITE_CONTROL is not set.

parent 3b5eca26
......@@ -96,7 +96,8 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE));
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_COMPARE_FUNC,
wined3d_gl_compare_func(desc->comparison_func)));
if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && !desc->srgb_decode)
if ((context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
&& gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && !desc->srgb_decode)
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT));
checkGLcall("sampler creation");
......
......@@ -3513,8 +3513,7 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc
desc->max_anisotropy = 1;
desc->compare = texture->resource.format_flags & WINED3DFMT_FLAG_SHADOW;
desc->comparison_func = WINED3D_CMP_LESSEQUAL;
desc->srgb_decode = !(context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
|| sampler_states[WINED3D_SAMP_SRGB_TEXTURE];
desc->srgb_decode = sampler_states[WINED3D_SAMP_SRGB_TEXTURE];
if (!(texture->resource.format_flags & WINED3DFMT_FLAG_FILTERING))
{
......@@ -3569,7 +3568,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
wined3d_texture_bind(texture, context, srgb);
if (!gl_info->supported[ARB_SAMPLER_OBJECTS])
{
wined3d_texture_apply_sampler_desc(texture, &desc, gl_info);
wined3d_texture_apply_sampler_desc(texture, &desc, context);
}
else
{
......
......@@ -289,13 +289,14 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
/* Context activation is done by the caller (state handler). */
/* This function relies on the correct texture being bound and loaded. */
void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture,
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_gl_info *gl_info)
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
GLenum target = texture->target;
struct gl_texture *gl_tex;
DWORD state;
TRACE("texture %p, sampler_desc %p, gl_info %p.\n", texture, sampler_desc, gl_info);
TRACE("texture %p, sampler_desc %p, context %p.\n", texture, sampler_desc, context);
gl_tex = wined3d_texture_get_gl_texture(texture, texture->flags & WINED3D_TEXTURE_IS_SRGB);
......@@ -357,8 +358,9 @@ void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture,
gl_tex->sampler_desc.max_anisotropy = state;
}
/* These should always be the same unless EXT_texture_sRGB_decode is supported. */
if (!sampler_desc->srgb_decode != !gl_tex->sampler_desc.srgb_decode)
if (!sampler_desc->srgb_decode != !gl_tex->sampler_desc.srgb_decode
&& (context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
&& gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
{
gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT,
sampler_desc->srgb_decode ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT);
......
......@@ -2396,7 +2396,7 @@ static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_t
}
void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture,
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context *context) DECLSPEC_HIDDEN;
void wined3d_texture_bind(struct wined3d_texture *texture,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment