SPIR-V: Fix SwizzleAdd and some validation errors

This commit is contained in:
gdk 2022-04-06 10:50:08 -03:00 committed by riperiperi
parent 90ae2dbf69
commit 2ef7622126
4 changed files with 22 additions and 8 deletions

View file

@ -30,8 +30,8 @@ namespace Ryujinx.Graphics.Gpu
/// <summary>
/// Enables or disables fast 2d engine texture copies entirely on CPU when possible.
/// Reduces stuttering and # of textures in games that copy textures around for streaming,
/// as textures will not need to be created for the copy, and the data does not need to be
/// Reduces stuttering and # of textures in games that copy textures around for streaming,
/// as textures will not need to be created for the copy, and the data does not need to be
/// flushed from GPU.
/// </summary>
public static bool Fast2DCopy = true;

View file

@ -43,6 +43,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
context.AppendLine("#extension GL_INTEL_fragment_shader_ordering : enable");
}
}
else
{
context.AppendLine("#extension GL_ARB_shader_viewport_layer_array : enable");
}
if (context.Config.GpPassthrough)
{

View file

@ -1300,8 +1300,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
shift = context.ShiftLeftLogical(context.TypeU32(), shift, context.Constant(context.TypeU32(), (SpvLiteralInteger)1));
var lutIdx = context.ShiftRightLogical(context.TypeU32(), mask, shift);
var xLutValue = context.AccessChain(context.TypeFP32(), xLut, lutIdx);
var yLutValue = context.AccessChain(context.TypeFP32(), yLut, lutIdx);
var xLutValue = context.VectorExtractDynamic(context.TypeFP32(), xLut, lutIdx);
var yLutValue = context.VectorExtractDynamic(context.TypeFP32(), yLut, lutIdx);
var xResult = context.FMul(context.TypeFP32(), x, xLutValue);
var yResult = context.FMul(context.TypeFP32(), y, yLutValue);
@ -1465,7 +1465,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
}
var vectorType = context.TypeVector(context.TypeS32(), count);
return context.ConstantComposite(vectorType, elems);
}
else

View file

@ -28,9 +28,11 @@ namespace Ryujinx.Graphics.Vulkan
ExtConditionalRendering.ExtensionName,
ExtExtendedDynamicState.ExtensionName,
KhrDrawIndirectCount.ExtensionName,
"VK_EXT_index_type_uint8",
"VK_EXT_custom_border_color",
"VK_EXT_robustness2"
"VK_EXT_fragment_shader_interlock",
"VK_EXT_index_type_uint8",
"VK_EXT_robustness2",
"VK_EXT_shader_subgroup_ballot"
};
private static readonly string[] _excludedMessages = new string[]
@ -340,6 +342,7 @@ namespace Ryujinx.Graphics.Vulkan
PipelineStatisticsQuery = true,
SamplerAnisotropy = true,
ShaderClipDistance = true,
ShaderFloat64 = true,
ShaderImageGatherExtended = true,
// ShaderStorageImageReadWithoutFormat = true,
// ShaderStorageImageWriteWithoutFormat = true,
@ -388,6 +391,13 @@ namespace Ryujinx.Graphics.Vulkan
DrawIndirectCount = supportedExtensions.Contains(KhrDrawIndirectCount.ExtensionName)
};
var featuresFragmentShaderInterlock = new PhysicalDeviceFragmentShaderInterlockFeaturesEXT()
{
SType = StructureType.PhysicalDeviceFragmentShaderInterlockFeaturesExt,
PNext = &featuresVk12,
FragmentShaderPixelInterlock = true
};
var enabledExtensions = _requiredExtensions.Union(_desirableExtensions.Intersect(supportedExtensions)).ToArray();
IntPtr* ppEnabledExtensions = stackalloc IntPtr[enabledExtensions.Length];
@ -400,7 +410,7 @@ namespace Ryujinx.Graphics.Vulkan
var deviceCreateInfo = new DeviceCreateInfo()
{
SType = StructureType.DeviceCreateInfo,
PNext = &featuresVk12,
PNext = supportedExtensions.Contains("VK_EXT_fragment_shader_interlock") ? &featuresFragmentShaderInterlock : &featuresVk12,
QueueCreateInfoCount = 1,
PQueueCreateInfos = &queueCreateInfo,
PpEnabledExtensionNames = (byte**)ppEnabledExtensions,