Match other code in project

This commit is contained in:
sunshineinabox 2024-08-01 19:17:59 -07:00
parent 9b02fd6dc0
commit fa801ba472
5 changed files with 26 additions and 24 deletions

View file

@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Vulkan
public readonly bool SupportsShaderStorageImageMultisample;
public readonly bool SupportsConditionalRendering;
public readonly bool SupportsExtendedDynamicState;
public readonly bool SupportsExtendedDynamicState2;
public readonly PhysicalDeviceExtendedDynamicState2FeaturesEXT SupportsExtendedDynamicState2;
public readonly bool SupportsMultiView;
public readonly bool SupportsNullDescriptors;
public readonly bool SupportsPushDescriptors;
@ -71,7 +71,7 @@ namespace Ryujinx.Graphics.Vulkan
bool supportsShaderStorageImageMultisample,
bool supportsConditionalRendering,
bool supportsExtendedDynamicState,
bool supportsExtendedDynamicState2,
PhysicalDeviceExtendedDynamicState2FeaturesEXT supportsExtendedDynamicState2,
bool supportsMultiView,
bool supportsNullDescriptors,
bool supportsPushDescriptors,

View file

@ -127,7 +127,7 @@ namespace Ryujinx.Graphics.Vulkan
_supportExtDynamic = gd.Capabilities.SupportsExtendedDynamicState;
_supportExtDynamic2 = gd.Capabilities.SupportsExtendedDynamicState2;
_supportExtDynamic2 = gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2;
_newState.Initialize();
}
@ -970,7 +970,7 @@ namespace Ryujinx.Graphics.Vulkan
_newState.LogicOpEnable = logicOpEnable;
if (Gd.ExtendedDynamicState2Features.ExtendedDynamicState2LogicOp)
if (Gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2LogicOp)
{
DynamicState.SetLogicOp(logicOpEnable ? op.Convert() : default);
}
@ -993,7 +993,7 @@ namespace Ryujinx.Graphics.Vulkan
public void SetPatchParameters(int vertices, ReadOnlySpan<float> defaultOuterLevel, ReadOnlySpan<float> defaultInnerLevel)
{
if (Gd.ExtendedDynamicState2Features.ExtendedDynamicState2PatchControlPoints && _newState.HasTessellationControlShader)
if (Gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2PatchControlPoints && _newState.HasTessellationControlShader)
{
DynamicState.SetPatchControlPoints((uint)vertices);
}

View file

@ -405,7 +405,7 @@ namespace Ryujinx.Graphics.Vulkan
}
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
bool supportsExtDynamicState2 = gd.Capabilities.SupportsExtendedDynamicState2;
bool supportsExtDynamicState2 = gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2;
fixed (VertexInputAttributeDescription* pVertexAttributeDescriptions = &Internal.VertexAttributeDescriptions[0])
fixed (VertexInputAttributeDescription* pVertexAttributeDescriptions2 = &_vertexAttributeDescriptions2[0])
@ -429,7 +429,7 @@ namespace Ryujinx.Graphics.Vulkan
PipelineTessellationStateCreateInfo tessellationState;
if (!gd.ExtendedDynamicState2Features.ExtendedDynamicState2PatchControlPoints)
if (!gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2PatchControlPoints)
{
tessellationState.SType = StructureType.PipelineTessellationStateCreateInfo;
tessellationState.PatchControlPoints = PatchControlPoints;
@ -545,7 +545,7 @@ namespace Ryujinx.Graphics.Vulkan
LogicOpEnable = LogicOpEnable,
};
if (!gd.ExtendedDynamicState2Features.ExtendedDynamicState2LogicOp)
if (!gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2LogicOp)
{
colorBlendState.LogicOp = LogicOp;
}
@ -609,11 +609,11 @@ namespace Ryujinx.Graphics.Vulkan
dynamicStates[currentIndex++] = DynamicState.RasterizerDiscardEnableExt;
dynamicStates[currentIndex++] = DynamicState.PrimitiveRestartEnableExt;
if (gd.ExtendedDynamicState2Features.ExtendedDynamicState2LogicOp)
if (gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2LogicOp)
{
dynamicStates[currentIndex++] = DynamicState.LogicOpExt;
}
if (gd.ExtendedDynamicState2Features.ExtendedDynamicState2PatchControlPoints && HasTessellationControlShader)
if (gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2PatchControlPoints && HasTessellationControlShader)
{
dynamicStates[currentIndex++] = DynamicState.PatchControlPointsExt;
}
@ -643,7 +643,7 @@ namespace Ryujinx.Graphics.Vulkan
RenderPass = renderPass,
};
if (!gd.ExtendedDynamicState2Features.ExtendedDynamicState2PatchControlPoints)
if (!gd.Capabilities.SupportsExtendedDynamicState2.ExtendedDynamicState2PatchControlPoints)
{
pipelineCreateInfo.PTessellationState = &tessellationState;
}

