Revise background layer UBO size & padding (#1136)
This commit is contained in:
@@ -146,6 +146,7 @@ private:
|
||||
struct alignas(16) DrawableUBO {
|
||||
std::array<float, 4 * 4> matrix;
|
||||
};
|
||||
static_assert(sizeof(DrawableUBO) % 16 == 0);
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
@@ -21,11 +21,11 @@ void main() {
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform BackgroundLayerUBO {
|
||||
vec4 u_color;
|
||||
float u_opacity;
|
||||
vec4 u_opacity_pad3;
|
||||
};
|
||||
|
||||
void main() {
|
||||
fragColor = u_color * u_opacity;
|
||||
fragColor = u_color * u_opacity_pad3.x;
|
||||
#ifdef OVERDRAW_INSPECTOR
|
||||
fragColor = vec4(1.0);
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-11T18:11:44.911Z by mwilsnd using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-12T17:51:34.322Z by mwilsnd using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/gfx/backend.hpp>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
layout (std140) uniform BackgroundLayerUBO {
|
||||
vec4 u_color;
|
||||
float u_opacity;
|
||||
vec4 u_opacity_pad3;
|
||||
};
|
||||
|
||||
void main() {
|
||||
fragColor = u_color * u_opacity;
|
||||
fragColor = u_color * u_opacity_pad3.x;
|
||||
#ifdef OVERDRAW_INSPECTOR
|
||||
fragColor = vec4(1.0);
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,9 @@ private:
|
||||
struct alignas(16) BackgroundLayerUBO {
|
||||
Color color;
|
||||
float opacity;
|
||||
float padding[3];
|
||||
};
|
||||
static_assert(sizeof(BackgroundLayerUBO) % 16 == 0);
|
||||
|
||||
struct alignas(16) BackgroundPatternLayerUBO {
|
||||
std::array<float, 2> pattern_tl_a;
|
||||
@@ -71,5 +73,6 @@ struct alignas(16) BackgroundPatternLayerUBO {
|
||||
float mix;
|
||||
float opacity;
|
||||
};
|
||||
static_assert(sizeof(BackgroundPatternLayerUBO) % 16 == 0);
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user