Use aspects flags in more places
This commit is contained in:
parent
bd0737ba51
commit
24a49ea574
4 changed files with 28 additions and 33 deletions
12
src/Ryujinx.Graphics.Vulkan/FeedbackLoopAspects.cs
Normal file
12
src/Ryujinx.Graphics.Vulkan/FeedbackLoopAspects.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Graphics.Vulkan
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
internal enum FeedbackLoopAspects
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Color = 1 << 0,
|
||||||
|
Depth = 1 << 1,
|
||||||
|
}
|
||||||
|
}
|
|
@ -87,13 +87,6 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
private bool _tfEnabled;
|
private bool _tfEnabled;
|
||||||
private bool _tfActive;
|
private bool _tfActive;
|
||||||
|
|
||||||
[Flags]
|
|
||||||
private enum FeedbackLoopAspects
|
|
||||||
{
|
|
||||||
Color = 1 << 0,
|
|
||||||
Depth = 1 << 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
private FeedbackLoopAspects _feedbackLoop;
|
private FeedbackLoopAspects _feedbackLoop;
|
||||||
private bool _passWritesDepthStencil;
|
private bool _passWritesDepthStencil;
|
||||||
|
|
||||||
|
@ -1453,8 +1446,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
FramebufferParams.AddBindings();
|
FramebufferParams.AddBindings();
|
||||||
|
|
||||||
_newState.FeedbackLoopColor = false;
|
_newState.FeedbackLoopAspects = FeedbackLoopAspects.None;
|
||||||
_newState.FeedbackLoopDepth = false;
|
|
||||||
_bindingBarriersDirty = true;
|
_bindingBarriersDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1537,14 +1529,11 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
if (Gd.Capabilities.SupportsDynamicAttachmentFeedbackLoop)
|
if (Gd.Capabilities.SupportsDynamicAttachmentFeedbackLoop)
|
||||||
{
|
{
|
||||||
DynamicState.SetFeedbackLoop(
|
DynamicState.SetFeedbackLoop(aspects);
|
||||||
(aspects & FeedbackLoopAspects.Color) != 0,
|
|
||||||
(aspects & FeedbackLoopAspects.Depth) != 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_newState.FeedbackLoopColor = (aspects & FeedbackLoopAspects.Color) != 0;
|
_newState.FeedbackLoopAspects = aspects;
|
||||||
_newState.FeedbackLoopDepth = (aspects & FeedbackLoopAspects.Depth) != 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_feedbackLoop = aspects;
|
_feedbackLoop = aspects;
|
||||||
|
@ -1588,7 +1577,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
}
|
}
|
||||||
else if (_feedbackLoop != 0)
|
else if (_feedbackLoop != 0)
|
||||||
{
|
{
|
||||||
return ChangeFeedbackLoop(0);
|
return ChangeFeedbackLoop(FeedbackLoopAspects.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,8 +22,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
private Array4<float> _blendConstants;
|
private Array4<float> _blendConstants;
|
||||||
|
|
||||||
private bool _feedbackLoopColor;
|
private FeedbackLoopAspects _feedbackLoopAspects;
|
||||||
private bool _feedbackLoopDepth;
|
|
||||||
|
|
||||||
public uint ViewportsCount;
|
public uint ViewportsCount;
|
||||||
public Array16<Viewport> Viewports;
|
public Array16<Viewport> Viewports;
|
||||||
|
@ -104,10 +103,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFeedbackLoop(bool color, bool depth)
|
public void SetFeedbackLoop(FeedbackLoopAspects aspects)
|
||||||
{
|
{
|
||||||
_feedbackLoopColor = color;
|
_feedbackLoopAspects = aspects;
|
||||||
_feedbackLoopDepth = depth;
|
|
||||||
|
|
||||||
_dirty |= DirtyFlags.FeedbackLoop;
|
_dirty |= DirtyFlags.FeedbackLoop;
|
||||||
}
|
}
|
||||||
|
@ -192,9 +190,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
private readonly void RecordFeedbackLoop(ExtAttachmentFeedbackLoopDynamicState api, CommandBuffer commandBuffer)
|
private readonly void RecordFeedbackLoop(ExtAttachmentFeedbackLoopDynamicState api, CommandBuffer commandBuffer)
|
||||||
{
|
{
|
||||||
ImageAspectFlags aspects = _feedbackLoopColor ? ImageAspectFlags.ColorBit : 0;
|
ImageAspectFlags aspects = (_feedbackLoopAspects & FeedbackLoopAspects.Color) != 0 ? ImageAspectFlags.ColorBit : 0;
|
||||||
|
|
||||||
if (_feedbackLoopDepth)
|
if ((_feedbackLoopAspects & FeedbackLoopAspects.Depth) != 0)
|
||||||
{
|
{
|
||||||
aspects |= ImageAspectFlags.DepthBit | ImageAspectFlags.StencilBit;
|
aspects |= ImageAspectFlags.DepthBit | ImageAspectFlags.StencilBit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,16 +300,10 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
set => Internal.Id8 = (Internal.Id8 & 0xFFFFFFFFFFFFFFBF) | ((value ? 1UL : 0UL) << 6);
|
set => Internal.Id8 = (Internal.Id8 & 0xFFFFFFFFFFFFFFBF) | ((value ? 1UL : 0UL) << 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool FeedbackLoopColor
|
public FeedbackLoopAspects FeedbackLoopAspects
|
||||||
{
|
{
|
||||||
readonly get => ((Internal.Id8 >> 7) & 0x1) != 0UL;
|
readonly get => (FeedbackLoopAspects)((Internal.Id8 >> 7) & 0x3);
|
||||||
set => Internal.Id8 = (Internal.Id8 & 0xFFFFFFFFFFFFFF7F) | ((value ? 1UL : 0UL) << 7);
|
set => Internal.Id8 = (Internal.Id8 & 0xFFFFFFFFFFFFFE7F) | (((ulong)value) << 7);
|
||||||
}
|
|
||||||
|
|
||||||
public bool FeedbackLoopDepth
|
|
||||||
{
|
|
||||||
readonly get => ((Internal.Id8 >> 8) & 0x1) != 0UL;
|
|
||||||
set => Internal.Id8 = (Internal.Id8 & 0xFFFFFFFFFFFFFEFF) | ((value ? 1UL : 0UL) << 8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasTessellationControlShader;
|
public bool HasTessellationControlShader;
|
||||||
|
@ -612,12 +606,14 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
if (gd.Capabilities.SupportsAttachmentFeedbackLoop)
|
if (gd.Capabilities.SupportsAttachmentFeedbackLoop)
|
||||||
{
|
{
|
||||||
if (FeedbackLoopColor)
|
FeedbackLoopAspects aspects = FeedbackLoopAspects;
|
||||||
|
|
||||||
|
if ((aspects & FeedbackLoopAspects.Color) != 0)
|
||||||
{
|
{
|
||||||
flags |= PipelineCreateFlags.CreateColorAttachmentFeedbackLoopBitExt;
|
flags |= PipelineCreateFlags.CreateColorAttachmentFeedbackLoopBitExt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FeedbackLoopDepth)
|
if ((aspects & FeedbackLoopAspects.Depth) != 0)
|
||||||
{
|
{
|
||||||
flags |= PipelineCreateFlags.CreateDepthStencilAttachmentFeedbackLoopBitExt;
|
flags |= PipelineCreateFlags.CreateDepthStencilAttachmentFeedbackLoopBitExt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue