mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-12 09:09:47 +12:00
set stencil reference value
This commit is contained in:
parent
1a3e8357fa
commit
db08f73530
2 changed files with 6 additions and 2 deletions
|
@ -37,7 +37,6 @@ public:
|
|||
MTL::StencilDescriptor* stencilDesc = nullptr;
|
||||
if (stencilEnable) {
|
||||
const u8 stencilFunc = Helpers::getBits<4, 3>(hash.stencilConfig);
|
||||
const s8 reference = s8(Helpers::getBits<16, 8>(hash.stencilConfig)); // Signed reference value
|
||||
const u8 stencilRefMask = Helpers::getBits<24, 8>(hash.stencilConfig);
|
||||
|
||||
const u32 stencilBufferMask = hash.depthStencilWrite ? Helpers::getBits<8, 8>(hash.stencilConfig) : 0;
|
||||
|
@ -53,7 +52,6 @@ public:
|
|||
stencilDesc->setStencilCompareFunction(toMTLCompareFunc(stencilFunc));
|
||||
stencilDesc->setReadMask(stencilRefMask);
|
||||
stencilDesc->setWriteMask(stencilBufferMask);
|
||||
// TODO: Set reference value
|
||||
|
||||
desc->setFrontFaceStencil(stencilDesc);
|
||||
desc->setBackFaceStencil(stencilDesc);
|
||||
|
|
|
@ -574,6 +574,12 @@ void RendererMTL::drawVertices(PICA::PrimType primType, std::span<const PICA::Ve
|
|||
renderCommandEncoder->setBlendColor(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
|
||||
}
|
||||
|
||||
// Stencil reference
|
||||
if (stencilEnable) {
|
||||
const s8 reference = s8(Helpers::getBits<16, 8>(depthStencilHash.stencilConfig)); // Signed reference value
|
||||
renderCommandEncoder->setStencilReferenceValue(reference);
|
||||
}
|
||||
|
||||
// Bind resources
|
||||
setupTextureEnvState(renderCommandEncoder);
|
||||
bindTexturesToSlots(renderCommandEncoder);
|
||||
|
|
Loading…
Add table
Reference in a new issue