Commit 69006a7c authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: If the format is not FBO attachable disable sRGB writes only.

parent 9fc3444d
......@@ -572,7 +572,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
TRACE("texture %p, context %p, srgb %#x.\n", texture, context, srgb);
if (!needs_separate_srgb_gl_texture(context))
if (!needs_separate_srgb_gl_texture(context, texture))
srgb = FALSE;
/* sRGB mode cache for preload() calls outside drawprim. */
......@@ -912,7 +912,7 @@ void wined3d_texture_load(struct wined3d_texture *texture,
TRACE("texture %p, context %p, srgb %#x.\n", texture, context, srgb);
if (!needs_separate_srgb_gl_texture(context))
if (!needs_separate_srgb_gl_texture(context, texture))
srgb = FALSE;
if (srgb)
......
......@@ -2389,7 +2389,7 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
{
WARN("Format %s's sRGB format is not FBO attachable, type %u.\n",
debug_d3dformat(format->id), type);
format_clear_flag(format, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
format_clear_flag(format, WINED3DFMT_FLAG_SRGB_WRITE);
}
}
else if (status == GL_FRAMEBUFFER_COMPLETE)
......@@ -2533,7 +2533,7 @@ static void init_format_fbo_compat_info(struct wined3d_caps_gl_ctx *ctx)
{
WARN("Format %s's sRGB format is not FBO attachable, resource type %u.\n",
debug_d3dformat(format->id), type);
format_clear_flag(format, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
format_clear_flag(format, WINED3DFMT_FLAG_SRGB_WRITE);
}
}
else if (format->flags[type] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
......
......@@ -2949,12 +2949,6 @@ struct wined3d_surface
struct list overlay_entry;
};
static inline BOOL needs_separate_srgb_gl_texture(const struct wined3d_context *context)
{
return !context->gl_info->supported[EXT_TEXTURE_SRGB_DECODE]
&& context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL;
}
static inline unsigned int surface_get_sub_resource_idx(const struct wined3d_surface *surface)
{
return surface->texture_layer * surface->container->level_count + surface->texture_level;
......@@ -2965,13 +2959,6 @@ static inline struct wined3d_texture_sub_resource *surface_get_sub_resource(stru
return &surface->container->sub_resources[surface_get_sub_resource_idx(surface)];
}
static inline GLuint surface_get_texture_name(const struct wined3d_surface *surface,
const struct wined3d_context *context, BOOL srgb)
{
return srgb && needs_separate_srgb_gl_texture(context)
? surface->container->texture_srgb.name : surface->container->texture_rgb.name;
}
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
......@@ -3842,6 +3829,17 @@ static inline void context_apply_state(struct wined3d_context *context,
state_table[rep].apply(context, state, rep);
}
static inline BOOL needs_separate_srgb_gl_texture(const struct wined3d_context *context,
const struct wined3d_texture *texture)
{
unsigned int flags = texture->resource.format_flags;
return (!context->gl_info->supported[EXT_TEXTURE_SRGB_DECODE]
|| (flags & (WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE))
!= (WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE))
&& context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL;
}
static inline BOOL needs_srgb_write(const struct wined3d_context *context,
const struct wined3d_state *state, const struct wined3d_fb_state *fb)
{
......@@ -3850,6 +3848,13 @@ static inline BOOL needs_srgb_write(const struct wined3d_context *context,
&& fb->render_targets[0] && fb->render_targets[0]->format_flags & WINED3DFMT_FLAG_SRGB_WRITE;
}
static inline GLuint surface_get_texture_name(const struct wined3d_surface *surface,
const struct wined3d_context *context, BOOL srgb)
{
return srgb && needs_separate_srgb_gl_texture(context, surface->container)
? surface->container->texture_srgb.name : surface->container->texture_rgb.name;
}
static inline BOOL can_use_texture_swizzle(const struct wined3d_gl_info *gl_info, const struct wined3d_format *format)
{
return gl_info->supported[ARB_TEXTURE_SWIZZLE] && !is_complex_fixup(format->color_fixup)
......
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