mirror of
https://github.com/love2d/love.git
synced 2026-08-14 01:20:56 +02:00
Fix Shader:send with storage buffers when the shader uses more than 1.
This commit is contained in:
@@ -358,6 +358,7 @@ void Shader::mapActiveUniforms()
|
||||
glGetProgramInterfaceiv(program, GL_SHADER_STORAGE_BLOCK, GL_ACTIVE_RESOURCES, &numstoragebuffers);
|
||||
|
||||
char namebuffer[2048] = { '\0' };
|
||||
int nextstoragebufferbinding = 0;
|
||||
|
||||
for (int sindex = 0; sindex < numstoragebuffers; sindex++)
|
||||
{
|
||||
@@ -405,8 +406,11 @@ void Shader::mapActiveUniforms()
|
||||
memset(u.buffers, 0, sizeof(Buffer*)* u.count);
|
||||
}
|
||||
|
||||
GLenum props[] = { GL_BUFFER_BINDING };
|
||||
glGetProgramResourceiv(program, GL_SHADER_STORAGE_BLOCK, sindex, 1, props, 1, nullptr, u.ints);
|
||||
// Unlike local uniforms and attributes, OpenGL doesn't auto-assign storage
|
||||
// block bindings if they're unspecified in the shader. So we overwrite them
|
||||
// regardless, here.
|
||||
u.ints[0] = nextstoragebufferbinding++;
|
||||
glShaderStorageBlockBinding(program, sindex, u.ints[0]);
|
||||
|
||||
BufferBinding binding;
|
||||
binding.bindingindex = u.ints[0];
|
||||
@@ -1198,6 +1202,9 @@ Shader::MatrixSize Shader::getMatrixSize(GLenum type) const
|
||||
m.columns = 4;
|
||||
m.rows = 3;
|
||||
break;
|
||||
default:
|
||||
m.columns = m.rows = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return m;
|
||||
|
||||
Reference in New Issue
Block a user