Module: wine
Branch: master
Commit: efc18d79afdc3b639c6b820a48ca178113c63310
URL: http://source.winehq.org/git/wine.git/?a=commit;h=efc18d79afdc3b639c6b820a4…
Author: Roderick Colenbrander <thunderbird2k(a)gmx.net>
Date: Sat Oct 27 23:54:10 2007 +0200
wined3d: Detect vertex shader 2.0 support using a pixel shader 2.0 limit.
Without this vertex shader 3.0 is reported on non-Nvidia cards that
only support vertex shader 2.0. Reporting 3.0 would result in slow
software rendering as it is much more advanced than 2.0.
---
dlls/wined3d/directx.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index ad71295..47bf9e1 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2367,10 +2367,13 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
if (vs_selected_mode == SHADER_GLSL) {
/* Nvidia Geforce6/7 or Ati R4xx/R5xx cards with GLSL support, support VS 3.0 but older Nvidia/Ati
- models with GLSL support only support 2.0. In case of nvidia we can detect VS 2.0 support using
- vs_nv_version which is based on NV_vertex_program. For Ati cards there's no easy way, so for
- now only support 2.0/3.0 detection on Nvidia GeforceFX cards and default to 3.0 for everything else */
- if(GLINFO_LOCATION.vs_nv_version == VS_VERSION_20)
+ * models with GLSL support only support 2.0. In case of nvidia we can detect VS 2.0 support using
+ * vs_nv_version which is based on NV_vertex_program.
+ * For Ati cards there's no way using glsl (it abstracts the lowlevel info away) and also not
+ * using ARB_vertex_program. It is safe to assume that when a card supports pixel shader 2.0 it
+ * supports vertex shader 2.0 too and the way around. We can detect ps2.0 using the maximum number
+ * of native instructions, so use that here. For more info see the pixel shader versioning code below. */
+ if((GLINFO_LOCATION.vs_nv_version == VS_VERSION_20) || (GLINFO_LOCATION.ps_arb_max_instructions <= 512))
*pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0);
else
*pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
Module: wine
Branch: master
Commit: 50ed6f36d2cdb29e39648546a688cec92917076d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=50ed6f36d2cdb29e39648546a…
Author: Roderick Colenbrander <thunderbird2k(a)gmx.net>
Date: Sat Oct 27 22:59:47 2007 +0200
wined3d: Add proper PS2.0 detection for older cards with GLSL support.
---
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);