Setup minimal viewport Vulkan pipeline state

This commit is contained in:
Billy Laws 2022-09-14 21:55:19 +01:00
parent fe51db366b
commit a04d8fb5cf
2 changed files with 16 additions and 1 deletions

View File

@ -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");

View File

@ -475,16 +475,28 @@ namespace skyline::gpu::interconnect::maxwell3d {
.pDynamicStates = dynamicStates.data()
};
// Dynamic state will be used instead of these
std::array<vk::Rect2D, engine::ViewportCount> emptyScissors{};
std::array<vk::Viewport, engine::ViewportCount> emptyViewports{};
vk::PipelineViewportStateCreateInfo viewportState{
.viewportCount = static_cast<u32>(ctx.gpu.traits.supportsMultipleViewports ? engine::ViewportCount : 1),
.pViewports = emptyViewports.data(),
.scissorCount = static_cast<u32>(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);