wined3d: Return only the shader major version.

oldstable
Matteo Bruni 2011-10-25 16:58:44 +02:00 committed by Alexandre Julliard
parent 6e6a917617
commit 7254f5e661
5 changed files with 42 additions and 28 deletions

View File

@ -296,12 +296,14 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(IDirect3D8 *iface, U
void fixup_caps(WINED3DCAPS *caps)
{
/* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
if (caps->PixelShaderVersion > D3DPS_VERSION(1,4)) {
if (caps->PixelShaderVersion)
caps->PixelShaderVersion = D3DPS_VERSION(1,4);
}
if (caps->VertexShaderVersion > D3DVS_VERSION(1,1)) {
else
caps->PixelShaderVersion = D3DPS_VERSION(0,0);
if (caps->VertexShaderVersion)
caps->VertexShaderVersion = D3DVS_VERSION(1,1);
}
else
caps->VertexShaderVersion = D3DVS_VERSION(0,0);
caps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, caps->MaxVertexShaderConst);
caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;

View File

@ -325,7 +325,8 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(IDirect3D9Ex *i
void filter_caps(D3DCAPS9* pCaps)
{
DWORD ps_minor_version[] = {0, 4, 0, 0};
DWORD vs_minor_version[] = {0, 1, 0, 0};
DWORD textureFilterCaps =
D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR | D3DPTFILTERCAPS_MINFANISOTROPIC |
D3DPTFILTERCAPS_MINFPYRAMIDALQUAD | D3DPTFILTERCAPS_MINFGAUSSIANQUAD|
@ -382,10 +383,21 @@ void filter_caps(D3DCAPS9* pCaps)
pCaps->MaxVertexShaderConst = min(D3D9_MAX_VERTEX_SHADER_CONSTANTF, pCaps->MaxVertexShaderConst);
pCaps->NumSimultaneousRTs = min(D3D9_MAX_SIMULTANEOUS_RENDERTARGETS, pCaps->NumSimultaneousRTs);
if (pCaps->PixelShaderVersion > D3DPS_VERSION(3,0))
if (pCaps->PixelShaderVersion > 3)
pCaps->PixelShaderVersion = D3DPS_VERSION(3,0);
if (pCaps->VertexShaderVersion > D3DVS_VERSION(3,0))
else
{
DWORD major = pCaps->PixelShaderVersion;
pCaps->PixelShaderVersion = D3DPS_VERSION(major,ps_minor_version[major]);
}
if (pCaps->VertexShaderVersion > 3)
pCaps->VertexShaderVersion = D3DVS_VERSION(3,0);
else
{
DWORD major = pCaps->VertexShaderVersion;
pCaps->VertexShaderVersion = D3DVS_VERSION(major,vs_minor_version[major]);
}
}
static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(IDirect3D9Ex *iface, UINT Adapter,

View File

@ -4915,18 +4915,18 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh
if (gl_info->supported[NV_VERTEX_PROGRAM3])
{
caps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
caps->VertexShaderVersion = 3;
TRACE_(d3d_caps)("Hardware vertex shader version 3.0 enabled (NV_VERTEX_PROGRAM3)\n");
}
else if (vs_consts >= 256)
{
/* Shader Model 2.0 requires at least 256 vertex shader constants */
caps->VertexShaderVersion = WINED3DVS_VERSION(2,0);
caps->VertexShaderVersion = 2;
TRACE_(d3d_caps)("Hardware vertex shader version 2.0 enabled (ARB_PROGRAM)\n");
}
else
{
caps->VertexShaderVersion = WINED3DVS_VERSION(1,1);
caps->VertexShaderVersion = 1;
TRACE_(d3d_caps)("Hardware vertex shader version 1.1 enabled (ARB_PROGRAM)\n");
}
caps->MaxVertexShaderConst = vs_consts;
@ -4950,18 +4950,18 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh
if (gl_info->supported[NV_FRAGMENT_PROGRAM2])
{
caps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
caps->PixelShaderVersion = 3;
TRACE_(d3d_caps)("Hardware pixel shader version 3.0 enabled (NV_FRAGMENT_PROGRAM2)\n");
}
else if (ps_consts >= 32)
{
/* Shader Model 2.0 requires at least 32 pixel shader constants */
caps->PixelShaderVersion = WINED3DPS_VERSION(2,0);
caps->PixelShaderVersion = 2;
TRACE_(d3d_caps)("Hardware pixel shader version 2.0 enabled (ARB_PROGRAM)\n");
}
else
{
caps->PixelShaderVersion = WINED3DPS_VERSION(1,4);
caps->PixelShaderVersion = 1;
TRACE_(d3d_caps)("Hardware pixel shader version 1.4 enabled (ARB_PROGRAM)\n");
}
caps->PixelShader1xMaxValue = 8.0f;

View File

@ -4723,7 +4723,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
if (vs_selected_mode == SHADER_NONE)
{
TRACE_(d3d_caps)("Vertex shader disabled in config, reporting version 0.0\n");
caps->VertexShaderVersion = WINED3DVS_VERSION(0,0);
caps->VertexShaderVersion = 0;
caps->MaxVertexShaderConst = 0;
}
else
@ -4735,7 +4735,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
if (ps_selected_mode == SHADER_NONE)
{
TRACE_(d3d_caps)("Pixel shader disabled in config, reporting version 0.0\n");
caps->PixelShaderVersion = WINED3DPS_VERSION(0,0);
caps->PixelShaderVersion = 0;
caps->PixelShader1xMaxValue = 0.0f;
} else {
caps->PixelShaderVersion = shader_caps.PixelShaderVersion;
@ -4750,7 +4750,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
* are the same among all shader models. So to avoid code duplication set the shader version
* specific, but otherwise constant caps here
*/
if (caps->VertexShaderVersion == WINED3DVS_VERSION(3,0))
if (caps->VertexShaderVersion == 3)
{
/* Where possible set the caps based on OpenGL extensions and if they
* aren't set (in case of software rendering) use the VS 3.0 from
@ -4766,7 +4766,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
caps->MaxVShaderInstructionsExecuted = 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
caps->MaxVertexShader30InstructionSlots = max(512, adapter->gl_info.limits.arb_vs_instructions);
}
else if (caps->VertexShaderVersion == WINED3DVS_VERSION(2,0))
else if (caps->VertexShaderVersion == 2)
{
caps->VS20Caps.Caps = 0;
caps->VS20Caps.DynamicFlowControlDepth = WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH;
@ -4787,7 +4787,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
caps->MaxVertexShader30InstructionSlots = 0;
}
if (caps->PixelShaderVersion == WINED3DPS_VERSION(3,0))
if (caps->PixelShaderVersion == 3)
{
/* Where possible set the caps based on OpenGL extensions and if they
* aren't set (in case of software rendering) use the PS 3.0 from
@ -4814,7 +4814,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
caps->MaxPixelShader30InstructionSlots = max(WINED3DMIN30SHADERINSTRUCTIONS,
adapter->gl_info.limits.arb_ps_instructions);
}
else if(caps->PixelShaderVersion == WINED3DPS_VERSION(2,0))
else if(caps->PixelShaderVersion == 2)
{
/* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
caps->PS20Caps.Caps = 0;
@ -4839,7 +4839,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
caps->MaxPixelShader30InstructionSlots = 0;
}
if (caps->VertexShaderVersion >= WINED3DVS_VERSION(2,0))
if (caps->VertexShaderVersion >= 2)
{
/* OpenGL supports all the formats below, perhaps not always
* without conversion, but it supports them.

View File

@ -4917,13 +4917,13 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
* texldd and texldl instructions. */
if (gl_info->supported[ARB_SHADER_TEXTURE_LOD] || gl_info->supported[EXT_GPU_SHADER4])
{
caps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
caps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
caps->VertexShaderVersion = 3;
caps->PixelShaderVersion = 3;
}
else
{
caps->VertexShaderVersion = WINED3DVS_VERSION(2,0);
caps->PixelShaderVersion = WINED3DPS_VERSION(2,0);
caps->VertexShaderVersion = 2;
caps->PixelShaderVersion = 2;
}
caps->MaxVertexShaderConst = gl_info->limits.glsl_vs_float_constants;
@ -4945,10 +4945,10 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
caps->VSClipping = TRUE;
TRACE_(d3d_caps)("Hardware vertex shader version %u.%u enabled (GLSL).\n",
(caps->VertexShaderVersion >> 8) & 0xff, caps->VertexShaderVersion & 0xff);
TRACE_(d3d_caps)("Hardware pixel shader version %u.%u enabled (GLSL).\n",
(caps->PixelShaderVersion >> 8) & 0xff, caps->PixelShaderVersion & 0xff);
TRACE_(d3d_caps)("Hardware vertex shader version %u enabled (GLSL).\n",
caps->VertexShaderVersion);
TRACE_(d3d_caps)("Hardware pixel shader version %u enabled (GLSL).\n",
caps->PixelShaderVersion);
}
static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup)