[vulkan] Fixing some incongruences with pipeline keys and dynamic state flags

This commit is contained in:
CamilleLaVey 2026-02-16 03:36:09 -04:00 committed by crueter
parent 795be82f02
commit ff12dcaf0b
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
3 changed files with 16 additions and 5 deletions

View File

@ -686,9 +686,9 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
.viewportCount = num_viewports,
.viewportCount = key.state.extended_dynamic_state ? 0u : num_viewports,
.pViewports = nullptr,
.scissorCount = num_viewports,
.scissorCount = key.state.extended_dynamic_state ? 0u : num_viewports,
.pScissors = nullptr,
};
if (device.IsNvViewportSwizzleSupported()) {

View File

@ -92,6 +92,12 @@ public:
bool UsesExtendedDynamicState() const noexcept {
return key.state.extended_dynamic_state != 0;
}
bool UsesExtendedDynamicState2() const noexcept {
return key.state.extended_dynamic_state_2 != 0;
}
bool UsesExtendedDynamicState2LogicOp() const noexcept {
return key.state.extended_dynamic_state_2_logic_op != 0;
}
GraphicsPipeline& operator=(GraphicsPipeline&&) noexcept = delete;
GraphicsPipeline(GraphicsPipeline&&) noexcept = delete;

View File

@ -277,6 +277,10 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
if (!pipeline->Configure(is_indexed))
return;
if (pipeline->UsesExtendedDynamicState()) {
state_tracker.InvalidateStateEnableFlag();
}
UpdateDynamicStates();
HandleTransformFeedback();
@ -1064,6 +1068,7 @@ bool AccelerateDMA::BufferToImage(const Tegra::DMA::ImageCopy& copy_info,
void RasterizerVulkan::UpdateDynamicStates() {
auto& regs = maxwell3d->regs;
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline();
// Core Dynamic States (Vulkan 1.0) - Always active regardless of dyna_state setting
UpdateViewportsState(regs);
@ -1076,7 +1081,7 @@ void RasterizerVulkan::UpdateDynamicStates() {
UpdateLineStipple(regs);
// EDS1: CullMode, DepthCompare, FrontFace, StencilOp, DepthBoundsTest, DepthTest, DepthWrite, StencilTest
if (device.IsExtExtendedDynamicStateSupported()) {
if (device.IsExtExtendedDynamicStateSupported() && pipeline && pipeline->UsesExtendedDynamicState()) {
UpdateCullMode(regs);
UpdateDepthCompareOp(regs);
UpdateFrontFace(regs);
@ -1091,14 +1096,14 @@ void RasterizerVulkan::UpdateDynamicStates() {
}
// EDS2: PrimitiveRestart, RasterizerDiscard, DepthBias enable/disable
if (device.IsExtExtendedDynamicState2Supported()) {
if (device.IsExtExtendedDynamicState2Supported() && pipeline && pipeline->UsesExtendedDynamicState2()) {
UpdatePrimitiveRestartEnable(regs);
UpdateRasterizerDiscardEnable(regs);
UpdateDepthBiasEnable(regs);
}
// EDS2 Extras: LogicOp operation selection
if (device.IsExtExtendedDynamicState2ExtrasSupported()) {
if (device.IsExtExtendedDynamicState2ExtrasSupported() && pipeline && pipeline->UsesExtendedDynamicState2LogicOp()) {
UpdateLogicOp(regs);
}