Module: wine
Branch: master
Commit: 3f0120241bcfdcd28cc8c918ae38e4420fa20ae1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3f0120241bcfdcd28cc8c918a…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Mon Apr 25 22:54:15 2011 +0200
wined3d: Enable SM3 if ARB_shader_texture_lod is supported.
---
dlls/wined3d/glsl_shader.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index ba5a159..499ed15 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -4933,9 +4933,16 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
* goes up to 512. Assume that if the number of instructions is 512 or
* less we have to do with SM2 hardware. NOTE: SM3 requires 512 or more
* instructions but ATI and NVIDIA offer more than that (1024 vs 4096) on
- * their most basic SM3 hardware. */
+ * their most basic SM3 hardware.
+ *
+ * ARB_shader_texture_lod is a requirement for SM3 (texldd). Ideally we'd
+ * make this a hard requirement, but the extension is still somewhat new,
+ * and relatively few SM3 shaders actually depend on it. For the moment
+ * just use it to enable SM3 (20110423). */
if ((gl_info->supported[NV_VERTEX_PROGRAM3] && gl_info->supported[NV_FRAGMENT_PROGRAM2])
- || gl_info->limits.arb_ps_instructions > 512)
+ || gl_info->limits.arb_ps_instructions > 512
+ || gl_info->supported[ARB_SHADER_TEXTURE_LOD]
+ || gl_info->supported[EXT_GPU_SHADER4])
{
pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
Module: wine
Branch: master
Commit: 9d0e17e9ea360a827e7ab1e0ef984f6d9901f0df
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9d0e17e9ea360a827e7ab1e0e…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Mon Apr 25 22:54:14 2011 +0200
wined3d: Either set SM3 for both vertex and fragment shaders or for neither.
---
dlls/wined3d/glsl_shader.c | 56 +++++++++++++++++++------------------------
1 files changed, 25 insertions(+), 31 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 0fb0596..ba5a159 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -4924,39 +4924,29 @@ static BOOL shader_glsl_dirty_const(void)
static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *pCaps)
{
- /* 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 based
- * on the version of 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 ((gl_info->supported[NV_VERTEX_PROGRAM2] && !gl_info->supported[NV_VERTEX_PROGRAM3])
- || gl_info->limits.arb_ps_instructions <= 512)
- pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0);
- else
+ /* NVIDIA GeForce 6 / 7 or ATI R4xx / R5xx cards with GLSL support
+ * support SM3, but older NVIDIA / ATI models with GLSL support only
+ * support SM2. In case of NVIDIA we can detect SM3 support based on the
+ * version of NV_vertex_program / NV_fragment_program. For other cards we
+ * try to detect SM3 based on the maximum number of native fragment
+ * program instructions. PS2.0 requires at least 96 instructions, 2.0a/b
+ * goes up to 512. Assume that if the number of instructions is 512 or
+ * less we have to do with SM2 hardware. NOTE: SM3 requires 512 or more
+ * instructions but ATI and NVIDIA offer more than that (1024 vs 4096) on
+ * their most basic SM3 hardware. */
+ if ((gl_info->supported[NV_VERTEX_PROGRAM3] && gl_info->supported[NV_FRAGMENT_PROGRAM2])
+ || gl_info->limits.arb_ps_instructions > 512)
+ {
pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
- TRACE_(d3d_caps)("Hardware vertex shader version %d.%d enabled (GLSL)\n", (pCaps->VertexShaderVersion >> 8) & 0xff, pCaps->VertexShaderVersion & 0xff);
- pCaps->MaxVertexShaderConst = gl_info->limits.glsl_vs_float_constants;
-
- /* 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 up to 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 ((gl_info->supported[NV_FRAGMENT_PROGRAM] && !gl_info->supported[NV_FRAGMENT_PROGRAM2])
- || gl_info->limits.arb_ps_instructions <= 512)
- pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0);
- else
pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
+ }
+ else
+ {
+ pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0);
+ pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0);
+ }
+ pCaps->MaxVertexShaderConst = gl_info->limits.glsl_vs_float_constants;
pCaps->MaxPixelShaderConst = gl_info->limits.glsl_ps_float_constants;
/* FIXME: The following line is card dependent. -8.0 to 8.0 is the
@@ -4972,9 +4962,13 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
* offer a way to query this.
*/
pCaps->PixelShader1xMaxValue = 8.0;
- TRACE_(d3d_caps)("Hardware pixel shader version %d.%d enabled (GLSL)\n", (pCaps->PixelShaderVersion >> 8) & 0xff, pCaps->PixelShaderVersion & 0xff);
pCaps->VSClipping = TRUE;
+
+ TRACE_(d3d_caps)("Hardware vertex shader version %u.%u enabled (GLSL).\n",
+ (pCaps->VertexShaderVersion >> 8) & 0xff, pCaps->VertexShaderVersion & 0xff);
+ TRACE_(d3d_caps)("Hardware pixel shader version %u.%u enabled (GLSL).\n",
+ (pCaps->PixelShaderVersion >> 8) & 0xff, pCaps->PixelShaderVersion & 0xff);
}
static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup)