diff --git a/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp b/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp index fb7773cb1..5a78b976c 100644 --- a/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp +++ b/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp @@ -607,7 +607,7 @@ void VulkanDevice::WaitPresented(std::uint64_t id) { ShaderRecompiler::SpirvTarget VulkanDevice::Target() const { const auto& limits = state->properties.limits; - ShaderRecompiler::SpirvTarget target{VK_API_VERSION_1_1, state->meshShader ? 0x00010400u : 0x00010300u, state->subgroup.subgroupSize, ShaderRecompiler::BdaAbi::Version, state->capabilities, state->spirvExtensions, {limits.maxComputeWorkGroupSize[0], limits.maxComputeWorkGroupSize[1], limits.maxComputeWorkGroupSize[2]}, limits.maxComputeWorkGroupInvocations, limits.maxComputeSharedMemorySize, {}, {}}; + ShaderRecompiler::SpirvTarget target{VK_API_VERSION_1_1, state->meshShader ? 0x00010400u : 0x00010300u, state->subgroup.subgroupSize, ShaderRecompiler::BdaAbi::Version, state->capabilities, state->spirvExtensions, false, {limits.maxComputeWorkGroupSize[0], limits.maxComputeWorkGroupSize[1], limits.maxComputeWorkGroupSize[2]}, limits.maxComputeWorkGroupInvocations, limits.maxComputeSharedMemorySize, {}, {}}; if (state->meshShader) { const auto& mesh = state->meshLimits; target.mesh = ShaderRecompiler::MeshTargetLimits{{mesh.maxMeshWorkGroupSize[0], mesh.maxMeshWorkGroupSize[1], mesh.maxMeshWorkGroupSize[2]}, mesh.maxMeshWorkGroupInvocations, std::min(mesh.maxMeshSharedMemorySize, mesh.maxMeshPayloadAndSharedMemorySize), mesh.maxMeshOutputVertices, mesh.maxMeshOutputPrimitives, mesh.maxMeshOutputComponents, std::min(mesh.maxMeshOutputMemorySize, mesh.maxMeshPayloadAndOutputMemorySize), mesh.meshOutputPerVertexGranularity, mesh.meshOutputPerPrimitiveGranularity}; diff --git a/core/libs/prx/libSceAgcDriver/tests/BdaContracts.cpp b/core/libs/prx/libSceAgcDriver/tests/BdaContracts.cpp index 8b2e33e07..14c6348d8 100644 --- a/core/libs/prx/libSceAgcDriver/tests/BdaContracts.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/BdaContracts.cpp @@ -43,6 +43,7 @@ void RunBdaContractTests() { request.target.bdaAbiVersion = BdaAbi::Version; request.target.supportedCapabilities = capabilities; request.target.supportedExtensions = extensions; + request.target.fragmentShaderBarycentricEnabled = false; const RequestSerializer serializer; const auto encoded = serializer.Serialize(request); const auto decoded = serializer.Deserialize(encoded); diff --git a/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp b/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp index 27e3a628e..53eecebce 100644 --- a/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp @@ -72,6 +72,7 @@ int main() { request.target.vulkanVersion = 0x00401000u; request.target.spirvVersion = 0x00010300u; request.target.subgroupSize = 64; + request.target.fragmentShaderBarycentricEnabled = false; request.layout.pushConstantSizeBytes = 128; expectFailure([&] { static_cast(Recompile(request)); }, "SrtWalker::EvaluateRuntimeSources", "missing snapshot unexpectedly read live memory"); diff --git a/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp b/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp index 131ebc888..855d4c99b 100644 --- a/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp +++ b/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp @@ -525,6 +525,7 @@ void writeSpirvTarget(Writer& writer, const SpirvTarget& target) { for (const std::string_view extension : target.supportedExtensions) { writer.WriteString(extension); } + writer.WriteBool(target.fragmentShaderBarycentricEnabled); for (const std::uint32_t value : target.maxWorkgroupSize) { writer.WriteU32(value); } @@ -557,6 +558,7 @@ SpirvTarget readSpirvTarget(Reader& reader, DeserializedRequest& result) { result.supportedExtensions.push_back(result.supportedExtensionStorage.back()); } target.supportedExtensions = result.supportedExtensions; + target.fragmentShaderBarycentricEnabled = reader.ReadBool(); for (std::uint32_t& value : target.maxWorkgroupSize) { value = reader.ReadU32(); } diff --git a/core/shader/recompiler/Recompiler.cpp b/core/shader/recompiler/Recompiler.cpp index 2b7af2ad5..4f2f2f5e7 100644 --- a/core/shader/recompiler/Recompiler.cpp +++ b/core/shader/recompiler/Recompiler.cpp @@ -72,6 +72,7 @@ IrProgram PrepareResourceProgram(const RecompileRequest& request) { translateOptions.userDataBaseRegister = request.context.userDataBaseRegister; translateOptions.userDataCount = static_cast(request.context.userData.size()); translateOptions.embeddedFetch = nullptr; + translateOptions.fragmentShaderBarycentricEnabled = request.target.fragmentShaderBarycentricEnabled; translateOptions.inputInfo = inputInfo; constexpr InstructionTranslator translator; diff --git a/core/shader/recompiler/Recompiler.hpp b/core/shader/recompiler/Recompiler.hpp index 1cce45163..659a5664d 100644 --- a/core/shader/recompiler/Recompiler.hpp +++ b/core/shader/recompiler/Recompiler.hpp @@ -126,6 +126,7 @@ struct SpirvTarget { std::uint32_t bdaAbiVersion; std::span supportedCapabilities; std::span supportedExtensions; + bool fragmentShaderBarycentricEnabled; std::array maxWorkgroupSize; std::uint32_t maxWorkgroupInvocations; std::uint32_t maxWorkgroupSharedMemoryBytes; diff --git a/core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp b/core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp index 0a07802a3..ff4d76e02 100644 --- a/core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp +++ b/core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp @@ -30,6 +30,7 @@ struct TranslateOptions { std::uint32_t userDataCount = 64; std::uint32_t scratchDwords = 0; std::uint64_t shaderHash = 0; + bool fragmentShaderBarycentricEnabled = false; ShaderStageInputInfo inputInfo; const EmbeddedFetchPlan* embeddedFetch = nullptr; }; diff --git a/core/shader/recompiler/Translation/src/InstructionTranslator.cpp b/core/shader/recompiler/Translation/src/InstructionTranslator.cpp index 077c2afeb..a16586b29 100644 --- a/core/shader/recompiler/Translation/src/InstructionTranslator.cpp +++ b/core/shader/recompiler/Translation/src/InstructionTranslator.cpp @@ -297,7 +297,7 @@ void emitEntryPrologue(IrProgram& program, IrBlock& entryBlock, const TranslateO entryIr.SetVectorReg(static_cast(8), builtin(StageInputKind::PrimitiveId)); } else if (options.stage == ShaderStageKind::Pixel) { const auto* ps = options.inputInfo.pixel; - if (ps->psPerspectiveCenterVgpr != std::numeric_limits::max()) { + if (options.fragmentShaderBarycentricEnabled && ps->psPerspectiveCenterVgpr != std::numeric_limits::max()) { entryIr.SetVectorReg(static_cast(ps->psPerspectiveCenterVgpr), builtin(StageInputKind::BaryCoordSmooth, 0u)); entryIr.SetVectorReg(static_cast(ps->psPerspectiveCenterVgpr + 1u), builtin(StageInputKind::BaryCoordSmooth, 1u)); }