mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-08 16:01:19 +12:00
support instancing for mesh shaders
This commit is contained in:
parent
395cd1cd11
commit
950f04d444
5 changed files with 15 additions and 6 deletions
|
@ -3920,8 +3920,8 @@ void LatteDecompiler_emitMSLShader(LatteDecompilerShaderContext* shaderContext,
|
|||
// Index buffer
|
||||
inputFetchDefinition += "if (indexType == 1) // UShort\n";
|
||||
inputFetchDefinition += "vid = ((device ushort*)indexBuffer)[vid];\n";
|
||||
inputFetchDefinition += "else if (indexType == 2)\n";
|
||||
inputFetchDefinition += "vid = ((device uint*)indexBuffer)[vid]; // UInt\n";
|
||||
inputFetchDefinition += "else if (indexType == 2) // UInt\n";
|
||||
inputFetchDefinition += "vid = ((device uint*)indexBuffer)[vid];\n";
|
||||
|
||||
inputFetchDefinition += "VertexIn in;\n";
|
||||
for (auto& bufferGroup : shaderContext->fetchShader->bufferGroups)
|
||||
|
@ -4060,8 +4060,8 @@ void LatteDecompiler_emitMSLShader(LatteDecompilerShaderContext* shaderContext,
|
|||
{
|
||||
// Calculate the imaginary vertex id
|
||||
src->add("uint vid = tig * VERTICES_PER_VERTEX_PRIMITIVE + tid;" _CRLF);
|
||||
// TODO: don't hardcode the instance index
|
||||
src->add("uint iid = 0;" _CRLF);
|
||||
src->add("uint iid = vid / verticesPerInstance;" _CRLF);
|
||||
src->add("vid %= verticesPerInstance;" _CRLF);
|
||||
// Fetch the input
|
||||
src->add("VertexIn in = fetchVertex(vid, indexBuffer, indexType VERTEX_BUFFERS);" _CRLF);
|
||||
// Output is defined as object payload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue