1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-25 20:16:01 +00:00
This commit is contained in:
sunshineinabox 2024-05-22 22:05:01 -07:00
parent 74a1ab031d
commit 0000a7ac9c
2 changed files with 40 additions and 16 deletions

View file

@ -1024,14 +1024,18 @@ namespace Ryujinx.Graphics.Vulkan
_newState.LogicOp = op.Convert();
}
// AMD has a bug where it enables logical operations even for float formats,
// so we need to force disable them here.
bool logicOpEnable = enable && (Gd.Vendor != Vendor.Amd || _newState.Internal.LogicOpsAllowed);
if (Gd.ExtendedDynamicState3Features.ExtendedDynamicState3LogicOpEnable)
{
DynamicState.SetLogicOpEnable(enable);
DynamicState.SetLogicOpEnable(logicOpEnable);
}
else
{
_newState.LogicOpEnable = enable;
_newState.LogicOpEnable = logicOpEnable;
}
SignalStateChange();

View file

@ -407,6 +407,7 @@ namespace Ryujinx.Graphics.Vulkan
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
bool supportsExtDynamicState2 = gd.Capabilities.SupportsExtendedDynamicState2;
bool supportsExtDynamicState3 = gd.Capabilities.SupportsExtendedDynamicState3;
fixed (VertexInputAttributeDescription* pVertexAttributeDescriptions = &Internal.VertexAttributeDescriptions[0])
@ -445,16 +446,24 @@ namespace Ryujinx.Graphics.Vulkan
var tessellationState = new PipelineTessellationStateCreateInfo
{
SType = StructureType.PipelineTessellationStateCreateInfo,
PatchControlPoints = PatchControlPoints,
};
if (!gd.ExtendedDynamicState2Features.ExtendedDynamicState2PatchControlPoints)
{
tessellationState.PatchControlPoints = PatchControlPoints;
}
var rasterizationState = new PipelineRasterizationStateCreateInfo
{
SType = StructureType.PipelineRasterizationStateCreateInfo,
DepthClampEnable = DepthClampEnable,
PolygonMode = PolygonMode,
};
if (!gd.ExtendedDynamicState3Features.ExtendedDynamicState3DepthClampEnable)
{
rasterizationState.DepthClampEnable = DepthClampEnable;
}
if (isMoltenVk)
{
//When widelines feature is not supported it must be 1.0f per spec.
@ -490,10 +499,18 @@ namespace Ryujinx.Graphics.Vulkan
SampleShadingEnable = false,
RasterizationSamples = TextureStorage.ConvertToSampleCountFlags(gd.Capabilities.SupportedSampleCounts, SamplesCount),
MinSampleShading = 1,
AlphaToCoverageEnable = AlphaToCoverageEnable,
AlphaToOneEnable = AlphaToOneEnable,
};
if (!gd.ExtendedDynamicState3Features.ExtendedDynamicState3AlphaToCoverageEnable)
{
multisampleState.AlphaToCoverageEnable = AlphaToCoverageEnable;
}
if (!gd.ExtendedDynamicState3Features.ExtendedDynamicState3AlphaToOneEnable)
{
multisampleState.AlphaToOneEnable = AlphaToOneEnable;
}
var depthStencilState = new PipelineDepthStencilStateCreateInfo
{
SType = StructureType.PipelineDepthStencilStateCreateInfo,
@ -516,19 +533,13 @@ namespace Ryujinx.Graphics.Vulkan
StencilFrontFailOp,
StencilFrontPassOp,
StencilFrontDepthFailOp,
StencilFrontCompareOp,
null,
null,
null);
StencilFrontCompareOp);
var stencilBack = new StencilOpState(
StencilBackFailOp,
StencilBackPassOp,
StencilBackDepthFailOp,
StencilBackCompareOp,
null,
null,
null);
StencilBackCompareOp);
depthStencilState.Front = stencilFront;
depthStencilState.Back = stencilBack;
@ -559,19 +570,27 @@ namespace Ryujinx.Graphics.Vulkan
}
}
// AMD has a bug where it enables logical operations even for float formats,
// so we need to force disable them here.
bool logicOpEnable = LogicOpEnable && (gd.Vendor != Vendor.Amd || Internal.LogicOpsAllowed);
var colorBlendState = new PipelineColorBlendStateCreateInfo
{
SType = StructureType.PipelineColorBlendStateCreateInfo,
LogicOpEnable = LogicOpEnable,
AttachmentCount = ColorBlendAttachmentStateCount,
PAttachments = pColorBlendAttachmentState,
};
if (!(supportsExtDynamicState2 && gd.ExtendedLogicOp))
if (!gd.ExtendedDynamicState2Features.ExtendedDynamicState2LogicOp)
{
colorBlendState.LogicOp = LogicOp;
}
if (!gd.ExtendedDynamicState3Features.ExtendedDynamicState3LogicOpEnable)
{
colorBlendState.LogicOpEnable = LogicOpEnable;
}
PipelineColorBlendAdvancedStateCreateInfoEXT colorBlendAdvancedState;
if (!AdvancedBlendSrcPreMultiplied ||
@ -733,6 +752,7 @@ namespace Ryujinx.Graphics.Vulkan
PDynamicStates = dynamicStates,
};
var pipelineCreateInfo = new GraphicsPipelineCreateInfo
{
SType = StructureType.GraphicsPipelineCreateInfo,