Set a default topology state that can be overwritten later if needed.

This commit is contained in:
sunshineinabox 2024-08-12 20:57:08 -07:00
parent 1a43536092
commit 2d1af4ddb4
3 changed files with 8 additions and 3 deletions

View File

@ -1105,6 +1105,8 @@ namespace Ryujinx.Graphics.Vulkan
_newState.HasTessellationControlShader = internalProgram.HasTessellationControlShader; _newState.HasTessellationControlShader = internalProgram.HasTessellationControlShader;
_newState.StagesCount = (uint)stages.Length; _newState.StagesCount = (uint)stages.Length;
_newState.Topology = internalProgram.ShaderTopology;
stages.CopyTo(_newState.Stages.AsSpan()[..stages.Length]); stages.CopyTo(_newState.Stages.AsSpan()[..stages.Length]);
SignalStateChange(); SignalStateChange();

View File

@ -218,9 +218,7 @@ namespace Ryujinx.Graphics.Vulkan
pipeline.StencilBackDepthFailOp = extendedDynamicState ? 0 : state.StencilTest.BackDpFail.Convert(); pipeline.StencilBackDepthFailOp = extendedDynamicState ? 0 : state.StencilTest.BackDpFail.Convert();
pipeline.StencilBackCompareOp = extendedDynamicState ? 0 : state.StencilTest.BackFunc.Convert(); pipeline.StencilBackCompareOp = extendedDynamicState ? 0 : state.StencilTest.BackFunc.Convert();
var vkTopology = gd.TopologyRemap(state.Topology).Convert(); pipeline.Topology = gd.TopologyRemap(state.Topology).Convert();
pipeline.Topology = extendedDynamicState ? vkTopology.ConvertToClass() : vkTopology;
int vaCount = Math.Min(Constants.MaxVertexAttributes, state.VertexAttribCount); int vaCount = Math.Min(Constants.MaxVertexAttributes, state.VertexAttribCount);
int vbCount = Math.Min(Constants.MaxVertexBuffers, state.VertexBufferCount); int vbCount = Math.Min(Constants.MaxVertexBuffers, state.VertexBufferCount);

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using PrimitiveTopology = Silk.NET.Vulkan.PrimitiveTopology;
namespace Ryujinx.Graphics.Vulkan namespace Ryujinx.Graphics.Vulkan
{ {
@ -23,6 +24,8 @@ namespace Ryujinx.Graphics.Vulkan
public bool IsCompute { get; } public bool IsCompute { get; }
public bool HasTessellationControlShader => (Stages & (1u << 3)) != 0; public bool HasTessellationControlShader => (Stages & (1u << 3)) != 0;
public PrimitiveTopology ShaderTopology;
public bool UpdateTexturesWithoutTemplate { get; } public bool UpdateTexturesWithoutTemplate { get; }
public uint Stages { get; } public uint Stages { get; }
@ -551,6 +554,8 @@ namespace Ryujinx.Graphics.Vulkan
PipelineState pipeline = _state.ToVulkanPipelineState(_gd); PipelineState pipeline = _state.ToVulkanPipelineState(_gd);
ShaderTopology = pipeline.Topology;
// Copy the shader stage info to the pipeline. // Copy the shader stage info to the pipeline.
var stages = pipeline.Stages.AsSpan(); var stages = pipeline.Stages.AsSpan();