Commit 32a32d82 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Put the SRG read capability check in its own function.

parent 4e66c9c9
...@@ -1940,6 +1940,35 @@ static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORM ...@@ -1940,6 +1940,35 @@ static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORM
return FALSE; return FALSE;
} }
static BOOL CheckSrgbReadCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
{
/* Check for supported sRGB formats (Texture loading and framebuffer) */
if(!GL_SUPPORT(EXT_TEXTURE_SRGB)) {
TRACE_(d3d_caps)("[FAILED] GL_EXT_texture_sRGB not supported\n");
return FALSE;
}
switch (CheckFormat) {
case WINED3DFMT_A8R8G8B8:
case WINED3DFMT_X8R8G8B8:
case WINED3DFMT_A4R4G4B4:
case WINED3DFMT_L8:
case WINED3DFMT_A8L8:
case WINED3DFMT_DXT1:
case WINED3DFMT_DXT2:
case WINED3DFMT_DXT3:
case WINED3DFMT_DXT4:
case WINED3DFMT_DXT5:
TRACE_(d3d_caps)("[OK]\n");
return TRUE;
default:
TRACE_(d3d_caps)("[FAILED] Gamma texture format %s not supported.\n", debug_d3dformat(CheckFormat));
return FALSE;
}
return FALSE;
}
/* Check if a texture format is supported on the given adapter */ /* Check if a texture format is supported on the given adapter */
static BOOL CheckTextureCapability(UINT Adapter, WINED3DFORMAT CheckFormat) static BOOL CheckTextureCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
{ {
...@@ -2199,6 +2228,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt ...@@ -2199,6 +2228,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
} }
/* Check QUERY_SRGBREAD support */
if(Usage & WINED3DUSAGE_QUERY_SRGBREAD) {
if(CheckSrgbReadCapability(Adapter, CheckFormat)) {
UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD;
} else {
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
return WINED3DERR_NOTAVAILABLE;
}
}
} }
} }
} else if(RType == WINED3DRTYPE_SURFACE) { } else if(RType == WINED3DRTYPE_SURFACE) {
...@@ -2261,6 +2300,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt ...@@ -2261,6 +2300,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
} }
/* Check QUERY_SRGBREAD support */
if(Usage & WINED3DUSAGE_QUERY_SRGBREAD) {
if(CheckSrgbReadCapability(Adapter, CheckFormat)) {
UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD;
} else {
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
return WINED3DERR_NOTAVAILABLE;
}
}
} else if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) { } else if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) {
if(Usage & WINED3DUSAGE_DEPTHSTENCIL) if(Usage & WINED3DUSAGE_DEPTHSTENCIL)
UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL; UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL;
...@@ -2272,6 +2321,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt ...@@ -2272,6 +2321,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
TRACE_(d3d_caps)("[FAILED] - Format not supported\n"); TRACE_(d3d_caps)("[FAILED] - Format not supported\n");
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
/* Check QUERY_SRGBREAD support */
if(Usage & WINED3DUSAGE_QUERY_SRGBREAD) {
if(CheckSrgbReadCapability(Adapter, CheckFormat)) {
UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD;
} else {
TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n");
return WINED3DERR_NOTAVAILABLE;
}
}
} }
/* Filter formats that need conversion; For one part, this conversion is unimplemented, /* Filter formats that need conversion; For one part, this conversion is unimplemented,
...@@ -2346,32 +2405,6 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt ...@@ -2346,32 +2405,6 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
} }
} }
/* Check for supported sRGB formats (Texture loading and framebuffer) */
if (Usage & WINED3DUSAGE_QUERY_SRGBREAD) {
if(!GL_SUPPORT(EXT_TEXTURE_SRGB)) {
TRACE_(d3d_caps)("[FAILED] GL_EXT_texture_sRGB not supported\n");
}
switch (CheckFormat) {
case WINED3DFMT_A8R8G8B8:
case WINED3DFMT_X8R8G8B8:
case WINED3DFMT_A4R4G4B4:
case WINED3DFMT_L8:
case WINED3DFMT_A8L8:
case WINED3DFMT_DXT1:
case WINED3DFMT_DXT2:
case WINED3DFMT_DXT3:
case WINED3DFMT_DXT4:
case WINED3DFMT_DXT5:
TRACE_(d3d_caps)("[OK]\n");
break; /* Continue with checking other flags */
default:
TRACE_(d3d_caps)("[FAILED] Gamma texture format %s not supported.\n", debug_d3dformat(CheckFormat));
return WINED3DERR_NOTAVAILABLE;
}
}
/* This format is nothing special and it is supported perfectly. /* This format is nothing special and it is supported perfectly.
* However, ati and nvidia driver on windows do not mark this format as * However, ati and nvidia driver on windows do not mark this format as
* supported (tested with the dxCapsViewer) and pretending to * supported (tested with the dxCapsViewer) and pretending to
......
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