Roderick Colenbrander : wined3d: Put the SRG read capability check in its own function.
Alexandre Julliard
julliard at winehq.org
Tue Mar 18 07:44:51 CDT 2008
Module: wine
Branch: master
Commit: 32a32d82c417b7af86b00fe86492cfea850c4417
URL: http://source.winehq.org/git/wine.git/?a=commit;h=32a32d82c417b7af86b00fe86492cfea850c4417
Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date: Mon Mar 17 18:32:53 2008 +0100
wined3d: Put the SRG read capability check in its own function.
---
dlls/wined3d/directx.c | 85 +++++++++++++++++++++++++++++++++--------------
1 files changed, 59 insertions(+), 26 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index f7f0adc..ab60722 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1940,6 +1940,35 @@ static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORM
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 */
static BOOL CheckTextureCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
{
@@ -2199,6 +2228,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
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) {
@@ -2261,6 +2300,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
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)) {
if(Usage & WINED3DUSAGE_DEPTHSTENCIL)
UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL;
@@ -2272,6 +2321,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
TRACE_(d3d_caps)("[FAILED] - Format not supported\n");
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,
@@ -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.
* However, ati and nvidia driver on windows do not mark this format as
* supported (tested with the dxCapsViewer) and pretending to
More information about the wine-cvs
mailing list