diff options
| author | Jeremy Hayes <jeremy@lunarg.com> | 2021-08-30 18:04:09 -0600 |
|---|---|---|
| committer | Jeremy Hayes <jeremy-lunarg@users.noreply.github.com> | 2021-08-31 10:02:30 -0600 |
| commit | cf9d49e46157b4c2a0dcf3051679d550c5fb20a1 (patch) | |
| tree | a8d32a8b9d85ff0eb79b0656eb867adbbfb06ea4 | |
| parent | 6c444b2c9f7b44fbfe246151d46f201cd1057000 (diff) | |
| download | usermoji-cf9d49e46157b4c2a0dcf3051679d550c5fb20a1.tar.xz | |
cubepp: Fix gitlab 828.
Expect and deny negative window dimensions.
| -rw-r--r-- | cube/cube.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cube/cube.cpp b/cube/cube.cpp index f5db1f69..cd983e06 100644 --- a/cube/cube.cpp +++ b/cube/cube.cpp @@ -331,8 +331,8 @@ struct Demo { char const *extension_names[64]; char const *enabled_layers[64]; - uint32_t width; - uint32_t height; + int32_t width; + int32_t height; vk::Format format; vk::ColorSpaceKHR color_space; @@ -824,7 +824,7 @@ void Demo::draw() { vk::SurfaceCapabilitiesKHR surfCapabilities; result = gpu.getSurfaceCapabilitiesKHR(surface, &surfCapabilities); VERIFY(result == vk::Result::eSuccess); - if (surfCapabilities.currentExtent.width != width || surfCapabilities.currentExtent.height != height) { + if (surfCapabilities.currentExtent.width != static_cast<uint32_t>(width) || surfCapabilities.currentExtent.height != static_cast<uint32_t>(height)) { resize(); } } else if (result == vk::Result::eErrorSurfaceLostKHR) { @@ -983,11 +983,11 @@ void Demo::init(int argc, char **argv) { i++; continue; } - if (strcmp(argv[i], "--width") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNu32, &width) == 1 && width > 0) { + if (strcmp(argv[i], "--width") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNi32, &width) == 1 && width > 0) { i++; continue; } - if (strcmp(argv[i], "--height") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNu32, &height) == 1 && height > 0) { + if (strcmp(argv[i], "--height") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNi32, &height) == 1 && height > 0) { i++; continue; } |