View file

@ -265,7 +265,7 @@ namespace Ryujinx.Graphics.Vulkan
return InvalidIndex;
}
internal static Device CreateDevice(Vk api, VulkanPhysicalDevice physicalDevice, uint queueFamilyIndex, uint queueCount, out PhysicalDeviceExtendedDynamicState2FeaturesEXT extendedDynamicState2Features)
internal static Device CreateDevice(Vk api, VulkanPhysicalDevice physicalDevice, uint queueFamilyIndex, uint queueCount)
{
if (queueCount > QueuesCount)
{
@ -472,16 +472,12 @@ namespace Ryujinx.Graphics.Vulkan
supportedFeaturesExtExtendedDynamicState2.ExtendedDynamicState2,
ExtendedDynamicState2LogicOp =
supportedFeaturesExtExtendedDynamicState2.ExtendedDynamicState2LogicOp,
ExtendedDynamicState2PatchControlPoints = supportedFeaturesExtExtendedDynamicState2
.ExtendedDynamicState2PatchControlPoints,
ExtendedDynamicState2PatchControlPoints = false,
};
pExtendedFeatures = &featuresExtendedDynamicState2;
}
extendedDynamicState2Features = supportedFeaturesExtExtendedDynamicState2;
var featuresVk11 = new PhysicalDeviceVulkan11Features
{
SType = StructureType.PhysicalDeviceVulkan11Features,

View file

@ -100,9 +100,6 @@ namespace Ryujinx.Graphics.Vulkan
public bool PreferThreading => true;
public PhysicalDeviceExtendedDynamicState2FeaturesEXT ExtendedDynamicState2Features;
public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;
public VulkanRenderer(Vk api, Func<Instance, Vk, SurfaceKHR> surfaceFunc, Func<string[]> requiredExtensionsFunc, string preferredGpuId)
@ -232,6 +229,11 @@ namespace Ryujinx.Graphics.Vulkan
SType = StructureType.PhysicalDevicePrimitiveTopologyListRestartFeaturesExt,
};
PhysicalDeviceExtendedDynamicState2FeaturesEXT featuresExtendedDynamicState2 = new()
{
SType = StructureType.PhysicalDeviceExtendedDynamicState2FeaturesExt,
};
PhysicalDeviceRobustness2FeaturesEXT featuresRobustness2 = new()
{
SType = StructureType.PhysicalDeviceRobustness2FeaturesExt,
@ -262,6 +264,12 @@ namespace Ryujinx.Graphics.Vulkan
features2.PNext = &featuresPrimitiveTopologyListRestart;
}
if (_physicalDevice.IsDeviceExtensionPresent(ExtExtendedDynamicState2.ExtensionName))
{
featuresExtendedDynamicState2.PNext = features2.PNext;
features2.PNext = &featuresExtendedDynamicState2;
}
if (_physicalDevice.IsDeviceExtensionPresent("VK_EXT_robustness2"))
{
featuresRobustness2.PNext = features2.PNext;
@ -395,7 +403,7 @@ namespace Ryujinx.Graphics.Vulkan
features2.Features.ShaderStorageImageMultisample,
_physicalDevice.IsDeviceExtensionPresent(ExtConditionalRendering.ExtensionName),
_physicalDevice.IsDeviceExtensionPresent(ExtExtendedDynamicState.ExtensionName),
_physicalDevice.IsDeviceExtensionPresent(ExtExtendedDynamicState2.ExtensionName),
featuresExtendedDynamicState2,
features2.Features.MultiViewport && !(IsMoltenVk && Vendor == Vendor.Amd), // Workaround for AMD on MoltenVK issue
featuresRobustness2.NullDescriptor || IsMoltenVk,
supportsPushDescriptors && !IsMoltenVk,
@ -460,9 +468,7 @@ namespace Ryujinx.Graphics.Vulkan
var queueFamilyIndex = VulkanInitialization.FindSuitableQueueFamily(Api, _physicalDevice, _surface, out uint maxQueueCount);
_device = VulkanInitialization.CreateDevice(Api, _physicalDevice, queueFamilyIndex, maxQueueCount, out PhysicalDeviceExtendedDynamicState2FeaturesEXT extendedDynamicState2Features);
ExtendedDynamicState2Features = extendedDynamicState2Features;
_device = VulkanInitialization.CreateDevice(Api, _physicalDevice, queueFamilyIndex, maxQueueCount);
if (Api.TryGetDeviceExtension(_instance.Instance, _device, out KhrSwapchain swapchainApi))
{