mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-13 03:36:39 +00:00
The task isn't required for loading compute binary.
This commit is contained in:
parent
a0aa09912c
commit
35eac315ab
1 changed files with 26 additions and 27 deletions
|
@ -168,29 +168,34 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
ShaderProgram program = null;
|
||||
ShaderProgramInfo shaderProgramInfo = null;
|
||||
|
||||
Task compileTask = Task.Run(() =>
|
||||
{
|
||||
// Reconstruct code holder.
|
||||
if (isHostProgramValid)
|
||||
{
|
||||
// Reconstruct code holder.
|
||||
|
||||
program = new ShaderProgram(entry.Header.Stage, "");
|
||||
shaderProgramInfo = hostShaderEntries[0].ToShaderProgramInfo();
|
||||
|
||||
ShaderCodeHolder shader = new ShaderCodeHolder(program, shaderProgramInfo, entry.Code);
|
||||
|
||||
_cpProgramsDiskCache.Add(key, new ShaderBundle(hostProgram, shader));
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the host program was rejected by the gpu driver or isn't in cache, try to build from program sources again.
|
||||
|
||||
Task compileTask = Task.Run(() =>
|
||||
{
|
||||
IGpuAccessor gpuAccessor = new CachedGpuAccessor(_context, entry.Code, entry.Header.GpuAccessorHeader, entry.TextureDescriptors);
|
||||
|
||||
program = Translator.CreateContext(0, gpuAccessor, DefaultFlags | TranslationFlags.Compute).Translate(out shaderProgramInfo);
|
||||
}
|
||||
});
|
||||
|
||||
task.OnTask(compileTask, (bool _, ShaderCompileTask task) =>
|
||||
{
|
||||
ShaderCodeHolder shader = new ShaderCodeHolder(program, shaderProgramInfo, entry.Code);
|
||||
|
||||
// If the host program was rejected by the gpu driver or isn't in cache, try to build from program sources again.
|
||||
if (!isHostProgramValid)
|
||||
{
|
||||
Logger.Info?.Print(LogClass.Gpu, $"Host shader {key} got invalidated, rebuilding from guest...");
|
||||
|
||||
// Compile shader and create program as the shader program binary got invalidated.
|
||||
|
@ -222,16 +227,10 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
});
|
||||
|
||||
return false; // Not finished: still need to compile the host program.
|
||||
}
|
||||
else
|
||||
{
|
||||
_cpProgramsDiskCache.Add(key, new ShaderBundle(hostProgram, shader));
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return false; // Not finished: translating the shaders.
|
||||
return false; // Not finished: translating the program.
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -394,7 +393,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
}
|
||||
});
|
||||
|
||||
return false; // Not finished: translating the shaders.
|
||||
return false; // Not finished: translating the program.
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue