Files
MapLibreParticleLab/include/mbgl/shaders/gl/drawable_fill.hpp
Alex Cristici f582327191 UBO consolidation (#3089)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-08 17:41:29 +02:00

90 lines
1.9 KiB
C++

// Generated code, do not modify this file!
#pragma once
#include <mbgl/shaders/shader_source.hpp>
namespace mbgl {
namespace shaders {
template <>
struct ShaderSource<BuiltIn::FillShader, gfx::Backend::Type::OpenGL> {
static constexpr const char* name = "FillShader";
static constexpr const char* vertex = R"(layout (std140) uniform FillDrawableUBO {
highp mat4 u_matrix;
// Interpolations
highp float u_color_t;
highp float u_opacity_t;
lowp float drawable_pad1;
lowp float drawable_pad2;
};
layout (std140) uniform FillEvaluatedPropsUBO {
highp vec4 u_color;
highp vec4 u_outline_color;
highp float u_opacity;
highp float u_fade;
highp float u_from_scale;
highp float u_to_scale;
};
layout (location = 0) in vec2 a_pos;
#ifndef HAS_UNIFORM_u_color
layout (location = 1) in highp vec4 a_color;
out highp vec4 color;
#endif
#ifndef HAS_UNIFORM_u_opacity
layout (location = 2) in lowp vec2 a_opacity;
out lowp float opacity;
#endif
void main() {
#ifndef HAS_UNIFORM_u_color
color = unpack_mix_color(a_color, u_color_t);
#else
highp vec4 color = u_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
opacity = unpack_mix_vec2(a_opacity, u_opacity_t);
#else
lowp float opacity = u_opacity;
#endif
gl_Position = u_matrix * vec4(a_pos, 0, 1);
}
)";
static constexpr const char* fragment = R"(layout (std140) uniform FillEvaluatedPropsUBO {
highp vec4 u_color;
highp vec4 u_outline_color;
highp float u_opacity;
highp float u_fade;
highp float u_from_scale;
highp float u_to_scale;
};
#ifndef HAS_UNIFORM_u_color
in highp vec4 color;
#endif
#ifndef HAS_UNIFORM_u_opacity
in lowp float opacity;
#endif
void main() {
#ifdef HAS_UNIFORM_u_color
highp vec4 color = u_color;
#endif
#ifdef HAS_UNIFORM_u_opacity
lowp float opacity = u_opacity;
#endif
fragColor = color * opacity;
#ifdef OVERDRAW_INSPECTOR
fragColor = vec4(1.0);
#endif
}
)";
};
} // namespace shaders
} // namespace mbgl