Latte: Add support for MIN_DX10 shader instruction

This commit is contained in:
Exzap 2023-02-22 13:09:37 +01:00
parent 05e0f349e0
commit 9d25b88368
7 changed files with 10 additions and 7 deletions

View File

@ -588,7 +588,6 @@ bool LatteMRT::UpdateCurrentFBO()
if (depthBufferView == nullptr) if (depthBufferView == nullptr)
{ {
// create depth buffer view // create depth buffer view
forceLogDebug_printf("Creating depth buffer tex %08x %dx%d slice %d", depthBufferPhysMem, depthBufferHeight, depthBufferWidth, depthBufferViewFirstSlice);
if(depthBufferViewFirstSlice == 0) if(depthBufferViewFirstSlice == 0)
depthBufferView = LatteTexture_CreateMapping(depthBufferPhysMem, 0, depthBufferWidth, depthBufferHeight, 1, depthBufferPitch, depthBufferTileMode, depthBufferSwizzle, 0, 1, 0, 1, depthBufferFormat, Latte::E_DIM::DIM_2D, Latte::E_DIM::DIM_2D, true); depthBufferView = LatteTexture_CreateMapping(depthBufferPhysMem, 0, depthBufferWidth, depthBufferHeight, 1, depthBufferPitch, depthBufferTileMode, depthBufferSwizzle, 0, 1, 0, 1, depthBufferFormat, Latte::E_DIM::DIM_2D, Latte::E_DIM::DIM_2D, true);
else else

View File

@ -813,6 +813,8 @@ LatteDecompilerShader* LatteShader_CompileSeparablePixelShader(uint64 baseHash,
void LatteSHRC_UpdateVertexShader(uint8* vertexShaderPtr, uint32 vertexShaderSize, bool usesGeometryShader) void LatteSHRC_UpdateVertexShader(uint8* vertexShaderPtr, uint32 vertexShaderSize, bool usesGeometryShader)
{ {
// todo - should include VTX_SEMANTIC table in state
LatteSHRC_UpdateVSBaseHash(vertexShaderPtr, vertexShaderSize, usesGeometryShader); LatteSHRC_UpdateVSBaseHash(vertexShaderPtr, vertexShaderSize, usesGeometryShader);
uint64 vsAuxHash = 0; uint64 vsAuxHash = 0;
auto itBaseShader = sVertexShaders.find(_shaderBaseHash_vs); auto itBaseShader = sVertexShaders.find(_shaderBaseHash_vs);

View File

@ -345,6 +345,7 @@ bool LatteDecompiler_IsALUTransInstruction(bool isOP3, uint32 opcode)
opcode == ALU_OP2_INST_SETGE_UINT || opcode == ALU_OP2_INST_SETGE_UINT ||
opcode == ALU_OP2_INST_SETGT_UINT || opcode == ALU_OP2_INST_SETGT_UINT ||
opcode == ALU_OP2_INST_MAX_DX10 || opcode == ALU_OP2_INST_MAX_DX10 ||
opcode == ALU_OP2_INST_MIN_DX10 ||
opcode == ALU_OP2_INST_PRED_SETE || opcode == ALU_OP2_INST_PRED_SETE ||
opcode == ALU_OP2_INST_PRED_SETNE || opcode == ALU_OP2_INST_PRED_SETNE ||
opcode == ALU_OP2_INST_PRED_SETGE || opcode == ALU_OP2_INST_PRED_SETGE ||

View File

@ -176,6 +176,7 @@ bool _isIntegerInstruction(const LatteDecompilerALUInstruction& aluInstruction)
case ALU_OP2_INST_COS: case ALU_OP2_INST_COS:
case ALU_OP2_INST_RNDNE: case ALU_OP2_INST_RNDNE:
case ALU_OP2_INST_MAX_DX10: case ALU_OP2_INST_MAX_DX10:
case ALU_OP2_INST_MIN_DX10:
case ALU_OP2_INST_SETGT: case ALU_OP2_INST_SETGT:
case ALU_OP2_INST_SETGE: case ALU_OP2_INST_SETGE:
case ALU_OP2_INST_SETNE: case ALU_OP2_INST_SETNE:

View File

@ -1038,7 +1038,8 @@ void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderContext, Lat
} }
else if( aluInstruction->opcode == ALU_OP2_INST_MAX || else if( aluInstruction->opcode == ALU_OP2_INST_MAX ||
aluInstruction->opcode == ALU_OP2_INST_MIN || aluInstruction->opcode == ALU_OP2_INST_MIN ||
aluInstruction->opcode == ALU_OP2_INST_MAX_DX10 ) aluInstruction->opcode == ALU_OP2_INST_MAX_DX10 ||
aluInstruction->opcode == ALU_OP2_INST_MIN_DX10 )
{ {
outputType = _getALUInstructionOutputDataType(shaderContext, aluInstruction); outputType = _getALUInstructionOutputDataType(shaderContext, aluInstruction);
_emitInstructionOutputVariableName(shaderContext, aluInstruction); _emitInstructionOutputVariableName(shaderContext, aluInstruction);
@ -1048,10 +1049,10 @@ void _emitALUOP2InstructionCode(LatteDecompilerShaderContext* shaderContext, Lat
src->add("max"); src->add("max");
else if( aluInstruction->opcode == ALU_OP2_INST_MIN ) else if( aluInstruction->opcode == ALU_OP2_INST_MIN )
src->add("min"); src->add("min");
else if( aluInstruction->opcode == ALU_OP2_INST_MAX_DX10 ) else if (aluInstruction->opcode == ALU_OP2_INST_MAX_DX10)
{
src->add("max"); src->add("max");
} else if (aluInstruction->opcode == ALU_OP2_INST_MIN_DX10)
src->add("min");
src->add("("); src->add("(");
_emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_FLOAT); _emitOperandInputCode(shaderContext, aluInstruction, 0, LATTE_DECOMPILER_DTYPE_FLOAT);
src->add(", "); src->add(", ");

View File

@ -31,6 +31,7 @@
#define ALU_OP2_INST_MAX (0x003) #define ALU_OP2_INST_MAX (0x003)
#define ALU_OP2_INST_MIN (0x004) #define ALU_OP2_INST_MIN (0x004)
#define ALU_OP2_INST_MAX_DX10 (0x005) #define ALU_OP2_INST_MAX_DX10 (0x005)
#define ALU_OP2_INST_MIN_DX10 (0x006)
#define ALU_OP2_INST_SETE (0x008) #define ALU_OP2_INST_SETE (0x008)
#define ALU_OP2_INST_SETGT (0x009) #define ALU_OP2_INST_SETGT (0x009)
#define ALU_OP2_INST_SETGE (0x00A) #define ALU_OP2_INST_SETGE (0x00A)

View File

@ -209,7 +209,6 @@ uint32 VkTextureChunkedHeap::allocateNewChunk(uint32 chunkIndex, uint32 minimumA
VkResult r = vkAllocateMemory(m_device, &allocInfo, nullptr, &imageMemory); VkResult r = vkAllocateMemory(m_device, &allocInfo, nullptr, &imageMemory);
if (r != VK_SUCCESS) if (r != VK_SUCCESS)
continue; continue;
forceLog_printf("Vulkan-Info: Allocated additional memory for textures from device-local memory");
m_list_chunkInfo[chunkIndex].mem = imageMemory; m_list_chunkInfo[chunkIndex].mem = imageMemory;
return allocationSize; return allocationSize;
} }
@ -225,7 +224,6 @@ uint32 VkTextureChunkedHeap::allocateNewChunk(uint32 chunkIndex, uint32 minimumA
VkResult r = vkAllocateMemory(m_device, &allocInfo, nullptr, &imageMemory); VkResult r = vkAllocateMemory(m_device, &allocInfo, nullptr, &imageMemory);
if (r != VK_SUCCESS) if (r != VK_SUCCESS)
continue; continue;
forceLog_printf("Vulkan-Info: Allocated additional memory for textures from host-local memory");
m_list_chunkInfo[chunkIndex].mem = imageMemory; m_list_chunkInfo[chunkIndex].mem = imageMemory;
return allocationSize; return allocationSize;
} }