mirror of https://github.com/bjornbytes/lovr.git
Fix issue with shader uniforms;
Shader == NULL wasn't clearing the dirty uniform flag, so if the uniforms were dirty when you set a default shader we would try to allocate and bind a zero-size uniform buffer. Instead, let's avoid making a new uniform buffer if the shader doesn't have any uniforms!
This commit is contained in:
parent
fd331090c9
commit
79e28eb7e3
|
@ -5741,8 +5741,6 @@ void lovrPassSetShader(Pass* pass, Shader* shader) {
|
|||
|
||||
pass->uniforms = uniforms;
|
||||
pass->flags |= DIRTY_UNIFORMS;
|
||||
} else {
|
||||
pass->flags &= ~DIRTY_UNIFORMS;
|
||||
}
|
||||
|
||||
// Custom vertex attributes must be reset: their locations may differ even if the names match
|
||||
|
@ -6128,7 +6126,7 @@ void lovrPassDraw(Pass* pass, DrawInfo* info) {
|
|||
lovrPassResolveVertices(pass, info, draw);
|
||||
draw->bundleInfo = lovrPassResolveBindings(pass, draw->shader, previous ? previous->bundleInfo : NULL);
|
||||
|
||||
if (pass->flags & DIRTY_UNIFORMS) {
|
||||
if (draw->shader->uniformCount > 0 && pass->flags & DIRTY_UNIFORMS) {
|
||||
lovrPassResolveUniforms(pass, draw->shader, &draw->uniformBuffer, &draw->uniformOffset);
|
||||
pass->flags &= ~DIRTY_UNIFORMS;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue