wined3d: Filter sRGB capabilities during format initialization.

This commit is contained in:
Henri Verbeet 2011-02-28 08:05:36 +01:00 committed by Alexandre Julliard
parent 6f18cc59dd
commit d9d2fe31e3
3 changed files with 10 additions and 3 deletions

View File

@ -3159,7 +3159,7 @@ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter,
static BOOL CheckSrgbReadCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) static BOOL CheckSrgbReadCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format)
{ {
return adapter->gl_info.supported[EXT_TEXTURE_SRGB] && (format->flags & WINED3DFMT_FLAG_SRGB_READ); return format->flags & WINED3DFMT_FLAG_SRGB_READ;
} }
static BOOL CheckSrgbWriteCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) static BOOL CheckSrgbWriteCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format)

View File

@ -1197,6 +1197,14 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info)
format->flags |= format_texture_info[i].flags; format->flags |= format_texture_info[i].flags;
format->heightscale = 1.0f; format->heightscale = 1.0f;
/* Filter sRGB capabilities if EXT_texture_sRGB is not supported. */
if (!gl_info->supported[EXT_TEXTURE_SRGB]
&& format->glGammaInternal != format->glInternal)
{
format->glGammaInternal = format->glInternal;
format->flags &= ~(WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
}
/* Texture conversion stuff */ /* Texture conversion stuff */
format->convert = format_texture_info[i].convert; format->convert = format_texture_info[i].convert;
format->conv_byte_count = format_texture_info[i].conv_byte_count; format->conv_byte_count = format_texture_info[i].conv_byte_count;

View File

@ -40,7 +40,6 @@ static HRESULT volumetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
static void volumetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb) static void volumetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb)
{ {
IWineD3DDeviceImpl *device = texture->resource.device; IWineD3DDeviceImpl *device = texture->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_context *context = NULL; struct wined3d_context *context = NULL;
BOOL srgb_mode = texture->baseTexture.is_srgb; BOOL srgb_mode = texture->baseTexture.is_srgb;
BOOL srgb_was_toggled = FALSE; BOOL srgb_was_toggled = FALSE;
@ -49,7 +48,7 @@ static void volumetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3D
TRACE("texture %p, srgb %#x.\n", texture, srgb); TRACE("texture %p, srgb %#x.\n", texture, srgb);
if (!device->isInDraw) context = context_acquire(device, NULL); if (!device->isInDraw) context = context_acquire(device, NULL);
else if (gl_info->supported[EXT_TEXTURE_SRGB] && texture->baseTexture.bindCount > 0) else if (texture->baseTexture.bindCount > 0)
{ {
srgb_mode = device->stateBlock->state.sampler_states[texture->baseTexture.sampler][WINED3DSAMP_SRGBTEXTURE]; srgb_mode = device->stateBlock->state.sampler_states[texture->baseTexture.sampler][WINED3DSAMP_SRGBTEXTURE];
srgb_was_toggled = texture->baseTexture.is_srgb != srgb_mode; srgb_was_toggled = texture->baseTexture.is_srgb != srgb_mode;