aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/Shader.cpp50
-rw-r--r--source/Shader.hpp13
2 files changed, 0 insertions, 63 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
diff --git a/source/Shader.hpp b/source/Shader.hpp
index 8af5217..cda5531 100644
--- a/source/Shader.hpp
+++ b/source/Shader.hpp
@@ -17,7 +17,6 @@ struct ShaderVariable {
enum Kind {
KD_Math,
KD_Sampler,
- KD_UniformBlock,
};
Kind kind;
@@ -49,16 +48,6 @@ struct ShaderSamplerVariable : public ShaderVariable {
: ShaderVariable(KD_Sampler) {}
};
-struct ShaderUniformBlockVariable : public ShaderVariable {
- std::string name;
- /// Possible values: KD_Math
- std::vector<std::unique_ptr<ShaderVariable>> items;
- GLuint index;
-
- ShaderUniformBlockVariable()
- : ShaderVariable(KD_UniformBlock) {}
-};
-
struct ShaderInfo {
enum ThingKind {
TKD_Input,
@@ -80,9 +69,7 @@ struct ShaderInfo {
absl::flat_hash_map<std::string, ThingId> things;
std::vector<InputOutputThing> inputs;
std::vector<InputOutputThing> outputs;
- /// Possible values: KD_Math, KD_Sampler
std::vector<std::unique_ptr<ShaderVariable>> uniforms;
- std::vector<ShaderUniformBlockVariable> uniformBlocks;
bool SaveToFile(const std::filesystem::path& filePath) const;
bool LoadFromFile(const std::filesystem::path& filePath);