UBO consolidation (#3089)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -6,24 +6,32 @@
|
||||
namespace mbgl {
|
||||
namespace shaders {
|
||||
|
||||
#define DEBUG_SHADER_PRELUDE \
|
||||
R"(
|
||||
|
||||
#define idDebugUBO drawableReservedUBOCount
|
||||
|
||||
)"
|
||||
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::DebugShader, gfx::Backend::Type::Vulkan> {
|
||||
static constexpr const char* name = "DebugShader";
|
||||
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<AttributeInfo, 1> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto vertex = R"(
|
||||
static constexpr auto vertex = DEBUG_SHADER_PRELUDE R"(
|
||||
|
||||
layout(location = 0) in ivec2 in_position;
|
||||
|
||||
layout(set = DRAWABLE_UBO_SET_INDEX, binding = 0) uniform DebugUBO {
|
||||
layout(set = DRAWABLE_UBO_SET_INDEX, binding = idDebugUBO) uniform DebugUBO {
|
||||
mat4 matrix;
|
||||
vec4 color;
|
||||
float overlay_scale;
|
||||
float pad1, pad2, pad3;
|
||||
float pad1;
|
||||
float pad2;
|
||||
float pad3;
|
||||
} debug;
|
||||
|
||||
layout(location = 0) out vec2 frag_uv;
|
||||
@@ -39,15 +47,17 @@ void main() {
|
||||
}
|
||||
)";
|
||||
|
||||
static constexpr auto fragment = R"(
|
||||
static constexpr auto fragment = DEBUG_SHADER_PRELUDE R"(
|
||||
layout(location = 0) in vec2 frag_uv;
|
||||
layout(location = 0) out vec4 out_color;
|
||||
|
||||
layout(set = DRAWABLE_UBO_SET_INDEX, binding = 0) uniform DebugUBO {
|
||||
layout(set = DRAWABLE_UBO_SET_INDEX, binding = idDebugUBO) uniform DebugUBO {
|
||||
mat4 matrix;
|
||||
vec4 color;
|
||||
float overlay_scale;
|
||||
float pad1, pad2, pad3;
|
||||
float pad1;
|
||||
float pad2;
|
||||
float pad3;
|
||||
} debug;
|
||||
|
||||
layout(set = DRAWABLE_IMAGE_SET_INDEX, binding = 0) uniform sampler2D image_sampler;
|
||||
|
||||
Reference in New Issue
Block a user