mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-19 07:43:35 +00:00
Fix and enable background compute shader compilation
Also disables warnings from shader cache pipeline misses.
This commit is contained in:
parent
d31360e7da
commit
088ea4545c
6 changed files with 15 additions and 18 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue