From a04d8fb5cf85e5ff565b145eb863179835fba2c4 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 14 Sep 2022 21:55:19 +0100 Subject: [PATCH] Setup minimal viewport Vulkan pipeline state --- .../gpu/interconnect/maxwell_3d/active_state.cpp | 3 +++ .../interconnect/maxwell_3d/pipeline_manager.cpp | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/active_state.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/active_state.cpp index 167b7701..4e729fa9 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/active_state.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/active_state.cpp @@ -196,6 +196,9 @@ namespace skyline::gpu::interconnect::maxwell3d { ViewportState::ViewportState(dirty::Handle dirtyHandle, DirtyManager &manager, const EngineRegisters &engine, u32 index) : engine{manager, dirtyHandle, engine}, index{index} {} void ViewportState::Flush(InterconnectContext &ctx, StateUpdateBuilder &builder) { + if (index != 0 && !ctx.gpu.traits.supportsMultipleViewports) + return; + if (!engine->viewportScaleOffsetEnable) // https://github.com/Ryujinx/Ryujinx/pull/3328 Logger::Warn("Viewport scale/offset disable is unimplemented"); diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp index f412b135..d12347fa 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/pipeline_manager.cpp @@ -475,16 +475,28 @@ namespace skyline::gpu::interconnect::maxwell3d { .pDynamicStates = dynamicStates.data() }; + // Dynamic state will be used instead of these + std::array emptyScissors{}; + std::array emptyViewports{}; + + vk::PipelineViewportStateCreateInfo viewportState{ + .viewportCount = static_cast(ctx.gpu.traits.supportsMultipleViewports ? engine::ViewportCount : 1), + .pViewports = emptyViewports.data(), + .scissorCount = static_cast(ctx.gpu.traits.supportsMultipleViewports ? engine::ViewportCount : 1), + .pScissors = emptyScissors.data(), + }; + return ctx.gpu.graphicsPipelineCache.GetCompiledPipeline(cache::GraphicsPipelineCache::PipelineState{ .shaderStages = shaderStageInfos, .vertexState = vertexInputState, .inputAssemblyState = inputAssemblyState, .tessellationState = tessellationState, - .viewportState = {}, + .viewportState = viewportState, .rasterizationState = rasterizationState, .multisampleState = multisampleState, .depthStencilState = depthStencilState, .colorBlendState = colorBlendState, + .dynamicState = dynamicState, .colorAttachments = colorAttachments, .depthStencilAttachment = depthAttachment, }, layoutBindings);