Fixed metal fill color per vertex (#1865)
This commit is contained in:
@@ -22,7 +22,7 @@ struct ShaderSource<BuiltIn::FillShader, gfx::Backend::Type::Metal> {
|
||||
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
float2 color [[attribute(1)]];
|
||||
float4 color [[attribute(1)]];
|
||||
float2 opacity [[attribute(2)]];
|
||||
};
|
||||
|
||||
@@ -59,7 +59,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillPermutationUBO& permutation [[buffer(6)]],
|
||||
device const ExpressionInputsUBO& expr [[buffer(7)]]) {
|
||||
|
||||
const auto color = colorFor(permutation.color, props.color, vertx.color, expr);
|
||||
const auto color = colorFor(permutation.color, props.color, vertx.color, interp.color_t, expr);
|
||||
const auto opacity = valueFor(permutation.opacity, props.opacity, vertx.opacity, interp.opacity_t, expr);
|
||||
|
||||
float4 position = drawable.matrix * float4(float2(vertx.position), 0.0f, 1.0f);
|
||||
@@ -97,7 +97,7 @@ struct ShaderSource<BuiltIn::FillOutlineShader, gfx::Backend::Type::Metal> {
|
||||
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
float2 outline_color [[attribute(1)]];
|
||||
float4 outline_color [[attribute(1)]];
|
||||
float2 opacity [[attribute(2)]];
|
||||
};
|
||||
|
||||
@@ -137,7 +137,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillOutlinePermutationUBO& permutation [[buffer(6)]],
|
||||
device const ExpressionInputsUBO& expr [[buffer(7)]]) {
|
||||
|
||||
const auto outline_color = colorFor(permutation.outline_color, props.outline_color, vertx.outline_color, expr);
|
||||
const auto outline_color = colorFor(permutation.outline_color, props.outline_color, vertx.outline_color, interp.outline_color_t, expr);
|
||||
const auto opacity = valueFor(permutation.opacity, props.opacity, vertx.opacity, interp.opacity_t, expr);
|
||||
|
||||
float4 position = drawable.matrix * float4(float2(vertx.position), 0.0f, 1.0f);
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace shaders {
|
||||
|
||||
const std::array<AttributeInfo, 4> ShaderSource<BuiltIn::FillShader, gfx::Backend::Type::Metal>::attributes = {
|
||||
AttributeInfo{0, gfx::AttributeDataType::Short2, 1, "a_pos"},
|
||||
AttributeInfo{1, gfx::AttributeDataType::Float2, 1, "a_color"},
|
||||
AttributeInfo{1, gfx::AttributeDataType::Float4, 1, "a_color"},
|
||||
AttributeInfo{2, gfx::AttributeDataType::Float2, 1, "a_opacity"},
|
||||
|
||||
// This shader doesn't use it, but we need this so that the layer can assign the same
|
||||
@@ -24,7 +24,7 @@ const std::array<TextureInfo, 0> ShaderSource<BuiltIn::FillShader, gfx::Backend:
|
||||
|
||||
const std::array<AttributeInfo, 4> ShaderSource<BuiltIn::FillOutlineShader, gfx::Backend::Type::Metal>::attributes = {
|
||||
AttributeInfo{0, gfx::AttributeDataType::Short2, 1, "a_pos"},
|
||||
AttributeInfo{1, gfx::AttributeDataType::Float2, 1, "a_outline_color"},
|
||||
AttributeInfo{1, gfx::AttributeDataType::Float4, 1, "a_outline_color"},
|
||||
AttributeInfo{2, gfx::AttributeDataType::Float2, 1, "a_opacity"},
|
||||
|
||||
// See `a_outline_color` in FillShader
|
||||
|
||||
Reference in New Issue
Block a user