Matteo Bruni : wined3d: If the format is not FBO attachable disable sRGB writes only.
Alexandre Julliard
julliard at winehq.org
Mon Jan 30 15:39:17 CST 2017
Module: wine
Branch: master
Commit: 69006a7cc6c43256501f3d6c0a370ced2b2c53fa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=69006a7cc6c43256501f3d6c0a370ced2b2c53fa
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Fri Jan 27 19:52:55 2017 +0100
wined3d: If the format is not FBO attachable disable sRGB writes only.
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/texture.c | 4 ++--
dlls/wined3d/utils.c | 4 ++--
dlls/wined3d/wined3d_private.h | 31 ++++++++++++++++++-------------
3 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index b4267ed..63577d7 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -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)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 1976bc6..4f063b4 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -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)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 051836c..eaf54b1 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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)
More information about the wine-cvs
mailing list