mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-16 04:07:08 +12:00
implement depth uniforms
This commit is contained in:
parent
e8727d5dbd
commit
13439699ee
2 changed files with 28 additions and 5 deletions
|
@ -369,6 +369,16 @@ void RendererMTL::drawVertices(PICA::PrimType primType, std::span<const PICA::Ve
|
|||
}
|
||||
}
|
||||
|
||||
// Depth uniforms
|
||||
struct {
|
||||
float depthScale;
|
||||
float depthOffset;
|
||||
bool depthMapEnable;
|
||||
} depthUniforms;
|
||||
depthUniforms.depthScale = Floats::f24::fromRaw(regs[PICA::InternalRegs::DepthScale] & 0xffffff).toFloat32();
|
||||
depthUniforms.depthOffset = Floats::f24::fromRaw(regs[PICA::InternalRegs::DepthOffset] & 0xffffff).toFloat32();
|
||||
depthUniforms.depthMapEnable = regs[PICA::InternalRegs::DepthmapEnable] & 1;
|
||||
|
||||
// -------- Pipeline --------
|
||||
Metal::PipelineHash pipelineHash{colorRenderTarget->format, DepthFmt::Unknown1};
|
||||
if (depthStencilRenderTarget) {
|
||||
|
@ -436,6 +446,7 @@ void RendererMTL::drawVertices(PICA::PrimType primType, std::span<const PICA::Ve
|
|||
bindTexturesToSlots(renderCommandEncoder);
|
||||
renderCommandEncoder->setVertexBytes(®s[0x48], (0x200 - 0x48) * sizeof(regs[0]), 0);
|
||||
renderCommandEncoder->setFragmentBytes(®s[0x48], (0x200 - 0x48) * sizeof(regs[0]), 0);
|
||||
renderCommandEncoder->setVertexBytes(&depthUniforms, sizeof(depthUniforms), 2);
|
||||
renderCommandEncoder->setFragmentBytes(&logicOp, sizeof(logicOp), 2);
|
||||
|
||||
renderCommandEncoder->drawPrimitives(toMTLPrimitiveType(primType), NS::UInteger(0), NS::UInteger(vertices.size()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue