diff options
author | Jordan Halase <jordan@halase.me> | 2019-11-01 23:58:18 -0500 |
---|---|---|
committer | Jordan Halase <jordan@halase.me> | 2019-11-01 23:58:18 -0500 |
commit | 1956c720cd96e3d3d95d2d1930038f74fd03aafb (patch) | |
tree | e73bbce244ba5bedaaa2b630c43bdd6adee66a9b | |
parent | 3af08aac52d6c382f5c61be66f1fe9ca1fcebe4b (diff) |
Use Vulkan color
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | main.c | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e22a915..7f920b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.2) project(vkpugltest LANGUAGES C) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wdouble-promotion") set(pugldir "../pugl") set(PUGL_INCLUDE "${pugldir}") @@ -1065,7 +1065,11 @@ static int rvkCreateRawSwapchain(struct RenderVulkan *vk, int width, int height) uint32_t i; for (i = 0; i < nFormats; ++i) { const VkSurfaceFormatKHR want = { - VK_FORMAT_B8G8R8A8_SRGB, // BGRA sRGB + /* UNORM is *NOT* recommended for color blending, but is + * useful for getting simple "HTML" colors to the screen + * without manually converting to a linear color space. + */ + VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR }; if (surfaceFormats[i].format == VK_FORMAT_UNDEFINED) { @@ -1184,10 +1188,10 @@ static void freeCommandBuffers(struct RenderVulkan *vk) static int recordCommandBuffers(struct RenderVulkan *vk) { VkClearColorValue clearValue = { 0 }; - clearValue.float32[0] = 1.0f; // R - clearValue.float32[1] = 0.0f; // G - clearValue.float32[2] = 0.5f; // B - clearValue.float32[3] = 1.0f; // A + clearValue.float32[0] = (float)0xa4/0x100; // R + clearValue.float32[1] = (float)0x1e/0x100; // G + clearValue.float32[2] = (float)0x22/0x100; // B + clearValue.float32[3] = (float)0xff/0x100; // A VkImageSubresourceRange range = { 0 }; range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; |