From 35619ed7f930382eab6ce5f60e7d0f94e9720f58 Mon Sep 17 00:00:00 2001 From: Ced2911 Date: Sun, 25 Aug 2013 21:21:04 +0200 Subject: [PATCH] dirtyunfirom when shader is changed --- GPU/Directx9/ShaderManager.cpp | 5 +++++ GPU/Directx9/VertexShaderGenerator.cpp | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/GPU/Directx9/ShaderManager.cpp b/GPU/Directx9/ShaderManager.cpp index 0084300598..aede525d11 100644 --- a/GPU/Directx9/ShaderManager.cpp +++ b/GPU/Directx9/ShaderManager.cpp @@ -633,6 +633,11 @@ LinkedShader *ShaderManager::ApplyShader(int prim) { const LinkedShaderCacheEntry entry(vs, fs, ls); linkedShaderCache_.push_back(entry); } else { + // If shader changed we need to update all uniforms + if (lastShader_ != ls) { + ls->dirtyUniforms = DIRTY_ALL; + } + ls->use(); } diff --git a/GPU/Directx9/VertexShaderGenerator.cpp b/GPU/Directx9/VertexShaderGenerator.cpp index 1f1e7d7e9a..e33b0bad58 100644 --- a/GPU/Directx9/VertexShaderGenerator.cpp +++ b/GPU/Directx9/VertexShaderGenerator.cpp @@ -149,17 +149,18 @@ void GenerateVertexShader(int prim, char *buffer, bool useHWTransform) { doLight[i] = LIGHT_FULL; } } + + + if (gstate.isModeThrough()) { + WRITE(p, "float4x4 u_proj_through;\n"); + } else { + WRITE(p, "float4x4 u_proj;\n"); + // Add all the uniforms we'll need to transform properly. + } if (enableFog) { WRITE(p, "float2 u_fogcoef;\n"); } - - if (gstate.isModeThrough()) { - WRITE(p, "float4x4 u_proj_through:register(c0);\n"); - } else { - WRITE(p, "float4x4 u_proj:register(c8);\n"); - // Add all the uniforms we'll need to transform properly. - } if (useHWTransform || !hasColor) WRITE(p, "float4 u_matambientalpha;\n"); // matambient + matalpha