Commit 2f1e01bb authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Put vertex texture capability checking in its own function.

parent 32a32d82
......@@ -2167,6 +2167,29 @@ MAKEFOURCC('I','N','S','T') once
return FALSE;
}
static BOOL CheckVertexTextureCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
{
if (!GL_LIMITS(vertex_samplers)) {
TRACE_(d3d_caps)("[FAILED]\n");
return FALSE;
}
switch (CheckFormat) {
case WINED3DFMT_A32B32G32R32F:
if (!GL_SUPPORT(ARB_TEXTURE_FLOAT)) {
TRACE_(d3d_caps)("[FAILED]\n");
return FALSE;
}
TRACE_(d3d_caps)("[OK]\n");
return TRUE;
default:
TRACE_(d3d_caps)("[FAILED]\n");
return FALSE;
}
return FALSE;
}
static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType,
WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
......@@ -2238,6 +2261,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
return WINED3DERR_NOTAVAILABLE;
}
}
/* Check QUERY_VERTEXTEXTURE support */
if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) {
if(CheckVertexTextureCapability(Adapter, CheckFormat)) {
UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE;
} else {
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
return WINED3DERR_NOTAVAILABLE;
}
}
}
}
} else if(RType == WINED3DRTYPE_SURFACE) {
......@@ -2310,6 +2343,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
return WINED3DERR_NOTAVAILABLE;
}
}
/* Check QUERY_VERTEXTEXTURE support */
if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) {
if(CheckVertexTextureCapability(Adapter, CheckFormat)) {
UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE;
} else {
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
return WINED3DERR_NOTAVAILABLE;
}
}
} else if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) {
if(Usage & WINED3DUSAGE_DEPTHSTENCIL)
UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL;
......@@ -2331,6 +2374,16 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
return WINED3DERR_NOTAVAILABLE;
}
}
/* Check QUERY_VERTEXTEXTURE support */
if(Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) {
if(CheckVertexTextureCapability(Adapter, CheckFormat)) {
UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE;
} else {
TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n");
return WINED3DERR_NOTAVAILABLE;
}
}
}
/* Filter formats that need conversion; For one part, this conversion is unimplemented,
......@@ -2383,27 +2436,6 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
break;
}
}
/* TODO: Check support against more of the WINED3DUSAGE_QUERY_* constants */
if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) {
if (!GL_LIMITS(vertex_samplers)) {
TRACE_(d3d_caps)("[FAILED]\n");
return WINED3DERR_NOTAVAILABLE;
}
switch (CheckFormat) {
case WINED3DFMT_A32B32G32R32F:
if (!GL_SUPPORT(ARB_TEXTURE_FLOAT)) {
TRACE_(d3d_caps)("[FAILED]\n");
return WINED3DERR_NOTAVAILABLE;
}
TRACE_(d3d_caps)("[OK]\n");
return WINED3D_OK;
default:
TRACE_(d3d_caps)("[FAILED]\n");
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
......
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