mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 05:10:36 +00:00
wined3d: If the format is not FBO attachable disable sRGB writes only.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9fc3444d6e
commit
69006a7cc6
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue