From 9d5828a62f64738b0cbaa9abad1e6b952321042d Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Wed, 14 Aug 2024 19:15:23 -0300 Subject: [PATCH] metal: don't try to enable blending with integer canvases. --- src/modules/graphics/metal/Graphics.mm | 2 +- src/modules/graphics/metal/Shader.h | 2 +- src/modules/graphics/metal/Shader.mm | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/graphics/metal/Graphics.mm b/src/modules/graphics/metal/Graphics.mm index 0ffab0f86..1e34b194d 100644 --- a/src/modules/graphics/metal/Graphics.mm +++ b/src/modules/graphics/metal/Graphics.mm @@ -1001,7 +1001,7 @@ static bool isClampOne(SamplerState::WrapMode w) key.blend = state.blend; key.colorChannelMask = state.colorMask; - pipeline = shader->getCachedRenderPipeline(key); + pipeline = shader->getCachedRenderPipeline(this, key); } [encoder setRenderPipelineState:pipeline]; diff --git a/src/modules/graphics/metal/Shader.h b/src/modules/graphics/metal/Shader.h index 174902bfc..0913c5483 100644 --- a/src/modules/graphics/metal/Shader.h +++ b/src/modules/graphics/metal/Shader.h @@ -114,7 +114,7 @@ class Shader final : public love::graphics::Shader ptrdiff_t getHandle() const override { return 0; } void setVideoTextures(love::graphics::Texture *ytexture, love::graphics::Texture *cbtexture, love::graphics::Texture *crtexture) override; - id getCachedRenderPipeline(const RenderPipelineKey &key); + id getCachedRenderPipeline(Graphics *gfx, const RenderPipelineKey &key); id getComputePipeline() const { return computePipeline; } static int getUniformBufferBinding(); diff --git a/src/modules/graphics/metal/Shader.mm b/src/modules/graphics/metal/Shader.mm index 9bf1ec09c..1218039de 100644 --- a/src/modules/graphics/metal/Shader.mm +++ b/src/modules/graphics/metal/Shader.mm @@ -855,7 +855,7 @@ static EShLanguage getGLSLangStage(ShaderStageType stage) } } -id Shader::getCachedRenderPipeline(const RenderPipelineKey &key) +id Shader::getCachedRenderPipeline(graphics::Graphics *gfx, const RenderPipelineKey &key) { auto it = cachedRenderPipelines.find(key); @@ -882,7 +882,7 @@ static EShLanguage getGLSLangStage(ShaderStageType stage) auto formatdesc = Metal::convertPixelFormat(device, format); attachment.pixelFormat = formatdesc.format; - if (key.blend.enable) + if (key.blend.enable && gfx->isPixelFormatSupported(format, PIXELFORMATUSAGEFLAGS_BLEND)) { attachment.blendingEnabled = YES; attachment.sourceRGBBlendFactor = getMTLBlendFactor(key.blend.srcFactorRGB);