From 33ce657f80710e81ac6e1e145cf0d346d6e2f9c8 Mon Sep 17 00:00:00 2001 From: sunshineinabox Date: Tue, 15 Aug 2023 13:38:45 -0700 Subject: [PATCH] Fix oversight packing/unpacking --- .../Shader/DiskCache/DiskCacheHostStorage.cs | 2 +- .../Shader/DiskCache/ParallelDiskCacheLoader.cs | 2 +- src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs index 9afc5b618..7d64bdf67 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs @@ -381,7 +381,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache IProgram hostProgram; - if (context.Capabilities.Api == TargetApi.Vulkan) + if (context.Capabilities.Api == TargetApi.Vulkan || GraphicsConfig.EnableOGLSpirV) { ShaderSource[] shaderSources = ShaderBinarySerializer.Unpack(shaders, hostCode); diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs index 8c2108bfa..5fcb0f913 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs @@ -504,7 +504,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache CachedShaderProgram program = new(hostProgram, compilation.SpecializationState, compilation.Shaders); // Vulkan's binary code is the SPIR-V used for compilation, so it is ready immediately. Other APIs get this after compilation. - byte[] binaryCode = _context.Capabilities.Api == TargetApi.Vulkan ? ShaderBinarySerializer.Pack(shaderSources) : null; + byte[] binaryCode = (_context.Capabilities.Api == TargetApi.Vulkan || GraphicsConfig.EnableOGLSpirV) ? ShaderBinarySerializer.Pack(shaderSources) : null; EnqueueForValidation(new ProgramEntry(program, binaryCode, compilation.ProgramIndex, compilation.IsCompute, isBinary: false)); } diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index 51257adfa..28d478639 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -490,7 +490,7 @@ namespace Ryujinx.Graphics.Gpu.Shader { if (_diskCacheHostStorage.CacheEnabled) { - byte[] binaryCode = _context.Capabilities.Api == TargetApi.Vulkan ? ShaderBinarySerializer.Pack(sources) : null; + byte[] binaryCode = (_context.Capabilities.Api == TargetApi.Vulkan || GraphicsConfig.EnableOGLSpirV) ? ShaderBinarySerializer.Pack(sources) : null; ProgramToSave programToSave = new(program, hostProgram, binaryCode); _programsToSaveQueue.Enqueue(programToSave);