Skip to content

Commit

Permalink
Fixing poly overcount in logging in Metal renderer
Browse files Browse the repository at this point in the history
plRenderTriListFunc was taking the index count and not the triangle count
  • Loading branch information
colincornaby committed Nov 30, 2023
1 parent 6491a18 commit b755ebd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/Plasma/FeatureLib/pfMetalPipeline/plMetalPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ bool plRenderTriListFunc::RenderPrims() const
size_t lightSize = offsetof(plMetalLights, lampSources) + (sizeof(plMetalShaderLightSource) * lights->count);

fDevice->CurrentRenderCommandEncoder()->setVertexBytes(lights, sizeof(plMetalLights), VertexShaderArgumentLights);
fDevice->CurrentRenderCommandEncoder()->drawIndexedPrimitives(MTL::PrimitiveTypeTriangle, fNumTris, MTL::IndexTypeUInt16, fDevice->fCurrentIndexBuffer, (sizeof(uint16_t) * fIStart));
fDevice->CurrentRenderCommandEncoder()->drawIndexedPrimitives(MTL::PrimitiveTypeTriangle, fNumTris * 3, MTL::IndexTypeUInt16, fDevice->fCurrentIndexBuffer, (sizeof(uint16_t) * fIStart));
}

plMetalPipeline::plMetalPipeline(hsWindowHndl display, hsWindowHndl window, const hsG3DDeviceModeRecord* devMode) : pl3DPipeline(devMode),
Expand Down Expand Up @@ -1183,7 +1183,7 @@ void plMetalPipeline::IRenderBufferSpan(const plIcicle& span, hsGDeviceRef* vb,

/* Index Buffer stuff and drawing */

plRenderTriListFunc render(&fDevice, 0, vStart, vLength, iStart, iLength);
plRenderTriListFunc render(&fDevice, 0, vStart, vLength, iStart, iLength/3);

plProfile_EndTiming(RenderBuff);

Expand Down Expand Up @@ -1478,7 +1478,7 @@ void plMetalPipeline::IRenderAuxSpan(const plSpan& span, const plAuxSpan* aux)
fState.fCurrentVertexBuffer = vRef->GetBuffer();
fDevice.fCurrentIndexBuffer = iRef->GetBuffer();

plRenderTriListFunc render(&fDevice, 0, aux->fVStartIdx, aux->fVLength, aux->fIStartIdx, aux->fILength);
plRenderTriListFunc render(&fDevice, 0, aux->fVStartIdx, aux->fVLength, aux->fIStartIdx, aux->fILength/3);

for (int32_t pass = 0; pass < mRef->GetNumPasses(); pass++) {
IHandleMaterialPass(material, pass, &span, vRef);
Expand Down Expand Up @@ -3707,7 +3707,7 @@ void plMetalPipeline::IRenderShadowCasterSpan(plShadowSlave* slave, plDrawableSp
uint32_t iStart = span.fIPackedIdx;
uint32_t iLength = span.fILength;

plRenderTriListFunc render(&fDevice, 0, vStart, vLength, iStart, iLength);
plRenderTriListFunc render(&fDevice, 0, vStart, vLength, iStart, iLength/3);

static hsMatrix44 emptyMatrix;
hsMatrix44 m = emptyMatrix;
Expand Down

0 comments on commit b755ebd

Please sign in to comment.