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
|
struct HardwareCapabilities
|
||||||
{
|
{
|
||||||
public bool SupportsConditionalRendering { get; }
|
public readonly bool SupportsConditionalRendering;
|
||||||
public bool SupportsExtendedDynamicState { get; }
|
public readonly bool SupportsExtendedDynamicState;
|
||||||
public bool SupportsNullDescriptors { get; }
|
public readonly bool SupportsMultiView;
|
||||||
public bool SupportsTransformFeedback { get; }
|
public readonly bool SupportsNullDescriptors;
|
||||||
public bool SupportsTransformFeedbackQueries { get; }
|
public readonly bool SupportsTransformFeedback;
|
||||||
public bool SupportsGeometryShader { get; }
|
public readonly bool SupportsTransformFeedbackQueries;
|
||||||
public uint MinSubgroupSize { get; }
|
public readonly bool SupportsGeometryShader;
|
||||||
public uint MaxSubgroupSize { get; }
|
public readonly uint MinSubgroupSize;
|
||||||
public ShaderStageFlags RequiredSubgroupSizeStages { get; }
|
public readonly uint MaxSubgroupSize;
|
||||||
|
public readonly ShaderStageFlags RequiredSubgroupSizeStages;
|
||||||
|
|
||||||
public HardwareCapabilities(
|
public HardwareCapabilities(
|
||||||
bool supportsConditionalRendering,
|
bool supportsConditionalRendering,
|
||||||
bool supportsExtendedDynamicState,
|
bool supportsExtendedDynamicState,
|
||||||
|
bool supportsMultiView,
|
||||||
bool supportsNullDescriptors,
|
bool supportsNullDescriptors,
|
||||||
bool supportsTransformFeedback,
|
bool supportsTransformFeedback,
|
||||||
bool supportsTransformFeedbackQueries,
|
bool supportsTransformFeedbackQueries,
|
||||||
|
@ -27,6 +29,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
SupportsConditionalRendering = supportsConditionalRendering;
|
SupportsConditionalRendering = supportsConditionalRendering;
|
||||||
SupportsExtendedDynamicState = supportsExtendedDynamicState;
|
SupportsExtendedDynamicState = supportsExtendedDynamicState;
|
||||||
|
SupportsMultiView = supportsMultiView;
|
||||||
SupportsNullDescriptors = supportsNullDescriptors;
|
SupportsNullDescriptors = supportsNullDescriptors;
|
||||||
SupportsTransformFeedback = supportsTransformFeedback;
|
SupportsTransformFeedback = supportsTransformFeedback;
|
||||||
SupportsTransformFeedbackQueries = supportsTransformFeedbackQueries;
|
SupportsTransformFeedbackQueries = supportsTransformFeedbackQueries;
|
||||||
|
|
|
@ -641,7 +641,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
public void SetScissors(ReadOnlySpan<Rectangle<int>> regions)
|
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)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
ClearScissor = regions[0];
|
ClearScissor = regions[0];
|
||||||
|
@ -831,7 +832,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
// TODO: Remove first parameter.
|
// TODO: Remove first parameter.
|
||||||
public void SetViewports(int first, ReadOnlySpan<GAL.Viewport> viewports, bool disableTransform)
|
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)
|
static float Clamp(float value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,8 +165,17 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
pipeline.PrimitiveRestartEnable = state.PrimitiveRestartEnable;
|
pipeline.PrimitiveRestartEnable = state.PrimitiveRestartEnable;
|
||||||
pipeline.RasterizerDiscardEnable = state.RasterizerDiscard;
|
pipeline.RasterizerDiscardEnable = state.RasterizerDiscard;
|
||||||
pipeline.SamplesCount = (uint)state.SamplesCount;
|
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;
|
pipeline.DepthBiasEnable = state.BiasEnable != 0;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
private Window _window;
|
private Window _window;
|
||||||
|
|
||||||
internal FormatCapabilities FormatCapabilities { get; private set; }
|
internal FormatCapabilities FormatCapabilities { get; private set; }
|
||||||
internal HardwareCapabilities Capabilities { get; private set; }
|
internal HardwareCapabilities Capabilities;
|
||||||
|
|
||||||
internal Vk Api { get; private set; }
|
internal Vk Api { get; private set; }
|
||||||
internal KhrSurface SurfaceApi { get; private set; }
|
internal KhrSurface SurfaceApi { get; private set; }
|
||||||
|
@ -215,6 +215,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
Capabilities = new HardwareCapabilities(
|
Capabilities = new HardwareCapabilities(
|
||||||
supportedExtensions.Contains(ExtConditionalRendering.ExtensionName),
|
supportedExtensions.Contains(ExtConditionalRendering.ExtensionName),
|
||||||
supportedExtensions.Contains(ExtExtendedDynamicState.ExtensionName),
|
supportedExtensions.Contains(ExtExtendedDynamicState.ExtensionName),
|
||||||
|
features2.Features.MultiViewport,
|
||||||
featuresRobustness2.NullDescriptor,
|
featuresRobustness2.NullDescriptor,
|
||||||
supportsTransformFeedback,
|
supportsTransformFeedback,
|
||||||
propertiesTransformFeedback.TransformFeedbackQueries,
|
propertiesTransformFeedback.TransformFeedbackQueries,
|
||||||
|
|
Loading…
Reference in a new issue