dirtyunfirom when shader is changed

This commit is contained in:
Ced2911 2013-08-25 21:21:04 +02:00
parent 923bee1332
commit 35619ed7f9
2 changed files with 13 additions and 7 deletions

View file

@ -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();
}

View file

@ -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