Fix build/fill UBO padding on Windows (#1649)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
mwilsnd
2023-09-19 18:51:18 -04:00
committed by GitHub
parent 5252f349d1
commit c6737e8df1
8 changed files with 17 additions and 2 deletions

View File

@@ -2,10 +2,12 @@
#include <mbgl/util/string_indexer.hpp>
#include <algorithm>
#include <functional>
#include <string>
#include <memory>
#include <unordered_map>
#include <functional>
namespace mbgl {
namespace gfx {

View File

@@ -43,6 +43,7 @@ static_assert(sizeof(FillPermutationUBO) == 2 * 16);
struct alignas(16) FillOutlineDrawableUBO {
/* 0 */ std::array<float, 4 * 4> matrix; // composite model-view-projection matrix
/* 64 */ std::array<float, 2> world;
/* 72 */ float pad1, pad2;
/* 80 */
};
static_assert(sizeof(FillOutlineDrawableUBO) == 5 * 16);

View File

@@ -11,6 +11,8 @@ struct ShaderSource<BuiltIn::FillOutlineShader, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(layout (std140) uniform FillOutlineDrawableUBO {
highp mat4 u_matrix;
highp vec2 u_world;
highp float pad1;
highp float pad2;
};
layout (std140) uniform FillOutlineEvaluatedPropsUBO {
highp vec4 u_outline_color;

View File

@@ -14,6 +14,8 @@ struct ShaderSource<BuiltIn::FillPatternShader, gfx::Backend::Type::OpenGL> {
highp vec2 u_pixel_coord_upper;
highp vec2 u_pixel_coord_lower;
highp vec2 u_texsize;
highp float pad1;
highp float pad2;
};
layout (std140) uniform FillPatternEvaluatedPropsUBO {
highp float u_opacity;
@@ -91,6 +93,8 @@ mediump vec4 pattern_to = u_pattern_to;
highp vec2 u_pixel_coord_upper;
highp vec2 u_pixel_coord_lower;
highp vec2 u_texsize;
highp float pad1;
highp float pad2;
};
layout (std140) uniform FillPatternEvaluatedPropsUBO {
highp float u_opacity;

View File

@@ -139,6 +139,7 @@ struct FragmentStage {
struct alignas(16) FillOutlineDrawableUBO {
float4x4 matrix;
float2 world;
float2 pad1;
};
struct alignas(16) FillOutlineEvaluatedPropsUBO {

View File

@@ -4,6 +4,8 @@ layout (std140) uniform FillPatternDrawableUBO {
highp vec2 u_pixel_coord_upper;
highp vec2 u_pixel_coord_lower;
highp vec2 u_texsize;
highp float pad1;
highp float pad2;
};
layout (std140) uniform FillPatternEvaluatedPropsUBO {
highp float u_opacity;

View File

@@ -4,6 +4,8 @@ layout (std140) uniform FillPatternDrawableUBO {
highp vec2 u_pixel_coord_upper;
highp vec2 u_pixel_coord_lower;
highp vec2 u_texsize;
highp float pad1;
highp float pad2;
};
layout (std140) uniform FillPatternEvaluatedPropsUBO {
highp float u_opacity;

View File

@@ -309,7 +309,8 @@ void FillLayerTweaker::execute(LayerGroupBase& layerGroup,
const FillOutlineDrawableUBO drawableUBO = {
/*.matrix=*/util::cast<float>(matrix),
/*.world=*/{(float)renderableSize.width, (float)renderableSize.height},
};
/* pad1 */ 0,
/* pad2 */ 0};
uniforms.createOrUpdate(idFillOutlineDrawableUBOName, &drawableUBO, context);