From 1b320431b8aed7894f19a5625517b1e80fbcdefa Mon Sep 17 00:00:00 2001 From: Phil Costin Date: Thu, 18 May 2006 02:24:08 +0100 Subject: [PATCH] wined3d: Check registry for UseGLSL enabled. --- dlls/wined3d/directx.c | 16 ++++++++-------- dlls/wined3d/wined3d_main.c | 17 ++++++++++++++++- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index ce05a45652e..c8709427c48 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1677,15 +1677,15 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3D *pCaps->MaxStreams = MAX_STREAMS; *pCaps->MaxStreamStride = 1024; - if (wined3d_settings.vs_mode == VS_HW && GL_SUPPORT(ARB_SHADING_LANGUAGE_100) && DeviceType != WINED3DDEVTYPE_REF) { - /* FIXME: Uncomment the line below and remove the line beneath that to set Vertex Shader 2.0+ capability */ - /* *pCaps->VertexShaderVersion = D3DVS_VERSION(3,0); */ - *pCaps->VertexShaderVersion = D3DVS_VERSION(1,1); + if (wined3d_settings.vs_mode == VS_HW && GL_SUPPORT(ARB_SHADING_LANGUAGE_100) && + wined3d_settings.glslRequested && DeviceType != WINED3DDEVTYPE_REF) { + *pCaps->VertexShaderVersion = D3DVS_VERSION(3,0); TRACE_(d3d_caps)("Hardware Vertex Shaders versions 2.0+ enabled\n"); } else if (wined3d_settings.vs_mode == VS_HW && GL_SUPPORT(ARB_VERTEX_PROGRAM) && DeviceType != WINED3DDEVTYPE_REF) { *pCaps->VertexShaderVersion = D3DVS_VERSION(1,1); TRACE_(d3d_caps)("Hardware Vertex Shader version 1.1 enabled\n"); } else if (wined3d_settings.vs_mode == VS_SW || DeviceType == WINED3DDEVTYPE_REF) { + /* FIXME: Change the following line (when needed) to reflect the reported software vertex shader version implemented */ *pCaps->VertexShaderVersion = D3DVS_VERSION(1,1); TRACE_(d3d_caps)("Software Vertex Shader version 1.1 enabled\n"); } else { @@ -1699,10 +1699,10 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3D *pCaps->MaxVertexShaderConst = WINED3D_VSHADER_MAX_CONSTANTS; } - if (wined3d_settings.ps_mode == PS_HW && GL_SUPPORT(ARB_SHADING_LANGUAGE_100) && DeviceType != WINED3DDEVTYPE_REF) { - /* FIXME: Uncomment the following line and remove the line beneath that to set Pixel Shader 2.0+ capability */ - /* *pCaps->PixelShaderVersion = D3DPS_VERSION(3,0); */ - *pCaps->PixelShaderVersion = D3DPS_VERSION(1,4); + if (wined3d_settings.ps_mode == PS_HW && GL_SUPPORT(ARB_SHADING_LANGUAGE_100) && + wined3d_settings.glslRequested && DeviceType != WINED3DDEVTYPE_REF) { + *pCaps->PixelShaderVersion = D3DPS_VERSION(3,0); + /* FIXME: The following line is card dependant. -1.0 to 1.0 is a safe default clamp range for now */ *pCaps->PixelShader1xMaxValue = 1.0; TRACE_(d3d_caps)("Hardware Pixel Shaders versions 2.0+ enabled\n"); } else if (wined3d_settings.ps_mode == PS_HW && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && DeviceType != WINED3DDEVTYPE_REF) { diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 339b871086f..ae7bac60e27 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -36,7 +36,8 @@ wined3d_settings_t wined3d_settings = { VS_HW, /* Hardware by default */ PS_NONE, /* Disabled by default */ - VBO_HW /* Hardware by default */ + VBO_HW, /* Hardware by default */ + FALSE /* Use of GLSL disabled by default */ }; WineD3DGlobalStatistics *wineD3DGlobalStatistics = NULL; @@ -168,6 +169,18 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) wined3d_settings.vbo_mode = VBO_HW; } } + if ( !get_config_key( hkey, appkey, "UseGLSL", buffer, size) ) + { + if (!strcmp(buffer,"enabled")) + { + TRACE("Use of GL Shading Language enabled for systems that support it\n"); + wined3d_settings.glslRequested = TRUE; + } + else + { + TRACE("Use of GL Shading Language disabled\n"); + } + } if ( !get_config_key( hkey, appkey, "Nonpower2Mode", buffer, size) ) { if (!strcmp(buffer,"none")) @@ -190,6 +203,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) TRACE("Disable pixel shaders\n"); if (wined3d_settings.vbo_mode == VBO_NONE) TRACE("Disable Vertex Buffer Hardware support\n"); + if (wined3d_settings.glslRequested) + TRACE("If supported by your system, GL Shading Language will be used\n"); if (wined3d_settings.nonpower2_mode == NP2_REPACK) TRACE("Repacking non-power2 textures\n"); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 6b905446bf1..6754877138d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -137,6 +137,7 @@ typedef struct wined3d_settings_s { int vs_mode; int ps_mode; int vbo_mode; + BOOL glslRequested; /* nonpower 2 function */ int nonpower2_mode; } wined3d_settings_t;