new static declaration style

This commit is contained in:
Tim Sylvester
2023-10-04 09:45:57 -07:00
parent dd114b26c3
commit 80e194fbe1
2 changed files with 26 additions and 21 deletions

View File

@@ -322,27 +322,9 @@ struct ShaderSource<BuiltIn::LineSDFShader, gfx::Backend::Type::Metal> {
static constexpr auto vertexMainFunction = "vertexMain";
static constexpr auto fragmentMainFunction = "fragmentMain";
static constexpr AttributeInfo attributes[] = {
{0, gfx::AttributeDataType::Short2, 1, "a_pos_normal"},
{1, gfx::AttributeDataType::UByte4, 1, "a_data"},
{2, gfx::AttributeDataType::Float4, 1, "a_color"},
{3, gfx::AttributeDataType::Float2, 1, "a_blur"},
{4, gfx::AttributeDataType::Float2, 1, "a_opacity"},
{5, gfx::AttributeDataType::Float2, 1, "a_gapwidth"},
{6, gfx::AttributeDataType::Float2, 1, "a_offset"},
{7, gfx::AttributeDataType::Float2, 1, "a_width"},
{8, gfx::AttributeDataType::Float2, 1, "a_floorwidth"},
};
static constexpr UniformBlockInfo uniforms[] = {
MLN_MTL_UNIFORM_BLOCK(9, true, true, LineSDFUBO),
MLN_MTL_UNIFORM_BLOCK(10, true, false, LineSDFPropertiesUBO),
MLN_MTL_UNIFORM_BLOCK(11, true, false, LineSDFInterpolationUBO),
MLN_MTL_UNIFORM_BLOCK(12, true, true, LinePermutationUBO),
MLN_MTL_UNIFORM_BLOCK(13, true, false, ExpressionInputsUBO),
};
static constexpr TextureInfo textures[] = {
{0, "u_image"},
};
static const std::array<AttributeInfo, 9> attributes;
static const std::array<UniformBlockInfo, 5> uniforms;
static const std::array<TextureInfo, 1> textures;
static constexpr auto source = R"(

View File

@@ -45,5 +45,28 @@ const std::array<TextureInfo, 1> ShaderSource<BuiltIn::LinePatternShader, gfx::B
TextureInfo{0, "u_image"},
};
const std::array<AttributeInfo, 9> ShaderSource<BuiltIn::LineSDFShader, gfx::Backend::Type::Metal>::attributes= {
AttributeInfo{0, gfx::AttributeDataType::Short2, 1, "a_pos_normal"},
AttributeInfo{1, gfx::AttributeDataType::UByte4, 1, "a_data"},
AttributeInfo{2, gfx::AttributeDataType::Float4, 1, "a_color"},
AttributeInfo{3, gfx::AttributeDataType::Float2, 1, "a_blur"},
AttributeInfo{4, gfx::AttributeDataType::Float2, 1, "a_opacity"},
AttributeInfo{5, gfx::AttributeDataType::Float2, 1, "a_gapwidth"},
AttributeInfo{6, gfx::AttributeDataType::Float2, 1, "a_offset"},
AttributeInfo{7, gfx::AttributeDataType::Float2, 1, "a_width"},
AttributeInfo{8, gfx::AttributeDataType::Float2, 1, "a_floorwidth"},
};
const std::array<UniformBlockInfo, 5> ShaderSource<BuiltIn::LineSDFShader, gfx::Backend::Type::Metal>::uniforms = {
UniformBlockInfo{9, true, true, sizeof(LineSDFUBO), "LineSDFUBO"},
UniformBlockInfo{10, true, false, sizeof(LineSDFPropertiesUBO), "LineSDFPropertiesUBO"},
UniformBlockInfo{11, true, false, sizeof(LineSDFInterpolationUBO), "LineSDFInterpolationUBO"},
UniformBlockInfo{12, true, true, sizeof(LinePermutationUBO), "LinePermutationUBO"},
UniformBlockInfo{13, true, false, sizeof(ExpressionInputsUBO), "ExpressionInputsUBO"},
};
const std::array<TextureInfo, 1> ShaderSource<BuiltIn::LineSDFShader, gfx::Backend::Type::Metal>::textures = {
TextureInfo{0, "u_image"},
};
} // namespace shaders
} // namespace mbgl