enable triangle fan support

This commit is contained in:
Samuliak 2024-08-30 11:02:09 +02:00
parent 41ee2e75ae
commit 1412d1e70a
4 changed files with 13 additions and 4 deletions

View File

@ -287,7 +287,6 @@ void LatteIndices_generateAutoLineLoopIndices(void* indexDataOutput, uint32 coun
template<typename T>
void LatteIndices_unpackTriangleFanAndConvert(const void* indexDataInput, void* indexDataOutput, uint32 count, uint32& indexMin, uint32& indexMax)
{
debug_printf("TRIANGLE FAN UNPACK %u\n", rand());
const betype<T>* src = (betype<T>*)indexDataInput;
T* dst = (T*)indexDataOutput;
// TODO: check this
@ -308,7 +307,6 @@ void LatteIndices_unpackTriangleFanAndConvert(const void* indexDataInput, void*
template<typename T>
void LatteIndices_generateAutoTriangleFanIndices(const void* indexDataInput, void* indexDataOutput, uint32 count, uint32& indexMin, uint32& indexMax)
{
debug_printf("TRIANGLE FAN AUTO %u\n", rand());
const betype<T>* src = (betype<T>*)indexDataInput;
T* dst = (T*)indexDataOutput;
for (sint32 i = 0; i < count; i++)
@ -699,7 +697,6 @@ void LatteIndices_decode(const void* indexData, LatteIndexType indexType, uint32
cemu_assert_debug(false);
outputCount = count + 1;
}
/*
else if (primitiveMode == LattePrimitiveMode::TRIANGLE_FAN && g_renderer->GetType() == RendererAPI::Metal)
{
if (indexType == LatteIndexType::AUTO)
@ -723,7 +720,6 @@ void LatteIndices_decode(const void* indexData, LatteIndexType indexType, uint32
cemu_assert_debug(false);
outputCount = count;
}
*/
else
{
if (indexType == LatteIndexType::U16_BE)

View File

@ -60,6 +60,9 @@ MetalRestridedBufferRange MetalVertexBufferCache::RestrideBufferIfNeeded(MTL::Bu
// TODO: do the barriers in one call?
MTL::Resource* barrierBuffers[] = {buffer};
renderCommandEncoder->memoryBarrier(barrierBuffers, 1, MTL::RenderStageVertex, MTL::RenderStageVertex);
// Debug
m_mtlr->GetPerformanceMonitor().m_vertexBufferRestrides++;
}
else
{

View File

@ -7,6 +7,8 @@ public:
// Per frame data
uint32 m_renderPasses = 0;
uint32 m_vertexBufferRestrides = 0;
uint32 m_triangleFans = 0;
MetalPerformanceMonitor() = default;
~MetalPerformanceMonitor() = default;
@ -14,5 +16,7 @@ public:
void ResetPerFrameData()
{
m_renderPasses = 0;
m_vertexBufferRestrides = 0;
m_triangleFans = 0;
}
};

View File

@ -449,6 +449,8 @@ void MetalRenderer::AppendOverlayDebugInfo()
ImGui::Text("--- Metal info (per frame) ---");
ImGui::Text("Command buffers %zu", m_commandBuffers.size());
ImGui::Text("Render passes %u", m_performanceMonitor.m_renderPasses);
ImGui::Text("Vertex buffer restrides %u", m_performanceMonitor.m_vertexBufferRestrides);
ImGui::Text("Triangle fans %u", m_performanceMonitor.m_triangleFans);
}
// TODO: halfZ
@ -1221,6 +1223,10 @@ void MetalRenderer::draw_execute(uint32 baseVertex, uint32 baseInstance, uint32
LatteStreamout_FinishDrawcall(false);
// Debug
if (primitiveMode == LattePrimitiveMode::TRIANGLE_FAN)
m_performanceMonitor.m_triangleFans++;
LatteGPUState.drawCallCounter++;
}