EreliaStudio / SparkleOld

Graphical library for game development
MIT License
4 stars 0 forks source link

Problem with uniform block buffer. #196

Closed NotCampeur closed 1 year ago

NotCampeur commented 1 year ago

Output:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Uniform block can't have a blank name

Vertex shader:

#version 450 core
layout(location = 0) in vec2 model_space;

void main()
{
    gl_Position = vec4(model_space, 0.0f, 1.0f);
}

Fragment shader:

#version 450 core

layout(location = 0) out vec4 color;

void main()
{
    color = vec4(1.0, 0.0, 0.0, 1.0);
}

It should work when no uniform nor push_constant has been declared

EreliaStudio commented 1 year ago

It's strictly a problem due to how we parse the push constants. Currently, the code EXPECT a push constant, and if none is found, will still try to contact it with a name "", who will result in the error described earlier. We need to check if there is no push constant, if so, we can just skip it's pushing.

Or, if we choose it, we can simply say that no, we refuse to accept shader without a push constant, empty if needed