Allow skipping draws with broken pipeline variants on Vulkan (#5807)

* Allow skipping draws with broken pipeline variants on Vulkan

* Move IsLinked check to CreatePipeline

* Restore throw on error behaviour for background compile

* Can't remove SetAlphaTest pragmas yet

* Double new line
This commit is contained in:
gdkchan 2024-01-26 13:58:57 -03:00 committed by GitHub
parent a620cbcc90
commit b8d992e5a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 110 additions and 57 deletions

View file

@ -312,7 +312,6 @@ namespace Ryujinx.Graphics.Vulkan
}
public NativeArray<PipelineShaderStageCreateInfo> Stages;
public NativeArray<PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT> StageRequiredSubgroupSizes;
public PipelineLayout PipelineLayout;
public SpecData SpecializationData;
@ -321,16 +320,6 @@ namespace Ryujinx.Graphics.Vulkan
public void Initialize()
{
Stages = new NativeArray<PipelineShaderStageCreateInfo>(Constants.MaxShaderStages);
StageRequiredSubgroupSizes = new NativeArray<PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT>(Constants.MaxShaderStages);
for (int index = 0; index < Constants.MaxShaderStages; index++)
{
StageRequiredSubgroupSizes[index] = new PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT
{
SType = StructureType.PipelineShaderStageRequiredSubgroupSizeCreateInfoExt,
RequiredSubgroupSize = RequiredSubgroupSize,
};
}
AdvancedBlendSrcPreMultiplied = true;
AdvancedBlendDstPreMultiplied = true;
@ -397,7 +386,8 @@ namespace Ryujinx.Graphics.Vulkan
Device device,
ShaderCollection program,
PipelineCache cache,
RenderPass renderPass)
RenderPass renderPass,
bool throwOnError = false)
{
if (program.TryGetGraphicsPipeline(ref Internal, out var pipeline))
{
@ -630,7 +620,18 @@ namespace Ryujinx.Graphics.Vulkan
BasePipelineIndex = -1,
};
gd.Api.CreateGraphicsPipelines(device, cache, 1, &pipelineCreateInfo, null, &pipelineHandle).ThrowOnError();
Result result = gd.Api.CreateGraphicsPipelines(device, cache, 1, &pipelineCreateInfo, null, &pipelineHandle);
if (throwOnError)
{
result.ThrowOnError();
}
else if (result.IsError())
{
program.AddGraphicsPipeline(ref Internal, null);
return null;
}
// Restore previous blend enable values if we changed it.
while (blendEnables != 0)
@ -708,7 +709,6 @@ namespace Ryujinx.Graphics.Vulkan
public readonly void Dispose()
{
Stages.Dispose();
StageRequiredSubgroupSizes.Dispose();
}
}
}