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

@ -43,6 +43,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
context.AppendLine("#extension GL_INTEL_fragment_shader_ordering : enable"); context.AppendLine("#extension GL_INTEL_fragment_shader_ordering : enable");
} }
} }
else
{
context.AppendLine("#extension GL_ARB_shader_viewport_layer_array : enable");
}
if (context.Config.GpPassthrough) 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)); shift = context.ShiftLeftLogical(context.TypeU32(), shift, context.Constant(context.TypeU32(), (SpvLiteralInteger)1));
var lutIdx = context.ShiftRightLogical(context.TypeU32(), mask, shift); var lutIdx = context.ShiftRightLogical(context.TypeU32(), mask, shift);
var xLutValue = context.AccessChain(context.TypeFP32(), xLut, lutIdx); var xLutValue = context.VectorExtractDynamic(context.TypeFP32(), xLut, lutIdx);
var yLutValue = context.AccessChain(context.TypeFP32(), yLut, lutIdx); var yLutValue = context.VectorExtractDynamic(context.TypeFP32(), yLut, lutIdx);
var xResult = context.FMul(context.TypeFP32(), x, xLutValue); var xResult = context.FMul(context.TypeFP32(), x, xLutValue);
var yResult = context.FMul(context.TypeFP32(), y, yLutValue); var yResult = context.FMul(context.TypeFP32(), y, yLutValue);

View file

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