Add attribute buffer index to support multiple attributes interleaved in single buffer bind [Core optimization] (#4241)

Co-authored-by: Adrian Cojocaru <adrian.cojocaru92@yahoo.com>
This commit is contained in:
Alex Cristici
2026-04-28 19:00:37 +03:00
committed by GitHub
parent 29f90974f0
commit 86eff40b65
50 changed files with 388 additions and 310 deletions

View File

@@ -17,13 +17,23 @@ public:
: gfx::VertexAttribute(index_, dataType_, count_) {}
VertexAttribute(const VertexAttribute& other) = delete;
VertexAttribute(VertexAttribute&& other)
: gfx::VertexAttribute(std::move(other)) {}
: gfx::VertexAttribute(std::move(other)),
bufferIndex(other.bufferIndex) {}
~VertexAttribute() override = default;
/// @brief Get the bufer index of the vertex attribute
int getBufferIndex() const { return bufferIndex; }
/// @brief Set the buffer index of the vertex attribute
void setBufferIndex(int value) { bufferIndex = value; }
static const gfx::UniqueVertexBufferResource& getBuffer(gfx::VertexAttribute&,
UploadPass&,
const gfx::BufferUsageType,
bool forceUpdate);
protected:
int bufferIndex = 0;
};
/// Stores a collection of vertex attributes by name
@@ -39,6 +49,11 @@ public:
}
VertexAttributeArray& operator=(const VertexAttributeArray& other) = delete;
const std::unique_ptr<gfx::VertexAttribute>& set(const size_t id,
int index,
gfx::AttributeDataType type,
int bufferIndex);
/// Indicates whether any values have changed
bool isModifiedAfter(std::chrono::duration<double> time) const;

View File

