internal/graphicsdriver/metal: Bug fix: TestImageEvenOdd failed

RenderCommandEncoder must be reset whenever the stencil mode is
'prepareStencil' in order to clear the stencil buffer.
This commit is contained in:
Hajime Hoshi 2021-07-06 15:11:20 +09:00
parent 3670b7dd62
commit be1a0e90e7

View File

@ -707,7 +707,7 @@ func (g *Graphics) draw(rps mtl.RenderPipelineState, dst *Image, dstRegion drive
// When prepareing a stencil buffer, flush the current render command encoder
// to make sure the stencil buffer is cleared when loading.
// TODO: What about clearing the stencil buffer by vertices?
if g.lastDstTexture != dst.mtlTexture() || (g.lastStencilMode == noStencil) != (stencilMode == noStencil) {
if g.lastDstTexture != dst.mtlTexture() || (g.lastStencilMode == noStencil) != (stencilMode == noStencil) || stencilMode == prepareStencil {
g.flushRenderCommandEncoderIfNeeded()
}
g.lastStencilMode = stencilMode