simplify uniform names

This commit is contained in:
Samuliak 2024-09-11 12:28:35 +02:00
parent 950f04d444
commit e7f8f0ee4c
2 changed files with 4 additions and 30 deletions

View File

@ -631,14 +631,7 @@ static void _emitUniformAccessCode(LatteDecompilerShaderContext* shaderContext,
} }
cemu_assert_debug(remappedUniformEntry); cemu_assert_debug(remappedUniformEntry);
_emitTypeConversionPrefixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, requiredType); _emitTypeConversionPrefixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, requiredType);
if(shaderContext->shader->shaderType == LatteConst::ShaderType::Vertex ) src->addFmt("supportBuffer.remapped[{}]", remappedUniformEntry->mappedIndex);
src->addFmt("supportBuffer.remappedVS[{}]", remappedUniformEntry->mappedIndex);
else if(shaderContext->shader->shaderType == LatteConst::ShaderType::Pixel )
src->addFmt("supportBuffer.remappedPS[{}]", remappedUniformEntry->mappedIndex);
else if(shaderContext->shader->shaderType == LatteConst::ShaderType::Geometry )
src->addFmt("supportBuffer.remappedGS[{}]", remappedUniformEntry->mappedIndex);
else
debugBreakpoint();
_appendChannelAccess(src, aluInstruction->sourceOperand[operandIndex].chan); _appendChannelAccess(src, aluInstruction->sourceOperand[operandIndex].chan);
_emitTypeConversionSuffixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, requiredType); _emitTypeConversionSuffixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, requiredType);
} }
@ -646,14 +639,7 @@ static void _emitUniformAccessCode(LatteDecompilerShaderContext* shaderContext,
{ {
// uniform registers are accessed with unpredictable (dynamic) offset // uniform registers are accessed with unpredictable (dynamic) offset
_emitTypeConversionPrefixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, requiredType); _emitTypeConversionPrefixMSL(shaderContext, LATTE_DECOMPILER_DTYPE_SIGNED_INT, requiredType);
if(shaderContext->shader->shaderType == LatteConst::ShaderType::Vertex ) src->add("supportBuffer.uniformRegister[");
src->add("supportBuffer.uniformRegisterVS[");
else if (shaderContext->shader->shaderType == LatteConst::ShaderType::Pixel)
src->add("supportBuffer.uniformRegisterPS[");
else if(shaderContext->shader->shaderType == LatteConst::ShaderType::Geometry )
src->add("supportBuffer.uniformRegisterGS[");
else
debugBreakpoint();
_emitUniformAccessIndexCode(shaderContext, aluInstruction, operandIndex); _emitUniformAccessIndexCode(shaderContext, aluInstruction, operandIndex);
src->add("]"); src->add("]");

View File

@ -20,14 +20,7 @@ namespace LatteDecompiler
{ {
// uniform registers or buffers are accessed statically with predictable offsets // uniform registers or buffers are accessed statically with predictable offsets
// this allows us to remap the used entries into a more compact array // this allows us to remap the used entries into a more compact array
if (shaderType == LatteConst::ShaderType::Vertex) src->addFmt("int4 remapped[{}];" _CRLF, (sint32)shader->list_remappedUniformEntries.size());
src->addFmt("int4 remappedVS[{}];" _CRLF, (sint32)shader->list_remappedUniformEntries.size());
else if (shaderType == LatteConst::ShaderType::Pixel)
src->addFmt("int4 remappedPS[{}];" _CRLF, (sint32)shader->list_remappedUniformEntries.size());
else if (shaderType == LatteConst::ShaderType::Geometry)
src->addFmt("int4 remappedGS[{}];" _CRLF, (sint32)shader->list_remappedUniformEntries.size());
else
debugBreakpoint();
uniformOffsets.offset_remapped = uniformCurrentOffset; uniformOffsets.offset_remapped = uniformCurrentOffset;
uniformCurrentOffset += 16 * shader->list_remappedUniformEntries.size(); uniformCurrentOffset += 16 * shader->list_remappedUniformEntries.size();
} }
@ -35,12 +28,7 @@ namespace LatteDecompiler
{ {
uint32 cfileSize = decompilerContext->analyzer.uniformRegisterAccessTracker.DetermineSize(decompilerContext->shaderBaseHash, 256); uint32 cfileSize = decompilerContext->analyzer.uniformRegisterAccessTracker.DetermineSize(decompilerContext->shaderBaseHash, 256);
// full or partial uniform register file has to be present // full or partial uniform register file has to be present
if (shaderType == LatteConst::ShaderType::Vertex) src->addFmt("int4 uniformRegister[{}];" _CRLF, cfileSize);
src->addFmt("int4 uniformRegisterVS[{}];" _CRLF, cfileSize);
else if (shaderType == LatteConst::ShaderType::Pixel)
src->addFmt("int4 uniformRegisterPS[{}];" _CRLF, cfileSize);
else if (shaderType == LatteConst::ShaderType::Geometry)
src->addFmt("int4 uniformRegisterGS[{}];" _CRLF, cfileSize);
uniformOffsets.offset_uniformRegister = uniformCurrentOffset; uniformOffsets.offset_uniformRegister = uniformCurrentOffset;
uniformOffsets.count_uniformRegister = cfileSize; uniformOffsets.count_uniformRegister = cfileSize;
uniformCurrentOffset += 16 * cfileSize; uniformCurrentOffset += 16 * cfileSize;