aboutsummaryrefslogtreecommitdiff
path: root/cube/cube.c
diff options
context:
space:
mode:
authorJoshua Ashton <joshua@froggi.es>2020-04-02 06:07:47 +0100
committerjeremyk-lunarg <jeremyk@lunarg.com>2020-04-06 13:54:26 -0600
commitf002f7dad7fbe0b6f9457605b3d2968f00643aa9 (patch)
tree46f9b73d8e8b244a3edb913f753591bcfaec6084 /cube/cube.c
parent698d82e38b39e94bf4d6013bcb2347813a69d78b (diff)
downloadusermoji-f002f7dad7fbe0b6f9457605b3d2968f00643aa9.tar.xz
cube: Remove unncessary VK_FORMAT_UNDEFINED check for surface formats
From the spec: The number of format pairs supported must be greater than or equal to 1. pSurfaceFormats must not contain an entry whose value for format is VK_FORMAT_UNDEFINED.
Diffstat (limited to 'cube/cube.c')
-rw-r--r--cube/cube.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/cube/cube.c b/cube/cube.c
index 83c53180..7de8e268 100644
--- a/cube/cube.c
+++ b/cube/cube.c
@@ -3489,15 +3489,8 @@ static void demo_init_vk_swapchain(struct demo *demo) {
VkSurfaceFormatKHR *surfFormats = (VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR));
err = demo->fpGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface, &formatCount, surfFormats);
assert(!err);
- // If the format list includes just one entry of VK_FORMAT_UNDEFINED,
- // the surface has no preferred format. Otherwise, at least one
- // supported format will be returned.
- if (formatCount == 1 && surfFormats[0].format == VK_FORMAT_UNDEFINED) {
- demo->format = VK_FORMAT_B8G8R8A8_UNORM;
- } else {
- assert(formatCount >= 1);
- demo->format = surfFormats[0].format;
- }
+ assert(formatCount >= 1);
+ demo->format = surfFormats[0].format;
demo->color_space = surfFormats[0].colorSpace;
free(surfFormats);