From e9ed771b48c809e590c16268b950bab742974984 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Wed, 1 Dec 2021 22:59:31 +0530 Subject: [PATCH] Check for `supportsMultipleViewports` feature before usage If the host only supports a single viewport then we set `viewportCount` and `scissorCount` in `VkPipelineViewportStateCreateInfo` to 1. --- app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h | 4 ++++ app/src/main/cpp/skyline/gpu/quirk_manager.cpp | 3 ++- app/src/main/cpp/skyline/gpu/quirk_manager.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index c9a4b3d5..aecd93aa 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -43,6 +43,10 @@ namespace skyline::gpu::interconnect { public: GraphicsContext(GPU &gpu, soc::gm20b::ChannelContext &channelCtx, gpu::interconnect::CommandExecutor &executor) : gpu(gpu), channelCtx(channelCtx), executor(executor) { scissors.fill(DefaultScissor); + if (!gpu.quirks.supportsMultipleViewports) { + viewportState.viewportCount = 1; + viewportState.scissorCount = 1; + } u32 bindingIndex{}; for (auto &vertexBinding : vertexBindings) diff --git a/app/src/main/cpp/skyline/gpu/quirk_manager.cpp b/app/src/main/cpp/skyline/gpu/quirk_manager.cpp index e9075f47..f4da43e7 100644 --- a/app/src/main/cpp/skyline/gpu/quirk_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/quirk_manager.cpp @@ -39,12 +39,13 @@ namespace skyline { } FEAT_SET(vk::PhysicalDeviceFeatures2, features.logicOp, supportsLogicOp) + FEAT_SET(vk::PhysicalDeviceFeatures2, features.multiViewport, supportsMultipleViewports) FEAT_SET(vk::PhysicalDeviceVertexAttributeDivisorFeaturesEXT, vertexAttributeInstanceRateZeroDivisor, supportsVertexAttributeZeroDivisor) #undef FEAT_SET } std::string QuirkManager::Summary() { - return fmt::format("\n* Supports Last Provoking Vertex: {}\n* Supports Logical Operations: {}\n* Supports Vertex Attribute Divisor: {}\n* Supports Vertex Attribute Zero Divisor: {}", supportsLastProvokingVertex, supportsLogicOp, supportsVertexAttributeDivisor, supportsVertexAttributeZeroDivisor); + return fmt::format("\n* Supports Last Provoking Vertex: {}\n* Supports Logical Operations: {}\n* Supports Vertex Attribute Divisor: {}\n* Supports Vertex Attribute Zero Divisor: {}\n* Supports Multiple Viewports: {}", supportsLastProvokingVertex, supportsLogicOp, supportsVertexAttributeDivisor, supportsVertexAttributeZeroDivisor, supportsMultipleViewports); } } diff --git a/app/src/main/cpp/skyline/gpu/quirk_manager.h b/app/src/main/cpp/skyline/gpu/quirk_manager.h index 6b85a006..8e71889e 100644 --- a/app/src/main/cpp/skyline/gpu/quirk_manager.h +++ b/app/src/main/cpp/skyline/gpu/quirk_manager.h @@ -16,6 +16,7 @@ namespace skyline { bool supportsLogicOp{}; //!< If the device supports framebuffer logical operations during blending bool supportsVertexAttributeDivisor{}; //!< If the device supports a divisor for instance-rate vertex attributes (with VK_EXT_vertex_attribute_divisor) bool supportsVertexAttributeZeroDivisor{}; //!< If the device supports a zero divisor for instance-rate vertex attributes (with VK_EXT_vertex_attribute_divisor) + bool supportsMultipleViewports{}; //!< If the device supports more than one viewport QuirkManager() = default;