Merge branch '12.0-development' into metal

This commit is contained in:
Alex Szpakowski
2021-12-24 15:35:18 -04:00
61 changed files with 2101 additions and 2925 deletions
+21 -2
View File
@@ -166,6 +166,12 @@ void Shader::mapActiveUniforms()
u.storageTextureFormat = reflectionit->second.format;
u.access = reflectionit->second.access;
}
else
{
// No reflection info - maybe glslang was better at detecting
// dead code than the driver's compiler?
continue;
}
StorageTextureBinding binding = {};
binding.gltexture = gl.getDefaultTexture(u.textureType, u.dataBaseType);
@@ -352,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++)
{
@@ -372,6 +379,12 @@ void Shader::mapActiveUniforms()
u.bufferMemberCount = reflectionit->second.memberCount;
u.access = reflectionit->second.access;
}
else
{
// No reflection info - maybe glslang was better at detecting
// dead code than the driver's compiler?
continue;
}
// Make sure previously set uniform data is preserved, and shader-
// initialized values are retrieved.
@@ -393,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];
@@ -1074,6 +1090,9 @@ Shader::MatrixSize Shader::getMatrixSize(GLenum type) const
m.columns = 4;
m.rows = 3;
break;
default:
m.columns = m.rows = 0;
break;
}
return m;