From 0a608fb4b21a8163e2ba08010e7fef7a3ba26be2 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 8 Jan 2023 19:30:19 +0000 Subject: [PATCH] Update to latest hades --- app/libraries/shader-compiler | 2 +- .../skyline/gpu/pipeline_cache_manager.cpp | 2 +- .../main/cpp/skyline/gpu/shader_manager.cpp | 25 ++++++++++++++++--- app/src/main/cpp/skyline/gpu/shader_manager.h | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/app/libraries/shader-compiler b/app/libraries/shader-compiler index 58ae23f7..ffcaed48 160000 --- a/app/libraries/shader-compiler +++ b/app/libraries/shader-compiler @@ -1 +1 @@ -Subproject commit 58ae23f7dbd87eaf40f90ba90e4d8aa2c29d363c +Subproject commit ffcaed48cd067a4e720740c09578641d29043c0d diff --git a/app/src/main/cpp/skyline/gpu/pipeline_cache_manager.cpp b/app/src/main/cpp/skyline/gpu/pipeline_cache_manager.cpp index 11a93e29..87b1f13b 100644 --- a/app/src/main/cpp/skyline/gpu/pipeline_cache_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/pipeline_cache_manager.cpp @@ -8,7 +8,7 @@ namespace skyline::gpu { struct PipelineCacheFileHeader { static constexpr u32 Magic{util::MakeMagic("PCHE")}; //!< The magic value used to identify a pipeline cache file - static constexpr u32 Version{1}; //!< The version of the pipeline cache file format, MUST be incremented for any format changes + static constexpr u32 Version{2}; //!< The version of the pipeline cache file format, MUST be incremented for any format changes u32 magic{Magic}; u32 version{Version}; diff --git a/app/src/main/cpp/skyline/gpu/shader_manager.cpp b/app/src/main/cpp/skyline/gpu/shader_manager.cpp index 2082c54c..88135b82 100644 --- a/app/src/main/cpp/skyline/gpu/shader_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/shader_manager.cpp @@ -83,7 +83,7 @@ namespace skyline::gpu { .support_snorm_render_buffer = true, .support_viewport_index_layer = gpu.traits.supportsShaderViewportIndexLayer, .min_ssbo_alignment = traits.minimumStorageBufferAlignment, - .support_geometry_passthrough = false + .support_geometry_shader_passthrough = false }; constexpr u32 TegraX1WarpSize{32}; //!< The amount of threads in a warp on the Tegra X1 @@ -121,6 +121,7 @@ namespace skyline::gpu { .has_broken_spirv_position_input = traits.quirks.brokenSpirvPositionInput, .has_broken_spirv_subgroup_mask_vector_extract_dynamic = traits.quirks.brokenSubgroupMaskExtractDynamic, .has_broken_spirv_subgroup_shuffle = traits.quirks.brokenSubgroupShuffle, + .max_subgroup_size = traits.subgroupSize, }; Shader::Settings::values = { @@ -164,6 +165,7 @@ namespace skyline::gpu { stage = pStage; sph = *reinterpret_cast(binary.data()); start_address = baseOffset; + is_propietary_driver = textureBufferIndex == 2; } [[nodiscard]] u64 ReadInstruction(u32 address) final { @@ -205,6 +207,14 @@ namespace skyline::gpu { return {0, 0, 0}; // Only relevant for compute shaders } + [[nodiscard]] bool HasHLEMacroState() const final { + return false; + } + + [[nodiscard]] std::optional GetReplaceConstBuffer(u32 bank, u32 offset) final { + return std::nullopt; + } + void Dump(u64 hash) final {} }; @@ -239,6 +249,7 @@ namespace skyline::gpu { getTextureType{std::move(getTextureType)} { stage = Shader::Stage::Compute; start_address = baseOffset; + is_propietary_driver = textureBufferIndex == 2; } [[nodiscard]] u64 ReadInstruction(u32 address) final { @@ -280,6 +291,14 @@ namespace skyline::gpu { return workgroupDimensions; } + [[nodiscard]] bool HasHLEMacroState() const final { + return false; + } + + [[nodiscard]] std::optional GetReplaceConstBuffer(u32 bank, u32 offset) final { + return std::nullopt; + } + void Dump(u64 hash) final {} }; @@ -383,13 +402,13 @@ namespace skyline::gpu { return Shader::Maxwell::TranslateProgram(instructionPool, blockPool, environment, cfg, hostTranslateInfo); } - vk::ShaderModule ShaderManager::CompileShader(const Shader::RuntimeInfo &runtimeInfo, Shader::IR::Program &program, Shader::Backend::Bindings &bindings) { + vk::ShaderModule ShaderManager::CompileShader(const Shader::RuntimeInfo &runtimeInfo, Shader::IR::Program &program, Shader::Backend::Bindings &bindings, u64 hash) { std::scoped_lock lock{poolMutex}; if (program.info.loads.Legacy() || program.info.stores.Legacy()) Shader::Maxwell::ConvertLegacyToGeneric(program, runtimeInfo); - auto spirv{Shader::Backend::SPIRV::EmitSPIRV(profile, runtimeInfo, program, bindings)}; + auto spirv{Shader::Backend::SPIRV::EmitSPIRV(profile, runtimeInfo, program, bindings, fmt::format("shader_{:016X}", hash))}; vk::ShaderModuleCreateInfo createInfo{ .pCode = spirv.data(), diff --git a/app/src/main/cpp/skyline/gpu/shader_manager.h b/app/src/main/cpp/skyline/gpu/shader_manager.h index c430a51d..aad432a7 100644 --- a/app/src/main/cpp/skyline/gpu/shader_manager.h +++ b/app/src/main/cpp/skyline/gpu/shader_manager.h @@ -68,7 +68,7 @@ namespace skyline::gpu { Shader::IR::Program ParseComputeShader(u64 hash, span binary, u32 baseOffset, u32 textureConstantBufferIndex, u32 localMemorySize, u32 sharedMemorySize, std::array workgroupDimensions, const ConstantBufferRead &constantBufferRead, const GetTextureType &getTextureType); - vk::ShaderModule CompileShader(const Shader::RuntimeInfo &runtimeInfo, Shader::IR::Program &program, Shader::Backend::Bindings &bindings); + vk::ShaderModule CompileShader(const Shader::RuntimeInfo &runtimeInfo, Shader::IR::Program &program, Shader::Backend::Bindings &bindings, u64 hash = 0); void ResetPools(); };