Skip to content

Commit

Permalink
Fix ModVol draws
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Jan 9, 2025
1 parent 6883572 commit 7aa8865
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/rend/metal/metal_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ void MetalPipelineManager::CreateModVolPipeline(ModVolMode mode, int cullMode, b
else {
vertexDesc = MTL::VertexDescriptor::alloc()->init();

auto layout = vertexDesc->layouts()->object(0);
auto layout = vertexDesc->layouts()->object(30);
layout->setStride(sizeof(float) * 3);

auto attribute = vertexDesc->attributes()->object(0);
attribute->setOffset(0);
attribute->setBufferIndex(0);
attribute->setBufferIndex(30);
attribute->setFormat(MTL::VertexFormatFloat3);

descriptor->setVertexDescriptor(vertexDesc);
Expand Down
7 changes: 3 additions & 4 deletions core/rend/metal/metal_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ void MetalRenderer::SetBaseScissor(MTL::Viewport viewport) {

void MetalRenderer::DrawPoly(MTL::RenderCommandEncoder *encoder, u32 listType, bool sortTriangles, const PolyParam &poly, u32 first, u32 count)
{
encoder->setVertexBuffer(curMainBuffer, offsets.vertexUniformOffset, 0);

MTL::ScissorRect scissorRect {};
TileClipping tileClip = SetTileClip(encoder, poly.tileclip, scissorRect);

Expand Down Expand Up @@ -333,7 +331,7 @@ void MetalRenderer::DrawModVols(MTL::RenderCommandEncoder *encoder, int first, i
return;

encoder->pushDebugGroup(NS::String::string("DrawModVols", NS::UTF8StringEncoding));
encoder->setVertexBufferOffset(offsets.modVolOffset, 0);
encoder->setVertexBufferOffset(offsets.modVolOffset, 30);

ModifierVolumeParam* params = &pvrrc.global_param_mvo[first];

Expand Down Expand Up @@ -387,7 +385,7 @@ void MetalRenderer::DrawModVols(MTL::RenderCommandEncoder *encoder, int first, i
mod_base = -1;
}
}
encoder->setVertexBufferOffset(0, 0);
encoder->setVertexBufferOffset(0, 30);

state = pipelineManager.GetModifierVolumePipeline(ModVolMode::Final, 0, false);
depth_state = pipelineManager.GetModVolDepthStencilStates(ModVolMode::Final, 0, false);
Expand Down Expand Up @@ -536,6 +534,7 @@ bool MetalRenderer::Draw(const MetalTexture *fogTexture, const MetalTexture *pal
UploadMainBuffer(vtxUniforms, fragUniforms);

renderEncoder->setVertexBuffer(curMainBuffer, 0, 30);
renderEncoder->setVertexBuffer(curMainBuffer, offsets.vertexUniformOffset, 0);
renderEncoder->setFragmentBuffer(curMainBuffer, offsets.fragmentUniformOffset, 0);

RenderPass previous_pass {};
Expand Down

0 comments on commit 7aa8865

Please sign in to comment.