@@ -87,7 +87,7 @@ struct ShaderSource<BuiltIn::BackgroundShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(backgroundUBOCount + 0)]];
short2 position [[attribute(0)]];
};
struct FragmentStage {
@@ -130,7 +130,7 @@ struct ShaderSource<BuiltIn::BackgroundPatternShader, gfx::Backend::Type::Metal>
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(backgroundUBOCount + 0)]];
short2 position [[attribute(0)]];
};
struct FragmentStage {

View File

@@ -66,28 +66,28 @@ struct ShaderSource<BuiltIn::CircleShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(circleUBOCount + 0)]];
short2 position [[attribute(0)]];
#if !defined(HAS_UNIFORM_u_color)
float4 color [[attribute(circleUBOCount + 1)]];
float4 color [[attribute(1)]];
#endif
#if !defined(HAS_UNIFORM_u_radius)
float2 radius [[attribute(circleUBOCount + 2)]];
float2 radius [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_blur)
float2 blur [[attribute(circleUBOCount + 3)]];
float2 blur [[attribute(3)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float2 opacity [[attribute(circleUBOCount + 4)]];
float2 opacity [[attribute(4)]];
#endif
#if !defined(HAS_UNIFORM_u_stroke_color)
float4 stroke_color [[attribute(circleUBOCount + 5)]];
float4 stroke_color [[attribute(5)]];
#endif
#if !defined(HAS_UNIFORM_u_stroke_width)
float2 stroke_width [[attribute(circleUBOCount + 6)]];
float2 stroke_width [[attribute(6)]];
#endif
#if !defined(HAS_UNIFORM_u_stroke_opacity)
float2 stroke_opacity [[attribute(circleUBOCount + 7)]];
float2 stroke_opacity [[attribute(7)]];
#endif
};

View File

@@ -49,7 +49,7 @@ struct ShaderSource<BuiltIn::ClippingMaskProgram, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(clippingMaskUBOCount + 0)]];
short2 position [[attribute(0)]];
};
struct FragmentStage {

View File

@@ -45,11 +45,11 @@ struct ShaderSource<BuiltIn::CollisionBoxShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(collisionUBOCount + 0)]];
short2 anchor_pos [[attribute(collisionUBOCount + 1)]];
short2 extrude [[attribute(collisionUBOCount + 2)]];
ushort2 placed [[attribute(collisionUBOCount + 3)]];
float2 shift [[attribute(collisionUBOCount + 4)]];
short2 pos [[attribute(0)]];
short2 anchor_pos [[attribute(1)]];
short2 extrude [[attribute(2)]];
ushort2 placed [[attribute(3)]];
float2 shift [[attribute(4)]];
};
struct FragmentStage {
@@ -119,10 +119,10 @@ struct ShaderSource<BuiltIn::CollisionCircleShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(collisionUBOCount + 0)]];
short2 anchor_pos [[attribute(collisionUBOCount + 1)]];
short2 extrude [[attribute(collisionUBOCount + 2)]];
ushort2 placed [[attribute(collisionUBOCount + 3)]];
short2 pos [[attribute(0)]];
short2 anchor_pos [[attribute(1)]];
short2 extrude [[attribute(2)]];
ushort2 placed [[attribute(3)]];
};
struct FragmentStage {

View File

@@ -56,8 +56,8 @@ struct ShaderSource<BuiltIn::ColorReliefShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(colorReliefUBOCount + 0)]];
short2 texture_pos [[attribute(colorReliefUBOCount + 1)]];
short2 pos [[attribute(0)]];
short2 texture_pos [[attribute(1)]];
};
struct FragmentStage {

View File

@@ -37,8 +37,8 @@ struct ShaderSource<BuiltIn::CustomGeometryShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
float3 position [[attribute(customGeometryUBOCount + 0)]];
float2 uv [[attribute(customGeometryUBOCount + 1)]];
float3 position [[attribute(0)]];
float2 uv [[attribute(1)]];
};
struct FragmentStage {

View File

@@ -46,8 +46,8 @@ struct ShaderSource<BuiltIn::CustomSymbolIconShader, gfx::Backend::Type::Metal>
static constexpr auto source = R"(
struct VertexStage {
float2 a_pos [[attribute(customSymbolUBOCount + 0)]];
float2 a_tex [[attribute(customSymbolUBOCount + 1)]];
float2 a_pos [[attribute(0)]];
float2 a_tex [[attribute(1)]];
};
struct FragmentStage {

View File

@@ -41,7 +41,7 @@ struct ShaderSource<BuiltIn::DebugShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(debugUBOCount + 0)]];
short2 pos [[attribute(0)]];
};
struct FragmentStage {

View File

@@ -154,13 +154,13 @@ struct ShaderSource<BuiltIn::FillShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(fillUBOCount + 0)]];
short2 position [[attribute(0)]];
#if !defined(HAS_UNIFORM_u_color)
float4 color [[attribute(fillUBOCount + 1)]];
float4 color [[attribute(1)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float2 opacity [[attribute(fillUBOCount + 2)]];
float2 opacity [[attribute(2)]];
#endif
};
@@ -229,9 +229,9 @@ struct ShaderSource<BuiltIn::FillOutlineShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(fillUBOCount + 0)]];
float4 outline_color [[attribute(fillUBOCount + 1)]];
float2 opacity [[attribute(fillUBOCount + 2)]];
short2 position [[attribute(0)]];
float4 outline_color [[attribute(1)]];
float2 opacity [[attribute(2)]];
};
struct FragmentStage {
@@ -308,16 +308,16 @@ struct ShaderSource<BuiltIn::FillPatternShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(fillUBOCount + 0)]];
short2 position [[attribute(0)]];
#if !defined(HAS_UNIFORM_u_pattern_from)
ushort4 pattern_from [[attribute(fillUBOCount + 1)]];
ushort4 pattern_from [[attribute(1)]];
#endif
#if !defined(HAS_UNIFORM_u_pattern_to)
ushort4 pattern_to [[attribute(fillUBOCount + 2)]];
ushort4 pattern_to [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float2 opacity [[attribute(fillUBOCount + 3)]];
float2 opacity [[attribute(3)]];
#endif
};
@@ -451,16 +451,16 @@ struct ShaderSource<BuiltIn::FillOutlinePatternShader, gfx::Backend::Type::Metal
static constexpr auto source = R"(
struct VertexStage {
short2 position [[attribute(fillUBOCount + 0)]];
short2 position [[attribute(0)]];
#if !defined(HAS_UNIFORM_u_pattern_from)
ushort4 pattern_from [[attribute(fillUBOCount + 1)]];
ushort4 pattern_from [[attribute(1)]];
#endif
#if !defined(HAS_UNIFORM_u_pattern_to)
ushort4 pattern_to [[attribute(fillUBOCount + 2)]];
ushort4 pattern_to [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float2 opacity [[attribute(fillUBOCount + 3)]];
float2 opacity [[attribute(3)]];
#endif
};
@@ -606,8 +606,8 @@ struct ShaderSource<BuiltIn::FillOutlineTriangulatedShader, gfx::Backend::Type::
static constexpr auto source = R"(
struct VertexStage {
short2 pos_normal [[attribute(fillUBOCount + 0)]];
uchar4 data [[attribute(fillUBOCount + 1)]];
short2 pos_normal [[attribute(0)]];
uchar4 data [[attribute(1)]];
};
struct FragmentStage {

View File

@@ -77,17 +77,17 @@ struct ShaderSource<BuiltIn::FillExtrusionShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(fillExtrusionUBOCount + 0)]];
short4 normal_ed [[attribute(fillExtrusionUBOCount + 1)]];
short2 pos [[attribute(0)]];
short4 normal_ed [[attribute(1)]];
#if !defined(HAS_UNIFORM_u_color)
float4 color [[attribute(fillExtrusionUBOCount + 2)]];
float4 color [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_base)
float base [[attribute(fillExtrusionUBOCount + 3)]];
float base [[attribute(3)]];
#endif
#if !defined(HAS_UNIFORM_u_height)
float height [[attribute(fillExtrusionUBOCount + 4)]];
float height [[attribute(4)]];
#endif
};
@@ -198,20 +198,20 @@ struct ShaderSource<BuiltIn::FillExtrusionPatternShader, gfx::Backend::Type::Met
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(fillExtrusionUBOCount + 0)]];
short4 normal_ed [[attribute(fillExtrusionUBOCount + 1)]];
short2 pos [[attribute(0)]];
short4 normal_ed [[attribute(1)]];
#if !defined(HAS_UNIFORM_u_base)
float base [[attribute(fillExtrusionUBOCount + 2)]];
float base [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_height)
float height [[attribute(fillExtrusionUBOCount + 3)]];
float height [[attribute(3)]];
#endif
#if !defined(HAS_UNIFORM_u_pattern_from)
ushort4 pattern_from [[attribute(fillExtrusionUBOCount + 4)]];
ushort4 pattern_from [[attribute(4)]];
#endif
#if !defined(HAS_UNIFORM_u_pattern_to)
ushort4 pattern_to [[attribute(fillExtrusionUBOCount + 5)]];
ushort4 pattern_to [[attribute(5)]];
#endif
};

