Symbol UBOs fixes (#2331)
This commit is contained in:
@@ -152,15 +152,6 @@ lowp float opacity = u_opacity;
|
|||||||
)";
|
)";
|
||||||
static constexpr const char* fragment = R"(uniform sampler2D u_texture;
|
static constexpr const char* fragment = R"(uniform sampler2D u_texture;
|
||||||
|
|
||||||
layout (std140) uniform SymbolInterpolateUBO {
|
|
||||||
highp float u_fill_color_t;
|
|
||||||
highp float u_halo_color_t;
|
|
||||||
highp float u_opacity_t;
|
|
||||||
highp float u_halo_width_t;
|
|
||||||
highp float u_halo_blur_t;
|
|
||||||
highp float interp_pad1, interp_pad2,interp_pad3;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (std140) uniform SymbolTilePropsUBO {
|
layout (std140) uniform SymbolTilePropsUBO {
|
||||||
bool u_is_text;
|
bool u_is_text;
|
||||||
bool u_is_halo;
|
bool u_is_halo;
|
||||||
|
|||||||
@@ -233,15 +233,6 @@ layout (std140) uniform SymbolTilePropsUBO {
|
|||||||
bool tileprops_pad1;
|
bool tileprops_pad1;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (std140) uniform SymbolInterpolateUBO {
|
|
||||||
highp float u_fill_color_t;
|
|
||||||
highp float u_halo_color_t;
|
|
||||||
highp float u_opacity_t;
|
|
||||||
highp float u_halo_width_t;
|
|
||||||
highp float u_halo_blur_t;
|
|
||||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||||
highp vec4 u_text_fill_color;
|
highp vec4 u_text_fill_color;
|
||||||
highp vec4 u_text_halo_color;
|
highp vec4 u_text_halo_color;
|
||||||
|
|||||||
@@ -236,15 +236,6 @@ layout (std140) uniform SymbolTilePropsUBO {
|
|||||||
bool tileprops_pad1;
|
bool tileprops_pad1;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (std140) uniform SymbolInterpolateUBO {
|
|
||||||
highp float u_fill_color_t;
|
|
||||||
highp float u_halo_color_t;
|
|
||||||
highp float u_opacity_t;
|
|
||||||
highp float u_halo_width_t;
|
|
||||||
highp float u_halo_blur_t;
|
|
||||||
highp float interp_pad1, interp_pad2,interp_pad3;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||||
highp vec4 u_text_fill_color;
|
highp vec4 u_text_fill_color;
|
||||||
highp vec4 u_text_halo_color;
|
highp vec4 u_text_halo_color;
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
|||||||
device const GlobalPaintParamsUBO& paintParams [[buffer(0)]],
|
device const GlobalPaintParamsUBO& paintParams [[buffer(0)]],
|
||||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||||
device const SymbolInterpolateUBO& interp [[buffer(3)]],
|
device const SymbolInterpolateUBO& interp [[buffer(3)]]) {
|
||||||
device const SymbolEvaluatedPropsUBO& paint [[buffer(4)]]) {
|
|
||||||
|
|
||||||
const float2 a_pos = vertx.pos_offset.xy;
|
const float2 a_pos = vertx.pos_offset.xy;
|
||||||
const float2 a_offset = vertx.pos_offset.zw;
|
const float2 a_offset = vertx.pos_offset.zw;
|
||||||
@@ -123,7 +122,6 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
|||||||
}
|
}
|
||||||
|
|
||||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
|
||||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||||
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]],
|
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]],
|
||||||
texture2d<float, access::sample> image [[texture(0)]],
|
texture2d<float, access::sample> image [[texture(0)]],
|
||||||
|
|||||||
@@ -74,8 +74,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
|||||||
device const GlobalPaintParamsUBO& paintParams [[buffer(0)]],
|
device const GlobalPaintParamsUBO& paintParams [[buffer(0)]],
|
||||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||||
device const SymbolInterpolateUBO& interp [[buffer(3)]],
|
device const SymbolInterpolateUBO& interp [[buffer(3)]]) {
|
||||||
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]]) {
|
|
||||||
|
|
||||||
const float2 a_pos = vertx.pos_offset.xy;
|
const float2 a_pos = vertx.pos_offset.xy;
|
||||||
const float2 a_offset = vertx.pos_offset.zw;
|
const float2 a_offset = vertx.pos_offset.zw;
|
||||||
|
|||||||
@@ -78,8 +78,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
|||||||
device const GlobalPaintParamsUBO& paintParams [[buffer(0)]],
|
device const GlobalPaintParamsUBO& paintParams [[buffer(0)]],
|
||||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||||
device const SymbolInterpolateUBO& interp [[buffer(3)]],
|
device const SymbolInterpolateUBO& interp [[buffer(3)]]) {
|
||||||
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]]) {
|
|
||||||
|
|
||||||
const float2 a_pos = vertx.pos_offset.xy;
|
const float2 a_pos = vertx.pos_offset.xy;
|
||||||
const float2 a_offset = vertx.pos_offset.zw;
|
const float2 a_offset = vertx.pos_offset.zw;
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
|
|
||||||
layout (std140) uniform SymbolInterpolateUBO {
|
|
||||||
highp float u_fill_color_t;
|
|
||||||
highp float u_halo_color_t;
|
|
||||||
highp float u_opacity_t;
|
|
||||||
highp float u_halo_width_t;
|
|
||||||
highp float u_halo_blur_t;
|
|
||||||
highp float interp_pad1, interp_pad2,interp_pad3;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (std140) uniform SymbolTilePropsUBO {
|
layout (std140) uniform SymbolTilePropsUBO {
|
||||||
bool u_is_text;
|
bool u_is_text;
|
||||||
bool u_is_halo;
|
bool u_is_halo;
|
||||||
|
|||||||
@@ -24,15 +24,6 @@ layout (std140) uniform SymbolTilePropsUBO {
|
|||||||
bool tileprops_pad1;
|
bool tileprops_pad1;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (std140) uniform SymbolInterpolateUBO {
|
|
||||||
highp float u_fill_color_t;
|
|
||||||
highp float u_halo_color_t;
|
|
||||||
highp float u_opacity_t;
|
|
||||||
highp float u_halo_width_t;
|
|
||||||
highp float u_halo_blur_t;
|
|
||||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||||
highp vec4 u_text_fill_color;
|
highp vec4 u_text_fill_color;
|
||||||
highp vec4 u_text_halo_color;
|
highp vec4 u_text_halo_color;
|
||||||
|
|||||||
@@ -27,15 +27,6 @@ layout (std140) uniform SymbolTilePropsUBO {
|
|||||||
bool tileprops_pad1;
|
bool tileprops_pad1;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout (std140) uniform SymbolInterpolateUBO {
|
|
||||||
highp float u_fill_color_t;
|
|
||||||
highp float u_halo_color_t;
|
|
||||||
highp float u_opacity_t;
|
|
||||||
highp float u_halo_width_t;
|
|
||||||
highp float u_halo_blur_t;
|
|
||||||
highp float interp_pad1, interp_pad2,interp_pad3;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||||
highp vec4 u_text_fill_color;
|
highp vec4 u_text_fill_color;
|
||||||
highp vec4 u_text_halo_color;
|
highp vec4 u_text_halo_color;
|
||||||
|
|||||||
@@ -1079,8 +1079,8 @@ void RenderSymbolLayer::update(gfx::ShaderRegistry& shaders,
|
|||||||
auto addCollisionDrawables = [&](const bool isText, const bool hasCollisionBox, const bool hasCollisionCircle) {
|
auto addCollisionDrawables = [&](const bool isText, const bool hasCollisionBox, const bool hasCollisionCircle) {
|
||||||
if (!hasCollisionBox && !hasCollisionCircle) return;
|
if (!hasCollisionBox && !hasCollisionCircle) return;
|
||||||
|
|
||||||
const auto& group = getCollisionTileLayerGroup();
|
const auto& collisionGroup = getCollisionTileLayerGroup();
|
||||||
if (!group) {
|
if (!collisionGroup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1132,7 +1132,7 @@ void RenderSymbolLayer::update(gfx::ShaderRegistry& shaders,
|
|||||||
|
|
||||||
auto drawData = std::make_unique<gfx::CollisionDrawableData>(values.translate, values.translateAnchor);
|
auto drawData = std::make_unique<gfx::CollisionDrawableData>(values.translate, values.translateAnchor);
|
||||||
drawable->setData(std::move(drawData));
|
drawable->setData(std::move(drawData));
|
||||||
group->addDrawable(passes, tileID, std::move(drawable));
|
collisionGroup->addDrawable(passes, tileID, std::move(drawable));
|
||||||
++stats.drawablesAdded;
|
++stats.drawablesAdded;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ namespace shaders {
|
|||||||
|
|
||||||
const std::array<UniformBlockInfo, 5> ShaderSource<BuiltIn::SymbolIconShader, gfx::Backend::Type::Metal>::uniforms = {
|
const std::array<UniformBlockInfo, 5> ShaderSource<BuiltIn::SymbolIconShader, gfx::Backend::Type::Metal>::uniforms = {
|
||||||
UniformBlockInfo{true, false, sizeof(GlobalPaintParamsUBO), idGlobalPaintParamsUBO},
|
UniformBlockInfo{true, false, sizeof(GlobalPaintParamsUBO), idGlobalPaintParamsUBO},
|
||||||
UniformBlockInfo{true, true, sizeof(SymbolDrawableUBO), idSymbolDrawableUBO},
|
UniformBlockInfo{true, false, sizeof(SymbolDrawableUBO), idSymbolDrawableUBO},
|
||||||
UniformBlockInfo{true, true, sizeof(SymbolTilePropsUBO), idSymbolTilePropsUBO},
|
UniformBlockInfo{true, true, sizeof(SymbolTilePropsUBO), idSymbolTilePropsUBO},
|
||||||
UniformBlockInfo{true, false, sizeof(SymbolInterpolateUBO), idSymbolInterpolateUBO},
|
UniformBlockInfo{true, false, sizeof(SymbolInterpolateUBO), idSymbolInterpolateUBO},
|
||||||
UniformBlockInfo{true, true, sizeof(SymbolEvaluatedPropsUBO), idSymbolEvaluatedPropsUBO},
|
UniformBlockInfo{false, true, sizeof(SymbolEvaluatedPropsUBO), idSymbolEvaluatedPropsUBO},
|
||||||
};
|
};
|
||||||
const std::array<AttributeInfo, 6> ShaderSource<BuiltIn::SymbolIconShader, gfx::Backend::Type::Metal>::attributes = {
|
const std::array<AttributeInfo, 6> ShaderSource<BuiltIn::SymbolIconShader, gfx::Backend::Type::Metal>::attributes = {
|
||||||
// always attributes
|
// always attributes
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const std::array<UniformBlockInfo, 5> ShaderSource<BuiltIn::SymbolSDFIconShader,
|
|||||||
UniformBlockInfo{true, true, sizeof(SymbolDrawableUBO), idSymbolDrawableUBO},
|
UniformBlockInfo{true, true, sizeof(SymbolDrawableUBO), idSymbolDrawableUBO},
|
||||||
UniformBlockInfo{true, true, sizeof(SymbolTilePropsUBO), idSymbolTilePropsUBO},
|
UniformBlockInfo{true, true, sizeof(SymbolTilePropsUBO), idSymbolTilePropsUBO},
|
||||||
UniformBlockInfo{true, false, sizeof(SymbolInterpolateUBO), idSymbolInterpolateUBO},
|
UniformBlockInfo{true, false, sizeof(SymbolInterpolateUBO), idSymbolInterpolateUBO},
|
||||||
UniformBlockInfo{true, true, sizeof(SymbolEvaluatedPropsUBO), idSymbolEvaluatedPropsUBO},
|
UniformBlockInfo{false, true, sizeof(SymbolEvaluatedPropsUBO), idSymbolEvaluatedPropsUBO},
|
||||||
};
|
};
|
||||||
const std::array<AttributeInfo, 10> ShaderSource<BuiltIn::SymbolSDFIconShader, gfx::Backend::Type::Metal>::attributes =
|
const std::array<AttributeInfo, 10> ShaderSource<BuiltIn::SymbolSDFIconShader, gfx::Backend::Type::Metal>::attributes =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const std::array<UniformBlockInfo, 5>
|
|||||||
UniformBlockInfo{true, true, sizeof(SymbolDrawableUBO), idSymbolDrawableUBO},
|
UniformBlockInfo{true, true, sizeof(SymbolDrawableUBO), idSymbolDrawableUBO},
|
||||||
UniformBlockInfo{true, true, sizeof(SymbolTilePropsUBO), idSymbolTilePropsUBO},
|
UniformBlockInfo{true, true, sizeof(SymbolTilePropsUBO), idSymbolTilePropsUBO},
|
||||||
UniformBlockInfo{true, false, sizeof(SymbolInterpolateUBO), idSymbolInterpolateUBO},
|
UniformBlockInfo{true, false, sizeof(SymbolInterpolateUBO), idSymbolInterpolateUBO},
|
||||||
UniformBlockInfo{true, true, sizeof(SymbolEvaluatedPropsUBO), idSymbolEvaluatedPropsUBO},
|
UniformBlockInfo{false, true, sizeof(SymbolEvaluatedPropsUBO), idSymbolEvaluatedPropsUBO},
|
||||||
};
|
};
|
||||||
const std::array<AttributeInfo, 9>
|
const std::array<AttributeInfo, 9>
|
||||||
ShaderSource<BuiltIn::SymbolTextAndIconShader, gfx::Backend::Type::Metal>::attributes = {
|
ShaderSource<BuiltIn::SymbolTextAndIconShader, gfx::Backend::Type::Metal>::attributes = {
|
||||||
|
|||||||
Reference in New Issue
Block a user