Fix some validation errors around extended dynamic state

This commit is contained in:
gdk 2021-12-12 23:33:44 -03:00 committed by riperiperi
parent 4d94b03622
commit f6a4fe8f5f
3 changed files with 25 additions and 10 deletions

View file

@ -1103,7 +1103,7 @@ namespace Ryujinx.Graphics.Vulkan
var pipeline = pbp == PipelineBindPoint.Compute
? _newState.CreateComputePipeline(Gd.Api, Device, _program, _pipelineCache)
: _newState.CreateGraphicsPipeline(Gd.Api, Device, _program, _pipelineCache, _renderPass.Get(Cbs).Value);
: _newState.CreateGraphicsPipeline(Gd, Device, _program, _pipelineCache, _renderPass.Get(Cbs).Value);
ulong pipelineHandle = pipeline.GetUnsafe().Value.Handle;

View file

@ -329,7 +329,7 @@ namespace Ryujinx.Graphics.Vulkan
}
public unsafe Auto<DisposablePipeline> CreateGraphicsPipeline(
Vk api,
VulkanGraphicsDevice gd,
Device device,
ShaderCollection program,
PipelineCache cache,
@ -467,9 +467,10 @@ namespace Ryujinx.Graphics.Vulkan
if (VulkanConfiguration.UseDynamicState)
{
const int DynamicStates = 7;
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
int dynamicStatesCount = supportsExtDynamicState ? 8 : 7;
DynamicState* dynamicStates = stackalloc DynamicState[DynamicStates];
DynamicState* dynamicStates = stackalloc DynamicState[dynamicStatesCount];
dynamicStates[0] = DynamicState.Viewport;
dynamicStates[1] = DynamicState.Scissor;
@ -479,10 +480,15 @@ namespace Ryujinx.Graphics.Vulkan
dynamicStates[5] = DynamicState.StencilWriteMask;
dynamicStates[6] = DynamicState.StencilReference;
if (supportsExtDynamicState)
{
dynamicStates[7] = DynamicState.VertexInputBindingStrideExt;
}
var pipelineDynamicStateCreateInfo = new PipelineDynamicStateCreateInfo()
{
SType = StructureType.PipelineDynamicStateCreateInfo,
DynamicStateCount = DynamicStates,
DynamicStateCount = (uint)dynamicStatesCount,
PDynamicStates = dynamicStates
};
@ -508,10 +514,10 @@ namespace Ryujinx.Graphics.Vulkan
BasePipelineIndex = -1
};
api.CreateGraphicsPipelines(device, cache, 1, &pipelineCreateInfo, null, &pipelineHandle).ThrowOnError();
gd.Api.CreateGraphicsPipelines(device, cache, 1, &pipelineCreateInfo, null, &pipelineHandle).ThrowOnError();
}
pipeline = new Auto<DisposablePipeline>(new DisposablePipeline(api, device, pipelineHandle));
pipeline = new Auto<DisposablePipeline>(new DisposablePipeline(gd.Api, device, pipelineHandle));
program.AddGraphicsPipeline(ref Internal, pipeline);

View file

@ -39,8 +39,10 @@ namespace Ryujinx.Graphics.Vulkan
"UNASSIGNED-CoreValidation-Shader-OutputNotConsumed",
// TODO: Figure out if fixable
"VUID-vkCmdDrawIndexed-None-04584",
// TODO: might be worth looking into making this happy to possibly optimize copies.
"UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout"
// TODO: Might be worth looking into making this happy to possibly optimize copies.
"UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout",
// TODO: Fix this, it's causing too much noise right now.
"VUID-VkSubpassDependency-srcSubpass-00867"
};
public static Instance CreateInstance(Vk api, GraphicsDebugLevel logLevel, string[] requiredExtensions, out ExtDebugReport debugReport, out DebugReportCallbackEXT debugReportCallback)
@ -365,10 +367,17 @@ namespace Ryujinx.Graphics.Vulkan
NullDescriptor = true
};
var featuresExtendedDynamicState = new PhysicalDeviceExtendedDynamicStateFeaturesEXT()
{
SType = StructureType.PhysicalDeviceExtendedDynamicStateFeaturesExt,
PNext = &featuresRobustness2,
ExtendedDynamicState = supportedExtensions.Contains(ExtExtendedDynamicState.ExtensionName)
};
var featuresVk12 = new PhysicalDeviceVulkan12Features()
{
SType = StructureType.PhysicalDeviceVulkan12Features,
PNext = &featuresRobustness2,
PNext = &featuresExtendedDynamicState,
DrawIndirectCount = supportedExtensions.Contains(KhrDrawIndirectCount.ExtensionName)
};