Add var shader helper;

Now you can write var(0) instead of layout(set = 2, binding = 0).
The advantage is less typing and resilience in the event that the
default set changes.
The disadvantage is that now you can't use var.
This commit is contained in:
bjorn 2022-09-22 20:44:06 -07:00
parent 2e0b5a4efa
commit ef407fd564
1 changed files with 5 additions and 0 deletions

View File

@ -155,6 +155,11 @@ layout(location = 14) in vec3 Tangent;
// Helpers
#define Constants layout(push_constant) uniform PushConstants
#ifdef GL_COMPUTE_SHADER
#define var(x) layout(set = 0, binding = x)
#else
#define var(x) layout(set = 2, binding = x)
#endif
// Helper for sampling textures using the default sampler set using Pass:setSampler
#ifndef GL_COMPUTE_SHADER