Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
136 lines
3.4 KiB
C++
136 lines
3.4 KiB
C++
#pragma once
|
|
|
|
#include <mbgl/shaders/layer_ubo.hpp>
|
|
|
|
namespace mbgl {
|
|
namespace shaders {
|
|
|
|
//
|
|
// Fill
|
|
|
|
struct alignas(16) FillDrawableUBO {
|
|
/* 0 */ std::array<float, 4 * 4> matrix;
|
|
|
|
// Interpolations
|
|
/* 64 */ float color_t;
|
|
/* 68 */ float opacity_t;
|
|
/* 72 */ float pad1;
|
|
/* 76 */ float pad2;
|
|
/* 80 */
|
|
};
|
|
static_assert(sizeof(FillDrawableUBO) == 5 * 16);
|
|
|
|
//
|
|
// Fill outline
|
|
|
|
struct alignas(16) FillOutlineDrawableUBO {
|
|
/* 0 */ std::array<float, 4 * 4> matrix;
|
|
|
|
// Interpolations
|
|
/* 64 */ float outline_color_t;
|
|
/* 68 */ float opacity_t;
|
|
/* 72 */ float pad1;
|
|
/* 76 */ float pad2;
|
|
/* 80 */
|
|
};
|
|
static_assert(sizeof(FillOutlineDrawableUBO) == 5 * 16);
|
|
|
|
//
|
|
// Fill pattern
|
|
|
|
struct alignas(16) FillPatternDrawableUBO {
|
|
/* 0 */ std::array<float, 4 * 4> matrix;
|
|
/* 64 */ std::array<float, 2> pixel_coord_upper;
|
|
/* 72 */ std::array<float, 2> pixel_coord_lower;
|
|
/* 80 */ float tile_ratio;
|
|
|
|
// Interpolations
|
|
/* 84 */ float pattern_from_t;
|
|
/* 88 */ float pattern_to_t;
|
|
/* 92 */ float opacity_t;
|
|
/* 96 */
|
|
};
|
|
static_assert(sizeof(FillPatternDrawableUBO) == 6 * 16);
|
|
|
|
struct alignas(16) FillPatternTilePropsUBO {
|
|
/* 0 */ std::array<float, 4> pattern_from;
|
|
/* 16 */ std::array<float, 4> pattern_to;
|
|
/* 32 */ std::array<float, 2> texsize;
|
|
/* 40 */ float pad1;
|
|
/* 44 */ float pad2;
|
|
/* 48 */
|
|
};
|
|
static_assert(sizeof(FillPatternTilePropsUBO) == 3 * 16);
|
|
|
|
//
|
|
// Fill pattern outline
|
|
|
|
struct alignas(16) FillOutlinePatternDrawableUBO {
|
|
/* 0 */ std::array<float, 4 * 4> matrix;
|
|
/* 64 */ std::array<float, 2> pixel_coord_upper;
|
|
/* 72 */ std::array<float, 2> pixel_coord_lower;
|
|
/* 80 */ float tile_ratio;
|
|
|
|
// Interpolations
|
|
/* 84 */ float pattern_from_t;
|
|
/* 88 */ float pattern_to_t;
|
|
/* 92 */ float opacity_t;
|
|
/* 96 */
|
|
};
|
|
static_assert(sizeof(FillOutlinePatternDrawableUBO) == 6 * 16);
|
|
|
|
struct alignas(16) FillOutlinePatternTilePropsUBO {
|
|
/* 0 */ std::array<float, 4> pattern_from;
|
|
/* 16 */ std::array<float, 4> pattern_to;
|
|
/* 32 */ std::array<float, 2> texsize;
|
|
/* 40 */ float pad1;
|
|
/* 44 */ float pad2;
|
|
/* 48 */
|
|
};
|
|
static_assert(sizeof(FillOutlinePatternTilePropsUBO) == 3 * 16);
|
|
|
|
//
|
|
// Fill outline triangulated
|
|
|
|
struct alignas(16) FillOutlineTriangulatedDrawableUBO {
|
|
/* 0 */ std::array<float, 4 * 4> matrix;
|
|
/* 64 */ float ratio;
|
|
/* 68 */ float pad1;
|
|
/* 72 */ float pad2;
|
|
/* 76 */ float pad3;
|
|
/* 80 */
|
|
};
|
|
static_assert(sizeof(FillOutlineTriangulatedDrawableUBO) == 5 * 16);
|
|
|
|
/// Evaluated properties that do not depend on the tile
|
|
struct alignas(16) FillEvaluatedPropsUBO {
|
|
/* 0 */ Color color;
|
|
/* 16 */ Color outline_color;
|
|
/* 32 */ float opacity;
|
|
/* 36 */ float fade;
|
|
/* 40 */ float from_scale;
|
|
/* 44 */ float to_scale;
|
|
/* 48 */
|
|
};
|
|
static_assert(sizeof(FillEvaluatedPropsUBO) == 3 * 16);
|
|
|
|
#if MLN_UBO_CONSOLIDATION
|
|
|
|
union FillDrawableUnionUBO {
|
|
FillDrawableUBO fillDrawableUBO;
|
|
FillOutlineDrawableUBO fillOutlineDrawableUBO;
|
|
FillPatternDrawableUBO fillPatternDrawableUBO;
|
|
FillOutlinePatternDrawableUBO fillOutlinePatternDrawableUBO;
|
|
FillOutlineTriangulatedDrawableUBO fillOutlineTriangulatedDrawableUBO;
|
|
};
|
|
|
|
union FillTilePropsUnionUBO {
|
|
FillPatternTilePropsUBO fillPatternTilePropsUBO;
|
|
FillOutlinePatternTilePropsUBO fillOutlinePatternTilePropsUBO;
|
|
};
|
|
|
|
#endif
|
|
|
|
} // namespace shaders
|
|
} // namespace mbgl
|