bindDepthAlphaMask method
Binds the mask texture and MaskInfo parameters consumed by the masked
depth fragment shaders; shader is the masked variant the pass drew
with. Called only when depthAlphaMasked is true.
Implementation
@override
void bindDepthAlphaMask(
gpu.RenderPass pass,
gpu.Shader shader,
TransientWriter transientsBuffer,
) {
// Mirrors the coverage the color pass tests in Surface():
// texture.a * weighted vertex-color alpha * baseColorFactor alpha.
final params = _maskInfoScratch
..[0] = alphaCutoff
..[1] = baseColorFactor.a
..[2] = vertexColorWeight
..[3] = 0.0;
packTextureTransformRecord(
params,
4,
baseColorTextureTransform,
baseColorTextureTexCoord,
);
pass.bindUniform(
shader.cachedUniformSlot('MaskInfo'),
transientsBuffer.emplace(_maskInfoBytes),
);
final resolved = resolveTextureSource(baseColorTexture);
pass.bindTexture(
shader.cachedUniformSlot('mask_texture'),
Material.whitePlaceholder(resolved),
sampler: samplerOrPlaceholder(
resolved,
textureSourceSampler(baseColorTexture) ?? _repeatSampler,
),
);
}