View File

@@ -53,13 +53,13 @@ struct ShaderSource<BuiltIn::HeatmapShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(heatmapUBOCount + 0)]];
short2 pos [[attribute(0)]];
#if !defined(HAS_UNIFORM_u_weight)
float2 weight [[attribute(heatmapUBOCount + 1)]];
float2 weight [[attribute(1)]];
#endif
#if !defined(HAS_UNIFORM_u_radius)
float2 radius [[attribute(heatmapUBOCount + 2)]];
float2 radius [[attribute(2)]];
#endif
};

View File

@@ -40,7 +40,7 @@ struct ShaderSource<BuiltIn::HeatmapTextureShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(heatmapTextureUBOCount + 0)]];
short2 pos [[attribute(0)]];
};
struct FragmentStage {

View File

@@ -68,8 +68,8 @@ struct ShaderSource<BuiltIn::HillshadeShader, gfx::Backend::Type::Metal> {
#define BASIC 4
struct VertexStage {
short2 pos [[attribute(hillshadeUBOCount + 0)]];
short2 texture_pos [[attribute(hillshadeUBOCount + 1)]];
short2 pos [[attribute(0)]];
short2 texture_pos [[attribute(1)]];
};
struct FragmentStage {

View File

@@ -46,8 +46,8 @@ struct ShaderSource<BuiltIn::HillshadePrepareShader, gfx::Backend::Type::Metal>
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(hillshadePrepareUBOCount + 0)]];
short2 texture_pos [[attribute(hillshadePrepareUBOCount + 1)]];
short2 pos [[attribute(0)]];
short2 texture_pos [[attribute(1)]];
};
struct FragmentStage {

View File

@@ -186,26 +186,26 @@ struct ShaderSource<BuiltIn::LineShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos_normal [[attribute(lineUBOCount + 0)]];
uchar4 data [[attribute(lineUBOCount + 1)]];
short2 pos_normal [[attribute(0)]];
uchar4 data [[attribute(1)]];
#if !defined(HAS_UNIFORM_u_color)
float4 color [[attribute(lineUBOCount + 2)]];
float4 color [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_blur)
float2 blur [[attribute(lineUBOCount + 3)]];
float2 blur [[attribute(3)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float2 opacity [[attribute(lineUBOCount + 4)]];
float2 opacity [[attribute(4)]];
#endif
#if !defined(HAS_UNIFORM_u_gapwidth)
float2 gapwidth [[attribute(lineUBOCount + 5)]];
float2 gapwidth [[attribute(5)]];
#endif
#if !defined(HAS_UNIFORM_u_offset)
float2 offset [[attribute(lineUBOCount + 6)]];
float2 offset [[attribute(6)]];
#endif
#if !defined(HAS_UNIFORM_u_width)
float2 width [[attribute(lineUBOCount + 7)]];
float2 width [[attribute(7)]];
#endif
};
@@ -366,22 +366,22 @@ struct ShaderSource<BuiltIn::LineGradientShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos_normal [[attribute(lineUBOCount + 0)]];
uchar4 data [[attribute(lineUBOCount + 1)]];
short2 pos_normal [[attribute(0)]];
uchar4 data [[attribute(1)]];
#if !defined(HAS_UNIFORM_u_blur)
float2 blur [[attribute(lineUBOCount + 2)]];
float2 blur [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float2 opacity [[attribute(lineUBOCount + 3)]];
float2 opacity [[attribute(3)]];
#endif
#if !defined(HAS_UNIFORM_u_gapwidth)
float2 gapwidth [[attribute(lineUBOCount + 4)]];
float2 gapwidth [[attribute(4)]];
#endif
#if !defined(HAS_UNIFORM_u_offset)
float2 offset [[attribute(lineUBOCount + 5)]];
float2 offset [[attribute(5)]];
#endif
#if !defined(HAS_UNIFORM_u_width)
float2 width [[attribute(lineUBOCount + 6)]];
float2 width [[attribute(6)]];
#endif
};
@@ -533,29 +533,29 @@ struct ShaderSource<BuiltIn::LinePatternShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos_normal [[attribute(lineUBOCount + 0)]];
uchar4 data [[attribute(lineUBOCount + 1)]];
short2 pos_normal [[attribute(0)]];
uchar4 data [[attribute(1)]];
#if !defined(HAS_UNIFORM_u_blur)
float2 blur [[attribute(lineUBOCount + 2)]];
float2 blur [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float2 opacity [[attribute(lineUBOCount + 3)]];
float2 opacity [[attribute(3)]];
#endif
#if !defined(HAS_UNIFORM_u_gapwidth)
float2 gapwidth [[attribute(lineUBOCount + 4)]];
float2 gapwidth [[attribute(4)]];
#endif
#if !defined(HAS_UNIFORM_u_offset)
float2 offset [[attribute(lineUBOCount + 5)]];
float2 offset [[attribute(5)]];
#endif
#if !defined(HAS_UNIFORM_u_width)
float2 width [[attribute(lineUBOCount + 6)]];
float2 width [[attribute(6)]];
#endif
#if !defined(HAS_UNIFORM_u_pattern_from)
ushort4 pattern_from [[attribute(lineUBOCount + 7)]];
ushort4 pattern_from [[attribute(7)]];
#endif
#if !defined(HAS_UNIFORM_u_pattern_to)
ushort4 pattern_to [[attribute(lineUBOCount + 8)]];
ushort4 pattern_to [[attribute(8)]];
#endif
};
@@ -770,29 +770,29 @@ struct ShaderSource<BuiltIn::LineSDFShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos_normal [[attribute(lineUBOCount + 0)]];
uchar4 data [[attribute(lineUBOCount + 1)]];
short2 pos_normal [[attribute(0)]];
uchar4 data [[attribute(1)]];
#if !defined(HAS_UNIFORM_u_color)
float4 color [[attribute(lineUBOCount + 2)]];
float4 color [[attribute(2)]];
#endif
#if !defined(HAS_UNIFORM_u_blur)
float2 blur [[attribute(lineUBOCount + 3)]];
float2 blur [[attribute(3)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float2 opacity [[attribute(lineUBOCount + 4)]];
float2 opacity [[attribute(4)]];
#endif
#if !defined(HAS_UNIFORM_u_gapwidth)
float2 gapwidth [[attribute(lineUBOCount + 5)]];
float2 gapwidth [[attribute(5)]];
#endif
#if !defined(HAS_UNIFORM_u_offset)
float2 offset [[attribute(lineUBOCount + 6)]];
float2 offset [[attribute(6)]];
#endif
#if !defined(HAS_UNIFORM_u_width)
float2 width [[attribute(lineUBOCount + 7)]];
float2 width [[attribute(7)]];
#endif
#if !defined(HAS_UNIFORM_u_floorwidth)
float2 floorwidth [[attribute(lineUBOCount + 8)]];
float2 floorwidth [[attribute(8)]];
#endif
};

View File

@@ -37,7 +37,7 @@ struct ShaderSource<BuiltIn::LocationIndicatorShader, gfx::Backend::Type::Metal>
static constexpr auto source = R"(
struct VertexStage {
float2 position [[attribute(locationIndicatorUBOCount + 0)]];
float2 position [[attribute(0)]];
};
struct FragmentStage {
@@ -73,8 +73,8 @@ struct ShaderSource<BuiltIn::LocationIndicatorTexturedShader, gfx::Backend::Type
static constexpr auto source = R"(
struct VertexStage {
float2 position [[attribute(locationIndicatorUBOCount + 0)]];
float2 uv [[attribute(locationIndicatorUBOCount + 1)]];
float2 position [[attribute(0)]];
float2 uv [[attribute(1)]];
};
struct FragmentStage {

View File

@@ -55,8 +55,8 @@ struct ShaderSource<BuiltIn::RasterShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
short2 pos [[attribute(rasterUBOCount + 0)]];
short2 texture_pos [[attribute(rasterUBOCount + 1)]];
short2 pos [[attribute(0)]];
short2 texture_pos [[attribute(1)]];
};
struct FragmentStage {

View File

@@ -12,28 +12,22 @@
namespace mbgl {
namespace shaders {
struct UniformBlockInfo {
constexpr UniformBlockInfo(bool vertex_, bool fragment_, std::size_t size_, std::size_t id_)
: index(id_),
vertex(vertex_),
fragment(fragment_),
size(size_),
id(id_) {}
std::size_t index;
bool vertex;
bool fragment;
std::size_t size;
std::size_t id;
};
struct AttributeInfo {
constexpr AttributeInfo(std::size_t index_, gfx::AttributeDataType dataType_, std::size_t id_)
constexpr AttributeInfo(std::size_t index_,
gfx::AttributeDataType dataType_,
std::size_t bufferIndex_,
std::size_t id_)
: index(index_),
dataType(dataType_),
bufferIndex(bufferIndex_),
id(id_) {}
std::size_t index;
gfx::AttributeDataType dataType;
std::size_t bufferIndex;
std::size_t id;
};
struct TextureInfo {
constexpr TextureInfo(std::size_t index_, std::size_t id_)
: index(index_),
@@ -41,6 +35,7 @@ struct TextureInfo {
std::size_t index;
std::size_t id;
};
} // namespace shaders
namespace mtl {
class RenderableResource;

View File

@@ -89,14 +89,14 @@ struct ShaderSource<BuiltIn::SymbolIconShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
float4 pos_offset [[attribute(symbolUBOCount + 0)]];
float4 data [[attribute(symbolUBOCount + 1)]];
float4 pixeloffset [[attribute(symbolUBOCount + 2)]];
float3 projected_pos [[attribute(symbolUBOCount + 3)]];
float fade_opacity [[attribute(symbolUBOCount + 4)]];
float4 pos_offset [[attribute(0)]];
float4 data [[attribute(1)]];
float4 pixeloffset [[attribute(2)]];
float3 projected_pos [[attribute(3)]];
float fade_opacity [[attribute(4)]];
#if !defined(HAS_UNIFORM_u_opacity)
float opacity [[attribute(symbolUBOCount + 5)]];
float opacity [[attribute(5)]];
#endif
};
@@ -245,26 +245,26 @@ struct ShaderSource<BuiltIn::SymbolSDFShader, gfx::Backend::Type::Metal> {
static constexpr auto source = R"(
struct VertexStage {
float4 pos_offset [[attribute(symbolUBOCount + 0)]];
float4 data [[attribute(symbolUBOCount + 1)]];
float4 pixeloffset [[attribute(symbolUBOCount + 2)]];
float3 projected_pos [[attribute(symbolUBOCount + 3)]];
float fade_opacity [[attribute(symbolUBOCount + 4)]];
float4 pos_offset [[attribute(0)]];
float4 data [[attribute(1)]];
float4 pixeloffset [[attribute(2)]];
float3 projected_pos [[attribute(3)]];
float fade_opacity [[attribute(4)]];
#if !defined(HAS_UNIFORM_u_fill_color)
float4 fill_color [[attribute(symbolUBOCount + 5)]];
float4 fill_color [[attribute(5)]];
#endif
#if !defined(HAS_UNIFORM_u_halo_color)
float4 halo_color [[attribute(symbolUBOCount + 6)]];
float4 halo_color [[attribute(6)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float opacity [[attribute(symbolUBOCount + 7)]];
float opacity [[attribute(7)]];
#endif
#if !defined(HAS_UNIFORM_u_halo_width)
float halo_width [[attribute(symbolUBOCount + 8)]];
float halo_width [[attribute(8)]];
#endif
#if !defined(HAS_UNIFORM_u_halo_blur)
float halo_blur [[attribute(symbolUBOCount + 9)]];
float halo_blur [[attribute(9)]];
#endif
};
@@ -481,25 +481,25 @@ struct ShaderSource<BuiltIn::SymbolTextAndIconShader, gfx::Backend::Type::Metal>
#define ICON 0.0
struct VertexStage {
float4 pos_offset [[attribute(symbolUBOCount + 0)]];
float4 data [[attribute(symbolUBOCount + 1)]];
float3 projected_pos [[attribute(symbolUBOCount + 2)]];
float fade_opacity [[attribute(symbolUBOCount + 3)]];
float4 pos_offset [[attribute(0)]];
float4 data [[attribute(1)]];
float3 projected_pos [[attribute(2)]];
float fade_opacity [[attribute(3)]];
#if !defined(HAS_UNIFORM_u_fill_color)
float4 fill_color [[attribute(symbolUBOCount + 4)]];
float4 fill_color [[attribute(4)]];
#endif
#if !defined(HAS_UNIFORM_u_halo_color)
float4 halo_color [[attribute(symbolUBOCount + 5)]];
float4 halo_color [[attribute(5)]];
#endif
#if !defined(HAS_UNIFORM_u_opacity)
float opacity [[attribute(symbolUBOCount + 6)]];
float opacity [[attribute(6)]];
#endif
#if !defined(HAS_UNIFORM_u_halo_width)
float halo_width [[attribute(symbolUBOCount + 7)]];
float halo_width [[attribute(7)]];
#endif
#if !defined(HAS_UNIFORM_u_halo_blur)
float halo_blur [[attribute(symbolUBOCount + 8)]];
float halo_blur [[attribute(8)]];
#endif
};

View File

@@ -110,9 +110,9 @@ typedef struct
struct VertexTriWideVecB
{
// x, y offset around the center
float3 screenPos [[attribute(wideVectorUBOCount + 0)]];
float4 color [[attribute(wideVectorUBOCount + 1)]];
int index [[attribute(wideVectorUBOCount + 2)]];
float3 screenPos [[attribute(0)]];
float4 color [[attribute(1)]];
int index [[attribute(2)]];
};
// Wide vector vertex passed to fragment shader (new version)
@@ -222,7 +222,7 @@ vertex ProjVertexTriWideVecPerf vertexTri_wideVecPerf(
constant Uniforms &uniforms [[ buffer(idWideVectorUniformsUBO) ]],
constant UniformWideVec &wideVec [[ buffer(idWideVectorUniformWideVecUBO) ]],
uint instanceID [[ instance_id ]],
constant VertexTriWideVecInstance *wideVecInsts [[ buffer(wideVectorUBOCount + 3) ]])
constant VertexTriWideVecInstance *wideVecInsts [[ buffer(wideVectorUBOCount + 1) ]])
{
ProjVertexTriWideVecPerf outVert = {
.position = discardPt,