Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Shader Bindings

Shaders have bound resources. Normally they would have to be bound with an index in glsl and on the c++ side.

I have created a system which is centered around /Engine/include/Renderer/ShaderBindingsDef.hpp and /Engine/include/Renderer/GpuDataLayouts.hpp. When you try to bind from a shader you first need to include the generated bindings file. The filename is

Example

On the c++ side of the code this is how an enum is defined.

#define SHADER_BINDING_ENUM_NAME( X ) \
X(ENUM_A, 0) \
X(ENUM_B, 1)
namespace ShaderNamespace
{
enum Binding : uint32_t
{
SHADER_BINDING_ENUM_NAME(BINDING_ENUM_ENTRY)
};
}
#define BINDING_ENUM_ENTRY(name, value)

This is how the defines are used in shaders

#extension GL_GOOGLE_include_directive : require
#include "shader_bindings.glsl.h"
// Bindings are always prefixed by BINDING_
layout(std430, set = 0, binding = BINDING_ENUM_A) readonly buffer BufferA {
uint value_A;
};
layout(std430, set = 0, binding = BINDING_ENUM_B) readonly buffer BufferB {
uint value_B;
};