Skip to content

Commit f261b16

Browse files
Reger95charles-lunarg
authored andcommitted
Make emulate_VK_EXT_surface_maintenance1 more comply to vk spec
The emulation function does not comply with specifications. The spec asks ```The implementation must include the present mode passed to VkSurfacePresentModeEXT in pPresentModes, unless presentModeCount is zero.``` But now the implementation here will always include the present mode regardless of whether presentModeCount is zero. According to spec ```If the value of presentModeCount is less than the number of compatible present modes that are supported, at most presentModeCount values will be written to pPresentModes.``` When presentModeCount is 0, at most 0 values will be written to pPresentModes, in other words the implementation should do nothing in this situation. This commit fixed the above issue.
1 parent 32e64d1 commit f261b16

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

loader/wsi.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,9 +2469,13 @@ void emulate_VK_EXT_surface_maintenance1(struct loader_icd_term *icd_term, const
24692469
VkSurfacePresentModeCompatibilityEXT *surface_present_mode_compatibility =
24702470
(VkSurfacePresentModeCompatibilityEXT *)void_pNext;
24712471
if (surface_present_mode_compatibility->pPresentModes) {
2472-
surface_present_mode_compatibility->pPresentModes[0] = present_mode;
2472+
if (surface_present_mode_compatibility->presentModeCount != 0) {
2473+
surface_present_mode_compatibility->pPresentModes[0] = present_mode;
2474+
surface_present_mode_compatibility->presentModeCount = 1;
2475+
}
2476+
} else {
2477+
surface_present_mode_compatibility->presentModeCount = 1;
24732478
}
2474-
surface_present_mode_compatibility->presentModeCount = 1;
24752479

24762480
} else if (out_structure.sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT) {
24772481
// Because there is no way to fill out the information faithfully, set scaled max/min image extent to the

0 commit comments

Comments
 (0)