aboutsummaryrefslogtreecommitdiff
path: root/source/Shader.cpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-04-13 22:40:41 -0700
committerrtk0c <[email protected]>2022-04-13 22:40:41 -0700
commitf2a1481123ac23aeb4937df5f61c57e0e4f1ff52 (patch)
tree4b83677d43e0eb552d9aa708339ef4ee7f893aaa /source/Shader.cpp
parent17d5b091c9b2901ac96f5eee0da6af07228ae690 (diff)
Changeset: 6 Remove uniform block support
Diffstat (limited to 'source/Shader.cpp')
-rw-r--r--source/Shader.cpp50
1 files changed, 0 insertions, 50 deletions
diff --git a/source/Shader.cpp b/source/Shader.cpp
index abb68bd..3ff0d10 100644
--- a/source/Shader.cpp
+++ b/source/Shader.cpp
@@ -544,56 +544,6 @@ bool Shader::GatherInfoIfAbsent() {
mInfo->uniforms.push_back(CreateVariable(type, loc));
}
- // Gather uniform blocks
- for (int i = 0; i < uniformBlockCount; ++i) {
- const GLenum blockQuery[] = { GL_NAME_LENGTH, GL_NUM_ACTIVE_VARIABLES };
- GLint blockProps[std::size(blockQuery)];
- glGetProgramResourceiv(mHandle, GL_UNIFORM_BLOCK, i, std::size(blockQuery), blockQuery, std::size(blockProps), nullptr, blockProps);
- auto& nameLength = blockProps[0];
- auto& fieldCount = blockProps[1];
-
- // glGetProgramResourceiv returns the length including the null terminator
- std::string blockName(nameLength - 1, '\0');
- glGetProgramResourceName(mHandle, GL_UNIFORM_BLOCK, i, nameLength, nullptr, blockName.data());
-
- const GLenum fieldsQuery[] = { GL_ACTIVE_VARIABLES };
- std::vector<GLint> fieldIndices(fieldCount);
- glGetProgramResourceiv(mHandle, GL_UNIFORM_BLOCK, i, std::size(fieldsQuery), fieldsQuery, fieldIndices.size(), nullptr, fieldIndices.data());
-
- ShaderUniformBlockVariable block;
- block.index = i;
- block.name = std::move(blockName);
- // NOTE: blockName is invalid from this point on
-
- for (GLint idx : fieldIndices) {
- const GLenum fieldQuery[] = { GL_NAME_LENGTH, GL_TYPE, GL_LOCATION, GL_TOP_LEVEL_ARRAY_SIZE };
- GLint fieldProps[std::size(fieldQuery)];
- glGetProgramResourceiv(mHandle, GL_UNIFORM, idx, std::size(fieldQuery), fieldQuery, std::size(fieldProps), nullptr, fieldProps);
- auto& nameLength = fieldProps[0];
- auto& type = fieldProps[1];
- auto& location = fieldProps[2];
- auto& arrayLength = fieldProps[3];
-
- std::string fieldName(nameLength - 1, '\0');
- glGetProgramResourceName(mHandle, GL_UNIFORM, idx, nameLength, nullptr, fieldName.data());
-
- auto var = CreateVariable(type, location);
- if (var->kind == ShaderVariable::KD_Math) {
- auto math = static_cast<ShaderMathVariable*>(var.get());
- math->name = std::move(fieldName);
- math->arrayLength = arrayLength;
- } else if (var->kind == ShaderMathVariable::KD_Sampler) {
- auto sampler = static_cast<ShaderSamplerVariable*>(var.get());
- sampler->name = std::move(fieldName);
- sampler->arrayLength = arrayLength;
- }
- block.items.push_back(std::move(var));
- }
-
- mInfo->things.insert(block.name, { ShaderInfo::TKD_UniformBlock, i });
- mInfo->uniformBlocks.push_back(std::move(block));
- }
-
mInfo->things.shrink_to_fit();
#endif