mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 22:28:32 +09:00
[Fix] (MG_Backend/DirectVulkan): fix present mode pick logic
This commit is contained in:
@@ -338,11 +338,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
|
|
||||||
VkPresentModeKHR VulkanRenderer::ChooseSwapchainPresentMode(
|
VkPresentModeKHR VulkanRenderer::ChooseSwapchainPresentMode(
|
||||||
const Vector<VkPresentModeKHR>& availablePresentModes) {
|
const Vector<VkPresentModeKHR>& availablePresentModes) {
|
||||||
for (const auto& presentMode : availablePresentModes) {
|
for (auto desiredPresentMode : s_desiredPresentModes) {
|
||||||
if (presentMode == VK_PRESENT_MODE_IMMEDIATE_KHR) {
|
for (const auto& presentMode : availablePresentModes) {
|
||||||
return presentMode;
|
if (presentMode == desiredPresentMode) {
|
||||||
} else if (presentMode == VK_PRESENT_MODE_MAILBOX_KHR) {
|
return presentMode;
|
||||||
return presentMode;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
#define ENUM_STR_CASE(c) case c: return #c;
|
#define ENUM_STR_CASE(c) case c: return #c;
|
||||||
|
|
||||||
namespace MobileGL::MG_Backend::DirectVulkan {
|
namespace MobileGL::MG_Backend::DirectVulkan {
|
||||||
class VulkanContext;
|
|
||||||
class SwapchainManager;
|
|
||||||
class PipelineManager;
|
|
||||||
struct FrameContext;
|
|
||||||
|
|
||||||
using RenderCallback = std::function<void(VkCommandBuffer cmdBuf, uint32_t imageIndex, VkExtent2D extent)>;
|
using RenderCallback = std::function<void(VkCommandBuffer cmdBuf, uint32_t imageIndex, VkExtent2D extent)>;
|
||||||
|
|
||||||
struct RendererConfig {
|
struct RendererConfig {
|
||||||
@@ -119,6 +114,12 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
static Bool GetMoreCapablePhysicalDevice(VkPhysicalDevice newVkDevice, VkSurfaceKHR surface, const PhysicalDevice& compareWithDevice, PhysicalDevice& outBetterDevice);
|
static Bool GetMoreCapablePhysicalDevice(VkPhysicalDevice newVkDevice, VkSurfaceKHR surface, const PhysicalDevice& compareWithDevice, PhysicalDevice& outBetterDevice);
|
||||||
static VkSurfaceFormatKHR ChooseSwapchainSurfaceFormat(const Vector<VkSurfaceFormatKHR>& availableFormats);
|
static VkSurfaceFormatKHR ChooseSwapchainSurfaceFormat(const Vector<VkSurfaceFormatKHR>& availableFormats);
|
||||||
static VkPresentModeKHR ChooseSwapchainPresentMode(const Vector<VkPresentModeKHR>& availablePresentModes);
|
static VkPresentModeKHR ChooseSwapchainPresentMode(const Vector<VkPresentModeKHR>& availablePresentModes);
|
||||||
|
static constexpr VkPresentModeKHR s_desiredPresentModes[] {
|
||||||
|
VK_PRESENT_MODE_MAILBOX_KHR,
|
||||||
|
VK_PRESENT_MODE_IMMEDIATE_KHR,
|
||||||
|
VK_PRESENT_MODE_FIFO_RELAXED_KHR,
|
||||||
|
VK_PRESENT_MODE_FIFO_KHR
|
||||||
|
};
|
||||||
static constexpr const char* s_validationLayerNames[] = {
|
static constexpr const char* s_validationLayerNames[] = {
|
||||||
"VK_LAYER_KHRONOS_validation"
|
"VK_LAYER_KHRONOS_validation"
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user