Commit f6b5dc24 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the WINED3DSRGB enum.

parent 7427b722
......@@ -7469,7 +7469,7 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
src_rect.bottom = src_surface->resource.height - src_rect.bottom;
}
else
wined3d_texture_load(src_surface->container, context, SRGB_RGB);
wined3d_texture_load(src_surface->container, context, FALSE);
context_apply_blit_state(context, device);
......
......@@ -2124,7 +2124,7 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
if (context->render_offscreen)
{
wined3d_texture_load(rt->container, context, SRGB_RGB);
wined3d_texture_load(rt->container, context, FALSE);
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->draw_binding);
if (rt->resource.format->id != WINED3DFMT_NULL)
......@@ -2791,13 +2791,11 @@ static void context_preload_texture(struct wined3d_context *context,
const struct wined3d_state *state, unsigned int idx)
{
struct wined3d_texture *texture;
enum WINED3DSRGB srgb;
if (!(texture = state->textures[idx]))
return;
srgb = state->sampler_states[idx][WINED3D_SAMP_SRGB_TEXTURE] ? SRGB_SRGB : SRGB_RGB;
wined3d_texture_load(texture, context, srgb);
wined3d_texture_load(texture, context, state->sampler_states[idx][WINED3D_SAMP_SRGB_TEXTURE]);
}
/* Context activation is done by the caller. */
......@@ -2942,8 +2940,8 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d
/* Read the back buffer of the old drawable into the destination texture. */
if (texture->texture_srgb.name)
wined3d_texture_load(texture, context, SRGB_SRGB);
wined3d_texture_load(texture, context, SRGB_RGB);
wined3d_texture_load(texture, context, TRUE);
wined3d_texture_load(texture, context, FALSE);
surface_invalidate_location(context->current_rt, SFLAG_INDRAWABLE);
}
}
......
......@@ -3402,7 +3402,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
/* Make sure that the destination texture is loaded. */
context = context_acquire(device, NULL);
wined3d_texture_load(dst_texture, context, SRGB_RGB);
wined3d_texture_load(dst_texture, context, FALSE);
context_release(context);
/* Update every surface level of the texture. */
......
......@@ -4085,7 +4085,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
context = context_acquire(device, src_surface);
gl_info = context->gl_info;
context_apply_blit_state(context, device);
wined3d_texture_load(dst_surface->container, context, SRGB_RGB);
wined3d_texture_load(dst_surface->container, context, FALSE);
/* Bind the target texture */
context_bind_texture(context, dst_surface->container->target, dst_surface->container->texture_rgb.name);
......@@ -4193,14 +4193,14 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
context = context_acquire(device, src_surface);
gl_info = context->gl_info;
context_apply_blit_state(context, device);
wined3d_texture_load(dst_surface->container, context, SRGB_RGB);
wined3d_texture_load(dst_surface->container, context, FALSE);
src_offscreen = surface_is_offscreen(src_surface);
noBackBufferBackup = src_offscreen && wined3d_settings.offscreen_rendering_mode == ORM_FBO;
if (!noBackBufferBackup && !src_surface->container->texture_rgb.name)
{
/* Get it a description */
wined3d_texture_load(src_surface->container, context, SRGB_RGB);
wined3d_texture_load(src_surface->container, context, FALSE);
}
/* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring.
......@@ -4489,7 +4489,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
/* Make sure the surface is up-to-date. This should probably use
* surface_load_location() and worry about the destination surface too,
* unless we're overwriting it completely. */
wined3d_texture_load(src_surface->container, context, SRGB_RGB);
wined3d_texture_load(src_surface->container, context, FALSE);
/* Activate the destination context, set it up for blitting */
context_apply_blit_state(context, device);
......
......@@ -510,35 +510,19 @@ DWORD CDECL wined3d_texture_get_priority(const struct wined3d_texture *texture)
/* Context activation is done by the caller */
void wined3d_texture_load(struct wined3d_texture *texture,
struct wined3d_context *context, enum WINED3DSRGB srgb)
struct wined3d_context *context, BOOL srgb)
{
UINT sub_count = texture->level_count * texture->layer_count;
const struct wined3d_gl_info *gl_info = context->gl_info;
BOOL srgb_mode;
DWORD flag;
UINT i;
TRACE("texture %p, srgb %#x.\n", texture, srgb);
if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
srgb = SRGB_RGB;
switch (srgb)
{
case SRGB_RGB:
srgb_mode = FALSE;
break;
case SRGB_SRGB:
srgb_mode = TRUE;
break;
default:
srgb_mode = texture->flags & WINED3D_TEXTURE_IS_SRGB;
break;
}
srgb = FALSE;
if (srgb_mode)
if (srgb)
flag = WINED3D_TEXTURE_SRGB_VALID;
else
flag = WINED3D_TEXTURE_RGB_VALID;
......@@ -552,7 +536,7 @@ void wined3d_texture_load(struct wined3d_texture *texture,
/* Reload the surfaces if the texture is marked dirty. */
for (i = 0; i < sub_count; ++i)
{
texture->texture_ops->texture_sub_resource_load(texture->sub_resources[i], context, srgb_mode);
texture->texture_ops->texture_sub_resource_load(texture->sub_resources[i], context, srgb);
}
texture->flags |= flag;
}
......@@ -561,7 +545,7 @@ void CDECL wined3d_texture_preload(struct wined3d_texture *texture)
{
struct wined3d_context *context;
context = context_acquire(texture->resource.device, NULL);
wined3d_texture_load(texture, context, SRGB_ANY);
wined3d_texture_load(texture, context, texture->flags & WINED3D_TEXTURE_IS_SRGB);
context_release(context);
}
......
......@@ -2043,13 +2043,6 @@ enum wined3d_texture_state
MAX_WINETEXTURESTATES = 11,
};
enum WINED3DSRGB
{
SRGB_ANY = 0, /* Uses the cached value(e.g. external calls) */
SRGB_RGB = 1, /* Loads the rgb texture */
SRGB_SRGB = 2, /* Loads the srgb texture */
};
struct gl_texture
{
DWORD states[MAX_WINETEXTURESTATES];
......@@ -2108,7 +2101,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
void wined3d_texture_load(struct wined3d_texture *texture,
struct wined3d_context *context, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN;
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
#define WINED3D_VFLAG_ALLOCATED 0x00000001
......
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