Compare commits

..

6 Commits

Author SHA1 Message Date
riperiperi
c48a75979f Fix Multithreaded Compilation of Shader Cache on OpenGL (#3540)
This was broken by the Vulkan changes - OpenGL was building host caches at boot on one thread, which is very notably slower than when it is multithreaded.

This was caused by trying to get the program binary immediately after compilation started, which blocks. Now it does it after compilation has completed.
2022-08-03 19:37:56 -03:00
Ac_K
842cb26ba5 Sfdnsres; Stub ResolverSetOptionRequest (#3493)
This PR stub ResolverSetOptionRequest (checked by RE), but the options parsing is still missing since we don't support it in our current code.

(Close #3479)
2022-08-03 00:10:28 +02:00
gdkchan
e235d5e7bb Fix resolution scale values not being updated (#3514) 2022-08-02 23:58:56 +02:00
gdkchan
ed0b10c81f Fix geometry shader passthrough fallback being used when feature is supported (#3525)
* Fix geometry shader passthrough fallback being used when feature is supported

* Shader cache version bump
2022-08-02 08:44:30 +02:00
riperiperi
f92650fcff SPIR-V: Initialize undefined variables with 0 (#3526)
* SPIR-V: Initialize undefined variables with a value

Changes undefined values on spir-v shaders (caused by phi nodes) to be initialized instead of truly undefined.

Fixes an issue with NVIDIA gpus seemingly not liking when a variable is _potentially_ undefined. Not sure about the details at the moment.

Fixes:
- Tilt shift blur effect in Link's Awakening (bottom of the screen)
- Potentially block flickering on newer NVIDIA gpus in Splatoon 2? Needs testing.

Testing is welcome.

* Update Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs

Co-authored-by: gdkchan <gab.dark.100@gmail.com>

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2022-08-02 08:11:10 +02:00
Mary-nyan
712361f6e1 vk: Workaround XCB not availaible on FlatHub build (#3515)
Update SPB to 0.0.4-build24 which hopefully fix the issue by checking
libX11-xcb presence.
2022-08-01 08:46:19 +02:00
8 changed files with 42 additions and 23 deletions

View File

@@ -34,7 +34,7 @@
<PackageReference Include="Silk.NET.Vulkan" Version="2.10.1" />
<PackageReference Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.10.1" />
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.10.1" />
<PackageReference Include="SPB" Version="0.0.4-build17" />
<PackageReference Include="SPB" Version="0.0.4-build24" />
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
</ItemGroup>

View File

@@ -50,8 +50,6 @@ namespace Ryujinx.Graphics.Gpu.Image
public int InvalidatedSequence;
public Texture CachedTexture;
public Sampler CachedSampler;
public int ScaleIndex;
public TextureUsageFlags UsageFlags;
}
private TextureState[] _textureState;
@@ -535,14 +533,12 @@ namespace Ryujinx.Graphics.Gpu.Image
// The texture is already bound.
state.CachedTexture.SynchronizeMemory();
if ((state.ScaleIndex != index || state.UsageFlags != usageFlags) &&
if ((usageFlags & TextureUsageFlags.NeedsScaleValue) != 0 &&
UpdateScale(state.CachedTexture, usageFlags, index, stage))
{
ITexture hostTextureRebind = state.CachedTexture.GetTargetTexture(bindingInfo.Target);
state.Texture = hostTextureRebind;
state.ScaleIndex = index;
state.UsageFlags = usageFlags;
_context.Renderer.Pipeline.SetTextureAndSampler(stage, bindingInfo.Binding, hostTextureRebind, state.Sampler);
}
@@ -573,7 +569,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
bool textureOrSamplerChanged = state.Texture != hostTexture || state.Sampler != hostSampler;
if ((state.ScaleIndex != index || state.UsageFlags != usageFlags || textureOrSamplerChanged) &&
if ((usageFlags & TextureUsageFlags.NeedsScaleValue) != 0 &&
UpdateScale(texture, usageFlags, index, stage))
{
hostTexture = texture?.GetTargetTexture(bindingInfo.Target);
@@ -583,9 +579,6 @@ namespace Ryujinx.Graphics.Gpu.Image
if (textureOrSamplerChanged)
{
state.Texture = hostTexture;
state.ScaleIndex = index;
state.UsageFlags = usageFlags;
state.Sampler = hostSampler;
_context.Renderer.Pipeline.SetTextureAndSampler(stage, bindingInfo.Binding, hostTexture, hostSampler);
@@ -666,7 +659,7 @@ namespace Ryujinx.Graphics.Gpu.Image
cachedTexture?.SignalModified();
}
if ((state.ScaleIndex != scaleIndex || state.UsageFlags != usageFlags) &&
if ((usageFlags & TextureUsageFlags.NeedsScaleValue) != 0 &&
UpdateScale(state.CachedTexture, usageFlags, scaleIndex, stage))
{
ITexture hostTextureRebind = state.CachedTexture.GetTargetTexture(bindingInfo.Target);
@@ -674,8 +667,6 @@ namespace Ryujinx.Graphics.Gpu.Image
Format format = bindingInfo.Format == 0 ? cachedTexture.Format : bindingInfo.Format;
state.Texture = hostTextureRebind;
state.ScaleIndex = scaleIndex;
state.UsageFlags = usageFlags;
_context.Renderer.Pipeline.SetImage(bindingInfo.Binding, hostTextureRebind, format);
}
@@ -713,7 +704,7 @@ namespace Ryujinx.Graphics.Gpu.Image
texture?.SignalModified();
}
if ((state.ScaleIndex != scaleIndex || state.UsageFlags != usageFlags || state.Texture != hostTexture) &&
if ((usageFlags & TextureUsageFlags.NeedsScaleValue) != 0 &&
UpdateScale(texture, usageFlags, scaleIndex, stage))
{
hostTexture = texture?.GetTargetTexture(bindingInfo.Target);
@@ -722,8 +713,6 @@ namespace Ryujinx.Graphics.Gpu.Image
if (state.Texture != hostTexture)
{
state.Texture = hostTexture;
state.ScaleIndex = scaleIndex;
state.UsageFlags = usageFlags;
Format format = bindingInfo.Format;

View File

@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
private const ushort FileFormatVersionMajor = 1;
private const ushort FileFormatVersionMinor = 2;
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
private const uint CodeGenVersion = 13;
private const uint CodeGenVersion = 3525;
private const string SharedTocFileName = "shared.toc";
private const string SharedDataFileName = "shared.data";

View File

@@ -434,7 +434,10 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
_needsHostRegen = true;
}
_programList.Add(entry.ProgramIndex, (entry.CachedProgram, entry.BinaryCode));
// Fetch the binary code from the backend if it isn't already present.
byte[] binaryCode = entry.BinaryCode ?? entry.CachedProgram.HostProgram.GetBinary();
_programList.Add(entry.ProgramIndex, (entry.CachedProgram, binaryCode));
SignalCompiled();
}
else if (entry.IsBinary)
@@ -502,7 +505,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
IProgram hostProgram = _context.Renderer.CreateProgram(shaderSources, shaderInfo);
CachedShaderProgram program = new CachedShaderProgram(hostProgram, compilation.SpecializationState, compilation.Shaders);
byte[] binaryCode = _context.Capabilities.Api == TargetApi.Vulkan ? ShaderBinarySerializer.Pack(shaderSources) : hostProgram.GetBinary();
// 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;
EnqueueForValidation(new ProgramEntry(program, binaryCode, compilation.ProgramIndex, compilation.IsCompute, isBinary: false));
}

View File

@@ -234,7 +234,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
IrOperandType.Constant => GetConstant(type, operand),
IrOperandType.ConstantBuffer => GetConstantBuffer(type, operand),
IrOperandType.LocalVariable => GetLocal(type, operand),
IrOperandType.Undefined => Undef(GetType(type)),
IrOperandType.Undefined => Constant(GetType(type), 0),
_ => throw new ArgumentException($"Invalid operand type \"{operand.Type}\".")
};
}

View File

@@ -248,7 +248,7 @@ namespace Ryujinx.Graphics.Shader.Translation
this.Copy(Attribute(index + 12), w);
}
if (Config.GpPassthrough)
if (Config.GpPassthrough && !Config.GpuAccessor.QueryHostSupportsGeometryShaderPassthrough())
{
int inputVertices = Config.GpuAccessor.QueryPrimitiveTopology().ToInputVertices();

View File

@@ -235,6 +235,32 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
return GetAddrInfoRequestImpl(context, outputBufferPosition, outputBufferSize, true, optionsBufferPosition, optionsBufferSize);
}
[CommandHipc(14)] // 5.0.0+
// ResolverSetOptionRequest(buffer<unknown, 5, 0>, u64 unknown, u64 pid_placeholder, pid) -> (i32 ret, u32 bsd_errno)
public ResultCode ResolverSetOptionRequest(ServiceCtx context)
{
ulong bufferPosition = context.Request.SendBuff[0].Position;
ulong bufferSize = context.Request.SendBuff[0].Size;
ulong unknown = context.RequestData.ReadUInt64();
byte[] buffer = new byte[bufferSize];
context.Memory.Read(bufferPosition, buffer);
// TODO: Parse and use options.
Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres, new { unknown });
NetDbError netDbErrorCode = NetDbError.Success;
GaiError errno = GaiError.Success;
context.ResponseData.Write((int)errno);
context.ResponseData.Write((int)netDbErrorCode);
return ResultCode.Success;
}
private static ResultCode GetHostByNameRequestImpl(
ServiceCtx context,
ulong inputBufferPosition,
@@ -615,7 +641,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
{
context.ResponseData.Write((int)netDbErrorCode);
context.ResponseData.Write((int)errno);
context.ResponseData.Write((int)serializedSize);
context.ResponseData.Write(serializedSize);
}
}

View File

@@ -23,7 +23,7 @@
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build10" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
<PackageReference Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
<PackageReference Include="OpenTK.Graphics" Version="4.7.2" />
<PackageReference Include="SPB" Version="0.0.4-build17" />
<PackageReference Include="SPB" Version="0.0.4-build24" />
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
</ItemGroup>