Fix Metal frame glitch on older devices (#2379)

This commit is contained in:
Stefan Karschti
2024-05-15 15:30:28 +03:00
committed by GitHub
parent 8e479eea96
commit aff5693fb9
6 changed files with 57 additions and 4 deletions

View File

@@ -23,6 +23,7 @@
#include <mbgl/util/std.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/thread_pool.hpp>
#include <mbgl/util/hash.hpp>
#include <Foundation/Foundation.hpp>
#include <Metal/Metal.hpp>
@@ -361,7 +362,14 @@ bool Context::renderTileClippingMasks(gfx::RenderPass& renderPass,
// Create a render pipeline state, telling Metal how to render the primitives
const auto& renderPassDescriptor = mtlRenderPass.getDescriptor();
if (auto state = mtlShader.getRenderPipelineState(renderable, vertDesc, colorMode)) {
const std::size_t hash = mbgl::util::hash(ShaderClass::attributes[0].index,
0,
MTL::VertexFormatShort2,
vertexSize,
MTL::VertexStepFunctionPerVertex,
1);
if (auto state = mtlShader.getRenderPipelineState(
renderable, vertDesc, colorMode, mbgl::util::hash(colorMode.hash(), hash))) {
clipMaskPipelineState = std::move(state);
}
}