mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-21 16:43:35 +00:00
If MultiViewport is not supported, do not try to set more than one viewport/scissor
This commit is contained in:
parent
74a8f37f8d
commit
1fac9dc29b
4 changed files with 29 additions and 14 deletions
|
@ -4,19 +4,21 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
struct HardwareCapabilities
|
||||
{
|
||||
public bool SupportsConditionalRendering { get; }
|
||||
public bool SupportsExtendedDynamicState { get; }
|
||||
public bool SupportsNullDescriptors { get; }
|
||||
public bool SupportsTransformFeedback { get; }
|
||||
public bool SupportsTransformFeedbackQueries { get; }
|
||||
public bool SupportsGeometryShader { get; }
|
||||
public uint MinSubgroupSize { get; }
|
||||
public uint MaxSubgroupSize { get; }
|
||||
public ShaderStageFlags RequiredSubgroupSizeStages { get; }
|
||||
public readonly bool SupportsConditionalRendering;
|
||||
public readonly bool SupportsExtendedDynamicState;
|
||||
public readonly bool SupportsMultiView;
|
||||
public readonly bool SupportsNullDescriptors;
|
||||
public readonly bool SupportsTransformFeedback;
|
||||
public readonly bool SupportsTransformFeedbackQueries;
|
||||
public readonly bool SupportsGeometryShader;
|
||||
public readonly uint MinSubgroupSize;
|
||||
public readonly uint MaxSubgroupSize;
|
||||
public readonly ShaderStageFlags RequiredSubgroupSizeStages;
|
||||
|
||||
public HardwareCapabilities(
|
||||
bool supportsConditionalRendering,
|
||||
bool supportsExtendedDynamicState,
|
||||
bool supportsMultiView,
|
||||
bool supportsNullDescriptors,
|
||||
bool supportsTransformFeedback,
|
||||
bool supportsTransformFeedbackQueries,
|
||||
|
@ -27,6 +29,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
SupportsConditionalRendering = supportsConditionalRendering;
|
||||
SupportsExtendedDynamicState = supportsExtendedDynamicState;
|
||||
SupportsMultiView = supportsMultiView;
|
||||
SupportsNullDescriptors = supportsNullDescriptors;
|
||||
SupportsTransformFeedback = supportsTransformFeedback;
|
||||
SupportsTransformFeedbackQueries = supportsTransformFeedbackQueries;
|
||||
|
|
|
@ -641,7 +641,8 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
public void SetScissors(ReadOnlySpan<Rectangle<int>> regions)
|
||||
{
|
||||
int count = Math.Min(Constants.MaxViewports, regions.Length);
|
||||
int maxScissors = Gd.Capabilities.SupportsMultiView ? Constants.MaxViewports : 1;
|
||||
int count = Math.Min(maxScissors, regions.Length);
|
||||
if (count > 0)
|
||||
{
|
||||
ClearScissor = regions[0];
|
||||
|
@ -831,7 +832,8 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
// TODO: Remove first parameter.
|
||||
public void SetViewports(int first, ReadOnlySpan<GAL.Viewport> viewports, bool disableTransform)
|
||||
{
|
||||
int count = Math.Min(Constants.MaxViewports, viewports.Length);
|
||||
int maxViewports = Gd.Capabilities.SupportsMultiView ? Constants.MaxViewports : 1;
|
||||
int count = Math.Min(maxViewports, viewports.Length);
|
||||
|
||||
static float Clamp(float value)
|
||||
{
|
||||
|
|
|
@ -165,8 +165,17 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
pipeline.PrimitiveRestartEnable = state.PrimitiveRestartEnable;
|
||||
pipeline.RasterizerDiscardEnable = state.RasterizerDiscard;
|
||||
pipeline.SamplesCount = (uint)state.SamplesCount;
|
||||
pipeline.ScissorsCount = 16;
|
||||
pipeline.ViewportsCount = 16;
|
||||
|
||||
if (gd.Capabilities.SupportsMultiView)
|
||||
{
|
||||
pipeline.ScissorsCount = Constants.MaxViewports;
|
||||
pipeline.ViewportsCount = Constants.MaxViewports;
|
||||
}
|
||||
else
|
||||
{
|
||||
pipeline.ScissorsCount = 1;
|
||||
pipeline.ViewportsCount = 1;
|
||||
}
|
||||
|
||||
pipeline.DepthBiasEnable = state.BiasEnable != 0;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
private Window _window;
|
||||
|
||||
internal FormatCapabilities FormatCapabilities { get; private set; }
|
||||
internal HardwareCapabilities Capabilities { get; private set; }
|
||||
internal HardwareCapabilities Capabilities;
|
||||
|
||||
internal Vk Api { get; private set; }
|
||||
internal KhrSurface SurfaceApi { get; private set; }
|
||||
|
@ -215,6 +215,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
Capabilities = new HardwareCapabilities(
|
||||
supportedExtensions.Contains(ExtConditionalRendering.ExtensionName),
|
||||
supportedExtensions.Contains(ExtExtendedDynamicState.ExtensionName),
|
||||
features2.Features.MultiViewport,
|
||||
featuresRobustness2.NullDescriptor,
|
||||
supportsTransformFeedback,
|
||||
propertiesTransformFeedback.TransformFeedbackQueries,
|
||||
|
|
Loading…
Reference in a new issue