Skip to content

Commit

Permalink
metal: don't try to enable blending with integer canvases.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Aug 14, 2024
1 parent 8e2fc44 commit 9d5828a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/modules/graphics/metal/Graphics.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/modules/graphics/metal/Shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<MTLRenderPipelineState> getCachedRenderPipeline(const RenderPipelineKey &key);
id<MTLRenderPipelineState> getCachedRenderPipeline(Graphics *gfx, const RenderPipelineKey &key);
id<MTLComputePipelineState> getComputePipeline() const { return computePipeline; }

static int getUniformBufferBinding();
Expand Down
4 changes: 2 additions & 2 deletions src/modules/graphics/metal/Shader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ static EShLanguage getGLSLangStage(ShaderStageType stage)
}
}

id<MTLRenderPipelineState> Shader::getCachedRenderPipeline(const RenderPipelineKey &key)
id<MTLRenderPipelineState> Shader::getCachedRenderPipeline(graphics::Graphics *gfx, const RenderPipelineKey &key)
{
auto it = cachedRenderPipelines.find(key);

Expand All @@ -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);
Expand Down

0 comments on commit 9d5828a

Please sign in to comment.