diff --git a/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs b/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs index fb3db8e6d..f05f37c9f 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs @@ -263,11 +263,6 @@ namespace Ryujinx.Graphics.GAL.Multithreading { var program = new ThreadedProgram(this); - if (info.State.HasValue) - { - info.BackgroundCompile = true; - } - SourceProgramRequest request = new SourceProgramRequest(program, shaders, info); Programs.Add(request); diff --git a/Ryujinx.Graphics.GAL/ShaderInfo.cs b/Ryujinx.Graphics.GAL/ShaderInfo.cs index f7be8b39b..b4c871178 100644 --- a/Ryujinx.Graphics.GAL/ShaderInfo.cs +++ b/Ryujinx.Graphics.GAL/ShaderInfo.cs @@ -4,20 +4,20 @@ namespace Ryujinx.Graphics.GAL { public int FragmentOutputMap { get; } public ProgramPipelineState? State { get; } - public bool BackgroundCompile { get; set; } + public bool FromCache { get; set; } - public ShaderInfo(int fragmentOutputMap, ProgramPipelineState state) + public ShaderInfo(int fragmentOutputMap, ProgramPipelineState state, bool fromCache = false) { FragmentOutputMap = fragmentOutputMap; State = state; - BackgroundCompile = false; + FromCache = fromCache; } - public ShaderInfo(int fragmentOutputMap) + public ShaderInfo(int fragmentOutputMap, bool fromCache = false) { FragmentOutputMap = fragmentOutputMap; State = null; - BackgroundCompile = false; + FromCache = fromCache; } } } \ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs index 77fcb256f..a25b2d9a4 100644 --- a/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs +++ b/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs @@ -374,8 +374,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache int fragmentOutputMap = hasFragmentShader ? shaders[5].Info.FragmentOutputMap : -1; ShaderInfo shaderInfo = specState.PipelineState.HasValue - ? new ShaderInfo(fragmentOutputMap, specState.PipelineState.Value) - : new ShaderInfo(fragmentOutputMap); + ? new ShaderInfo(fragmentOutputMap, specState.PipelineState.Value, fromCache: true) + : new ShaderInfo(fragmentOutputMap, fromCache: true); IProgram hostProgram; diff --git a/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs b/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs index 825119688..0b56419e6 100644 --- a/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs +++ b/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs @@ -495,8 +495,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache } ShaderInfo shaderInfo = compilation.SpecializationState.PipelineState.HasValue - ? new ShaderInfo(fragmentOutputMap, compilation.SpecializationState.PipelineState.Value) - : new ShaderInfo(fragmentOutputMap); + ? new ShaderInfo(fragmentOutputMap, compilation.SpecializationState.PipelineState.Value, fromCache: true) + : new ShaderInfo(fragmentOutputMap, fromCache: true); IProgram hostProgram = _context.Renderer.CreateProgram(shaderSources, shaderInfo); CachedShaderProgram program = new CachedShaderProgram(hostProgram, compilation.SpecializationState, compilation.Shaders); diff --git a/Ryujinx.Graphics.Vulkan/ShaderCollection.cs b/Ryujinx.Graphics.Vulkan/ShaderCollection.cs index 34f57c965..da765b847 100644 --- a/Ryujinx.Graphics.Vulkan/ShaderCollection.cs +++ b/Ryujinx.Graphics.Vulkan/ShaderCollection.cs @@ -128,12 +128,13 @@ namespace Ryujinx.Graphics.Vulkan VulkanGraphicsDevice gd, Device device, ShaderSource[] sources, - ProgramPipelineState state) : this(gd, device, sources) + ProgramPipelineState state, + bool fromCache) : this(gd, device, sources) { _state = state; _compileTask = BackgroundCompilation(); - _firstBackgroundUse = true; + _firstBackgroundUse = !fromCache; } private async Task BackgroundCompilation() @@ -220,6 +221,7 @@ namespace Ryujinx.Graphics.Vulkan pipeline.Stages[0] = _shaders[0].GetInfo(); pipeline.StagesCount = 1; + pipeline.PipelineLayout = PipelineLayout; pipeline.CreateComputePipeline(_gd, _device, this, (_gd.Pipeline as PipelineBase).PipelineCache); pipeline.Dispose(); diff --git a/Ryujinx.Graphics.Vulkan/VulkanGraphicsDevice.cs b/Ryujinx.Graphics.Vulkan/VulkanGraphicsDevice.cs index 4eec06824..3dc314cbc 100644 --- a/Ryujinx.Graphics.Vulkan/VulkanGraphicsDevice.cs +++ b/Ryujinx.Graphics.Vulkan/VulkanGraphicsDevice.cs @@ -309,9 +309,9 @@ namespace Ryujinx.Graphics.Vulkan { bool isCompute = sources.Length == 1 && sources[0].Stage == ShaderStage.Compute; - if (info.BackgroundCompile && (info.State.HasValue || isCompute) && VulkanConfiguration.UseDynamicState) + if ((info.State.HasValue || isCompute) && VulkanConfiguration.UseDynamicState) { - return new ShaderCollection(this, _device, sources, info.State.Value); + return new ShaderCollection(this, _device, sources, info.State ?? default, info.FromCache); } else {