[PATCH] Add proper PS2.0 detection for older cards with GLSL support.

Roderick Colenbrander thunderbird2k at gmx.net
Sat Oct 27 15:59:47 CDT 2007


---
 dlls/wined3d/directx.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index f597af9..df12b7e 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2386,9 +2386,18 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
     *pCaps->MaxVertexShaderConst = GL_LIMITS(vshader_constantsF);
 
     if (ps_selected_mode == SHADER_GLSL) {
-        /* See the comment about VS2.0/VS3.0 detection as we do the same here but then based on NV_fragment_program
-           in case of GeforceFX cards. */
-        if(GLINFO_LOCATION.ps_nv_version == PS_VERSION_20)
+        /* Older DX9-class videocards (GeforceFX / Radeon >9500/X*00) only support pixel shader 2.0/2.0a/2.0b.
+         * In OpenGL the extensions related to GLSL abstract lowlevel GL info away which is needed
+         * to distinguish between 2.0 and 3.0 (and 2.0a/2.0b). In case of Nvidia we use their fragment
+         * program extensions. On other hardware including ATI GL_ARB_fragment_program offers the info
+         * in max native instructions. Intel and others also offer the info in this extension but they
+         * don't support GLSL (at least on Windows).
+         *
+         * PS2.0 requires at least 96 instructions, 2.0a/2.0b go upto 512. Assume that if the number
+         * of instructions is 512 or less we have to do with ps2.0 hardware.
+         * NOTE: ps3.0 hardware requires 512 or more instructions but ati and nvidia offer 'enough' (1024 vs 4096) on their most basic ps3.0 hardware.
+         */
+        if((GLINFO_LOCATION.ps_nv_version == PS_VERSION_20) || (GLINFO_LOCATION.ps_arb_max_instructions <= 512))
             *pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0);
         else
             *pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
-- 
1.5.1.3


--========GMX103261193520868909290--



More information about the wine-patches mailing list