mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-19 21:28:50 +00:00
c/main: Clarify in code that it is preferred dimensions (NFC)
This commit is contained in:
parent
ceb6c8b3fe
commit
5915318654
|
@ -60,8 +60,8 @@ comp_target_swapchain_destroy_old(struct comp_target_swapchain *cts, VkSwapchain
|
||||||
static VkExtent2D
|
static VkExtent2D
|
||||||
comp_target_swapchain_select_extent(struct comp_target_swapchain *cts,
|
comp_target_swapchain_select_extent(struct comp_target_swapchain *cts,
|
||||||
VkSurfaceCapabilitiesKHR caps,
|
VkSurfaceCapabilitiesKHR caps,
|
||||||
uint32_t width,
|
uint32_t preferred_width,
|
||||||
uint32_t height);
|
uint32_t preferred_height);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
_find_surface_format(struct comp_target_swapchain *cts, VkSurfaceKHR surface, VkSurfaceFormatKHR *format);
|
_find_surface_format(struct comp_target_swapchain *cts, VkSurfaceKHR surface, VkSurfaceFormatKHR *format);
|
||||||
|
@ -84,8 +84,8 @@ get_vk(struct comp_target_swapchain *cts)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
comp_target_swapchain_create_images(struct comp_target *ct,
|
comp_target_swapchain_create_images(struct comp_target *ct,
|
||||||
uint32_t width,
|
uint32_t preferred_width,
|
||||||
uint32_t height,
|
uint32_t preferred_height,
|
||||||
VkFormat color_format,
|
VkFormat color_format,
|
||||||
VkColorSpaceKHR color_space,
|
VkColorSpaceKHR color_space,
|
||||||
VkPresentModeKHR present_mode)
|
VkPresentModeKHR present_mode)
|
||||||
|
@ -150,7 +150,7 @@ comp_target_swapchain_create_images(struct comp_target *ct,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the extents of the swapchain.
|
// Get the extents of the swapchain.
|
||||||
VkExtent2D extent = comp_target_swapchain_select_extent(cts, surface_caps, width, height);
|
VkExtent2D extent = comp_target_swapchain_select_extent(cts, surface_caps, preferred_width, preferred_height);
|
||||||
|
|
||||||
if (surface_caps.currentTransform & VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR ||
|
if (surface_caps.currentTransform & VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR ||
|
||||||
surface_caps.currentTransform & VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR) {
|
surface_caps.currentTransform & VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR) {
|
||||||
|
@ -212,24 +212,26 @@ comp_target_swapchain_create_images(struct comp_target *ct,
|
||||||
static VkExtent2D
|
static VkExtent2D
|
||||||
comp_target_swapchain_select_extent(struct comp_target_swapchain *cts,
|
comp_target_swapchain_select_extent(struct comp_target_swapchain *cts,
|
||||||
VkSurfaceCapabilitiesKHR caps,
|
VkSurfaceCapabilitiesKHR caps,
|
||||||
uint32_t width,
|
uint32_t preferred_width,
|
||||||
uint32_t height)
|
uint32_t preferred_height)
|
||||||
{
|
{
|
||||||
// If width (and height) equals the special value 0xFFFFFFFF,
|
// If width (and height) equals the special value 0xFFFFFFFF,
|
||||||
// the size of the surface will be set by the swapchain
|
// the size of the surface will be set by the swapchain
|
||||||
if (caps.currentExtent.width == (uint32_t)-1) {
|
if (caps.currentExtent.width == (uint32_t)-1) {
|
||||||
VkExtent2D extent = {
|
VkExtent2D extent = {
|
||||||
.width = width,
|
.width = preferred_width,
|
||||||
.height = height,
|
.height = preferred_height,
|
||||||
};
|
};
|
||||||
return extent;
|
return extent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caps.currentExtent.width != width || caps.currentExtent.height != height) {
|
if (caps.currentExtent.width != preferred_width || //
|
||||||
COMP_DEBUG(cts->base.c,
|
caps.currentExtent.height != preferred_height) {
|
||||||
"Using swap chain extent dimensions %dx%d instead "
|
COMP_DEBUG(cts->base.c, "Using swap chain extent dimensions %dx%d instead of requested %dx%d.",
|
||||||
"of requested %dx%d.",
|
caps.currentExtent.width, //
|
||||||
caps.currentExtent.width, caps.currentExtent.height, width, height);
|
caps.currentExtent.height, //
|
||||||
|
preferred_width, //
|
||||||
|
preferred_height); //
|
||||||
}
|
}
|
||||||
|
|
||||||
return caps.currentExtent;
|
return caps.currentExtent;
|
||||||
|
|
Loading…
Reference in a new issue