mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-13 23:35:06 +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;
|
MTL::StencilDescriptor* stencilDesc = nullptr;
|
||||||
if (stencilEnable) {
|
if (stencilEnable) {
|
||||||
const u8 stencilFunc = Helpers::getBits<4, 3>(hash.stencilConfig);
|
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 u8 stencilRefMask = Helpers::getBits<24, 8>(hash.stencilConfig);
|
||||||
|
|
||||||
const u32 stencilBufferMask = hash.depthStencilWrite ? Helpers::getBits<8, 8>(hash.stencilConfig) : 0;
|
const u32 stencilBufferMask = hash.depthStencilWrite ? Helpers::getBits<8, 8>(hash.stencilConfig) : 0;
|
||||||
|
@ -53,7 +52,6 @@ public:
|
||||||
stencilDesc->setStencilCompareFunction(toMTLCompareFunc(stencilFunc));
|
stencilDesc->setStencilCompareFunction(toMTLCompareFunc(stencilFunc));
|
||||||
stencilDesc->setReadMask(stencilRefMask);
|
stencilDesc->setReadMask(stencilRefMask);
|
||||||
stencilDesc->setWriteMask(stencilBufferMask);
|
stencilDesc->setWriteMask(stencilBufferMask);
|
||||||
// TODO: Set reference value
|
|
||||||
|
|
||||||
desc->setFrontFaceStencil(stencilDesc);
|
desc->setFrontFaceStencil(stencilDesc);
|
||||||
desc->setBackFaceStencil(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);
|
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
|
// Bind resources
|
||||||
setupTextureEnvState(renderCommandEncoder);
|
setupTextureEnvState(renderCommandEncoder);
|
||||||
bindTexturesToSlots(renderCommandEncoder);
|
bindTexturesToSlots(renderCommandEncoder);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue