mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-01-08 08:00:44 +01:00
disable vertex buffer restride for object shaders
This commit is contained in:
parent
97f441ecf1
commit
76cf3de80b
@ -1007,16 +1007,31 @@ void MetalRenderer::draw_execute(uint32 baseVertex, uint32 baseInstance, uint32
|
|||||||
auto& vertexBufferRange = m_state.m_vertexBuffers[i];
|
auto& vertexBufferRange = m_state.m_vertexBuffers[i];
|
||||||
if (vertexBufferRange.offset != INVALID_OFFSET)
|
if (vertexBufferRange.offset != INVALID_OFFSET)
|
||||||
{
|
{
|
||||||
// Restride
|
MTL::Buffer* buffer;
|
||||||
uint32 bufferBaseRegisterIndex = mmSQ_VTX_ATTRIBUTE_BLOCK_START + i * 7;
|
size_t offset;
|
||||||
uint32 bufferStride = (LatteGPUState.contextNew.GetRawView()[bufferBaseRegisterIndex + 2] >> 11) & 0xFFFF;
|
|
||||||
|
|
||||||
auto restridedBuffer = m_memoryManager->RestrideBufferIfNeeded(i, bufferStride);
|
// Restride
|
||||||
|
if (geometryShader)
|
||||||
|
{
|
||||||
|
// Object shaders don't need restriding, since the attribute are fetched in the shader
|
||||||
|
buffer = m_memoryManager->GetBufferCache();
|
||||||
|
offset = m_state.m_vertexBuffers[i].offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint32 bufferBaseRegisterIndex = mmSQ_VTX_ATTRIBUTE_BLOCK_START + i * 7;
|
||||||
|
uint32 bufferStride = (LatteGPUState.contextNew.GetRawView()[bufferBaseRegisterIndex + 2] >> 11) & 0xFFFF;
|
||||||
|
|
||||||
|
auto restridedBuffer = m_memoryManager->RestrideBufferIfNeeded(i, bufferStride);
|
||||||
|
|
||||||
|
buffer = restridedBuffer.buffer;
|
||||||
|
offset = restridedBuffer.offset;
|
||||||
|
}
|
||||||
|
|
||||||
// Bind
|
// Bind
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
SetBuffer(renderCommandEncoder, GetMtlShaderType(vertexShader->shaderType, (geometryShader != nullptr)),restridedBuffer.buffer, restridedBuffer.offset, GET_MTL_VERTEX_BUFFER_INDEX(i));
|
SetBuffer(renderCommandEncoder, GetMtlShaderType(vertexShader->shaderType, (geometryShader != nullptr)), buffer, offset, GET_MTL_VERTEX_BUFFER_INDEX(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user