Latte/Vulkan: Set RoundingModeRTE for all float types

Seems like GLSL's unpackHalf2x16() is affected by the 16bit rounding setting
This commit is contained in:
Exzap 2023-03-02 16:18:50 +01:00
parent f8ea594447
commit 466ad8d35e
4 changed files with 27 additions and 24 deletions

View File

@ -150,50 +150,50 @@ struct LatteDecompilerShader
{ {
LatteDecompilerShader(LatteConst::ShaderType shaderType) : shaderType(shaderType) {} LatteDecompilerShader(LatteConst::ShaderType shaderType) : shaderType(shaderType) {}
LatteDecompilerShader* next; LatteDecompilerShader* next{nullptr};
LatteConst::ShaderType shaderType; LatteConst::ShaderType shaderType;
uint64 baseHash; uint64 baseHash{0};
uint64 auxHash; uint64 auxHash{0};
// vertex shader // vertex shader
struct LatteFetchShader* compatibleFetchShader{}; struct LatteFetchShader* compatibleFetchShader{};
// error tracking // error tracking
bool hasError; // if set, the shader cannot be used bool hasError{false}; // if set, the shader cannot be used
// optimized access / iteration // optimized access / iteration
// list of uniform buffers used // list of uniform buffers used
uint8 uniformBufferList[LATTE_NUM_MAX_UNIFORM_BUFFERS]; uint8 uniformBufferList[LATTE_NUM_MAX_UNIFORM_BUFFERS];
uint8 uniformBufferListCount; uint8 uniformBufferListCount{ 0 };
// list of used texture units (faster access than iterating textureUnitMask) // list of used texture units (faster access than iterating textureUnitMask)
uint8 textureUnitList[LATTE_NUM_MAX_TEX_UNITS]; uint8 textureUnitList[LATTE_NUM_MAX_TEX_UNITS];
uint8 textureUnitListCount; uint8 textureUnitListCount{ 0 };
// input // input
Latte::E_DIM textureUnitDim[LATTE_NUM_MAX_TEX_UNITS]; // dimension of texture unit, from the currently set texture Latte::E_DIM textureUnitDim[LATTE_NUM_MAX_TEX_UNITS]{}; // dimension of texture unit, from the currently set texture
bool textureIsIntegerFormat[LATTE_NUM_MAX_TEX_UNITS]{}; bool textureIsIntegerFormat[LATTE_NUM_MAX_TEX_UNITS]{};
// analyzer stage (uniforms) // analyzer stage (uniforms)
uint8 uniformMode; // determines how uniforms are managed within the shader (see LATTE_DECOMPILER_UNIFORM_MODE_* constants) uint8 uniformMode{0}; // determines how uniforms are managed within the shader (see LATTE_DECOMPILER_UNIFORM_MODE_* constants)
uint64 uniformDataHash64[2]; // used to avoid redundant calls to glUniform* uint64 uniformDataHash64[2]{0}; // used to avoid redundant calls to glUniform*
std::vector<LatteDecompilerRemappedUniformEntry_t> list_remappedUniformEntries; std::vector<LatteDecompilerRemappedUniformEntry_t> list_remappedUniformEntries;
// analyzer stage (textures) // analyzer stage (textures)
std::bitset<LATTE_NUM_MAX_TEX_UNITS> textureUnitMask2; std::bitset<LATTE_NUM_MAX_TEX_UNITS> textureUnitMask2;
uint16 textureUnitSamplerAssignment[LATTE_NUM_MAX_TEX_UNITS]; // LATTE_DECOMPILER_SAMPLER_NONE means undefined uint16 textureUnitSamplerAssignment[LATTE_NUM_MAX_TEX_UNITS]{ 0 }; // LATTE_DECOMPILER_SAMPLER_NONE means undefined
bool textureUsesDepthCompare[LATTE_NUM_MAX_TEX_UNITS]; bool textureUsesDepthCompare[LATTE_NUM_MAX_TEX_UNITS]{};
// analyzer stage (pixel outputs) // analyzer stage (pixel outputs)
uint32 pixelColorOutputMask; // from LSB to MSB, 1 bit per written output. 1 if written (indices of color attachments) uint32 pixelColorOutputMask{ 0 }; // from LSB to MSB, 1 bit per written output. 1 if written (indices of color attachments)
// analyzer stage (geometry shader parameters/inputs) // analyzer stage (geometry shader parameters/inputs)
uint32 ringParameterCount; uint32 ringParameterCount{ 0 };
uint32 ringParameterCountFromPrevStage; // used in geometry shader to hold VS ringParameterCount uint32 ringParameterCountFromPrevStage{ 0 }; // used in geometry shader to hold VS ringParameterCount
// analyzer stage (misc) // analyzer stage (misc)
std::bitset<LATTE_NUM_STREAMOUT_BUFFER> streamoutBufferWriteMask; std::bitset<LATTE_NUM_STREAMOUT_BUFFER> streamoutBufferWriteMask;
bool hasStreamoutBufferWrite; bool hasStreamoutBufferWrite{ false };
// output code // output code
class StringBuf* strBuf_shaderSource{ nullptr }; class StringBuf* strBuf_shaderSource{ nullptr };
// separable shaders // separable shaders
RendererShader* shader; RendererShader* shader{ nullptr };
bool isCustomShader; bool isCustomShader{ false };
uint32 outputParameterMask; uint32 outputParameterMask{ 0 };
// resource mapping (binding points) // resource mapping (binding points)
LatteDecompilerShaderResourceMapping resourceMapping; LatteDecompilerShaderResourceMapping resourceMapping{};
// uniforms // uniforms
struct struct
{ {
@ -210,7 +210,7 @@ struct LatteDecompilerShader
sint32 loc_verticesPerInstance; sint32 loc_verticesPerInstance;
sint32 loc_streamoutBufferBase[LATTE_NUM_STREAMOUT_BUFFER]; sint32 loc_streamoutBufferBase[LATTE_NUM_STREAMOUT_BUFFER];
sint32 uniformRangeSize; // entire size of uniform variable block sint32 uniformRangeSize; // entire size of uniform variable block
}uniform; }uniform{ 0 };
// fast access // fast access
struct _RemappedUniformBufferGroup struct _RemappedUniformBufferGroup
{ {

View File

@ -309,7 +309,10 @@ namespace LatteDecompiler
if (decompilerContext->options->spirvInstrinsics.hasRoundingModeRTEFloat32) if (decompilerContext->options->spirvInstrinsics.hasRoundingModeRTEFloat32)
{ {
src->add("#extension GL_EXT_spirv_intrinsics: enable" _CRLF); src->add("#extension GL_EXT_spirv_intrinsics: enable" _CRLF);
src->add("spirv_execution_mode(4462, 32);" _CRLF); // RoundingModeRTE 32 // set RoundingModeRTE
src->add("spirv_execution_mode(4462, 16);" _CRLF);
src->add("spirv_execution_mode(4462, 32);" _CRLF);
src->add("spirv_execution_mode(4462, 64);" _CRLF);
} }
src->add("#else" _CRLF); src->add("#else" _CRLF);
// OpenGL defines // OpenGL defines

View File

@ -17,7 +17,7 @@ uint32 RendererShader::GeneratePrecompiledCacheId()
v += (EMULATOR_VERSION_MINOR * 100u); v += (EMULATOR_VERSION_MINOR * 100u);
// settings that can influence shaders // settings that can influence shaders
v += (uint32)g_current_game_profile->GetAccurateShaderMul() * 133; // this option modifies shaders v += (uint32)g_current_game_profile->GetAccurateShaderMul() * 133;
return v; return v;
} }

View File

@ -228,7 +228,7 @@ void TextureRelationViewerWindow::_setTextureRelationListItemTexture(wxListCtrl*
uiList->SetItem(rowIndex, columnIndex, tempStr); uiList->SetItem(rowIndex, columnIndex, tempStr);
columnIndex++; columnIndex++;
// tilemode // tilemode
sprintf(tempStr, "%d", texInfo->tileMode); sprintf(tempStr, "%d", (int)texInfo->tileMode);
uiList->SetItem(rowIndex, columnIndex, tempStr); uiList->SetItem(rowIndex, columnIndex, tempStr);
columnIndex++; columnIndex++;
// sliceRange // sliceRange