diff options
author | David Robillard <d@drobilla.net> | 2022-10-07 15:19:39 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-10-07 15:22:43 -0400 |
commit | 17d90bda87dd445a974de7e644629593ade617d8 (patch) | |
tree | 319a23c713a4d089863d9c169d63a1d2d413521c /examples | |
parent | ed4c8a50505ab02a8f3a01e41f5f86acca04b81d (diff) | |
download | pugl-17d90bda87dd445a974de7e644629593ade617d8.tar.gz pugl-17d90bda87dd445a974de7e644629593ade617d8.tar.bz2 pugl-17d90bda87dd445a974de7e644629593ade617d8.zip |
Use uppercase integer literal suffixes
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pugl_cpp_demo.cpp | 2 | ||||
-rw-r--r-- | examples/pugl_embed_demo.c | 12 | ||||
-rw-r--r-- | examples/pugl_shader_demo.c | 4 | ||||
-rw-r--r-- | examples/pugl_vulkan_cpp_demo.cpp | 58 | ||||
-rw-r--r-- | examples/pugl_window_demo.c | 14 | ||||
-rw-r--r-- | examples/sybok.hpp | 14 |
6 files changed, 52 insertions, 52 deletions
diff --git a/examples/pugl_cpp_demo.cpp b/examples/pugl_cpp_demo.cpp index 19b8065..6abe45b 100644 --- a/examples/pugl_cpp_demo.cpp +++ b/examples/pugl_cpp_demo.cpp @@ -58,7 +58,7 @@ CubeView::onEvent(const pugl::UpdateEvent&) noexcept // But for testing, use sendEvent() instead: return sendEvent(pugl::ExposeEvent{ - 0u, PuglCoord{0}, PuglCoord{0}, frame().width, frame().height}); + 0U, PuglCoord{0}, PuglCoord{0}, frame().width, frame().height}); } pugl::Status diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index 9f93287..94310a5 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -12,8 +12,8 @@ #include <stdbool.h> #include <stdint.h> -static const uint8_t borderWidth = 64u; -static const uintptr_t reverseTimerId = 1u; +static const uint8_t borderWidth = 64U; +static const uintptr_t reverseTimerId = 1U; typedef struct { PuglWorld* world; @@ -109,13 +109,13 @@ onKeyPress(PuglView* view, const PuglKeyEvent* event) app->quit = 1; } else if (event->state & PUGL_MOD_SHIFT) { if (event->key == PUGL_KEY_UP) { - puglSetSize(view, frame.width, frame.height - 10u); + puglSetSize(view, frame.width, frame.height - 10U); } else if (event->key == PUGL_KEY_DOWN) { - puglSetSize(view, frame.width, frame.height + 10u); + puglSetSize(view, frame.width, frame.height + 10U); } else if (event->key == PUGL_KEY_LEFT) { - puglSetSize(view, frame.width - 10u, frame.height); + puglSetSize(view, frame.width - 10U, frame.height); } else if (event->key == PUGL_KEY_RIGHT) { - puglSetSize(view, frame.width + 10u, frame.height); + puglSetSize(view, frame.width + 10U, frame.height); } } else { if (event->key == PUGL_KEY_UP) { diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index d018db3..e3a1900 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -46,7 +46,7 @@ #endif static const PuglSpan defaultSpan = 512; -static const uintptr_t resizeTimerId = 1u; +static const uintptr_t resizeTimerId = 1U; typedef struct { const char* programPath; @@ -202,7 +202,7 @@ loadShader(const char* const programPath, const char* const name) const size_t fileSize = (size_t)ftell(file); fseek(file, 0, SEEK_SET); - char* source = (char*)calloc(1, fileSize + 1u); + char* source = (char*)calloc(1, fileSize + 1U); if (fread(source, 1, fileSize, file) != fileSize) { free(source); diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp index 7e0bd38..f148743 100644 --- a/examples/pugl_vulkan_cpp_demo.cpp +++ b/examples/pugl_vulkan_cpp_demo.cpp @@ -50,7 +50,7 @@ namespace { -constexpr uintptr_t resizeTimerId = 1u; +constexpr uintptr_t resizeTimerId = 1U; struct PhysicalDeviceSelection { sk::PhysicalDevice physicalDevice; @@ -295,17 +295,17 @@ openDevice(const sk::VulkanApi& vk, const VkDeviceQueueCreateInfo queueCreateInfo{ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, nullptr, - 0u, + 0U, graphicsFamilyIndex, - SK_COUNTED(1u, &graphicsQueuePriority), + SK_COUNTED(1U, &graphicsQueuePriority), }; const VkDeviceCreateInfo createInfo{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, nullptr, - 0u, - SK_COUNTED(1u, &queueCreateInfo), - SK_COUNTED(0u, nullptr), // Deprecated - SK_COUNTED(1u, &swapchainName), + 0U, + SK_COUNTED(1U, &queueCreateInfo), + SK_COUNTED(0U, nullptr), // Deprecated + SK_COUNTED(1U, &swapchainName), nullptr}; return vk.createDevice(physicalDevice, createInfo, device); @@ -346,7 +346,7 @@ findGraphicsQueue(const sk::VulkanApi& vk, return r; } - for (uint32_t q = 0u; q < queueProps.size(); ++q) { + for (uint32_t q = 0U; q < queueProps.size(); ++q) { if (queueProps[q].queueFlags & VK_QUEUE_GRAPHICS_BIT) { bool supported = false; if ((r = vk.getPhysicalDeviceSurfaceSupportKHR( @@ -385,7 +385,7 @@ selectPhysicalDevice(const sk::VulkanApi& vk, } if (supported) { - auto queueIndex = 0u; + auto queueIndex = 0U; if ((r = findGraphicsQueue(vk, surface, device, queueIndex))) { return r; } @@ -529,8 +529,8 @@ Swapchain::init(const sk::VulkanApi& vk, extent = surfaceExtent; const auto minNumImages = - (!capabilities.maxImageCount || capabilities.maxImageCount >= 3u) - ? 3u + (!capabilities.maxImageCount || capabilities.maxImageCount >= 3U) + ? 3U : capabilities.maxImageCount; const VkSwapchainCreateInfoKHR swapchainCreateInfo{ @@ -611,7 +611,7 @@ RenderPass::init(const sk::VulkanApi& vk, VK_PIPELINE_BIND_POINT_GRAPHICS, SK_COUNTED(0, nullptr), SK_COUNTED(1, &colorAttachmentRef, nullptr, nullptr), - SK_COUNTED(0u, nullptr)}; + SK_COUNTED(0U, nullptr)}; static constexpr VkSubpassDependency dependency{ VK_SUBPASS_EXTERNAL, @@ -767,7 +767,7 @@ RectPipeline::init(const sk::VulkanApi& vk, nullptr, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, numImages, - 1u, + 1U, &poolSize}; if ((r = vk.createDescriptorPool( gpu.device, descriptorPoolCreateInfo, descriptorPool))) { @@ -811,19 +811,19 @@ RectPipeline::init(const sk::VulkanApi& vk, static constexpr std::array<VkVertexInputAttributeDescription, 4> vertexAttributeDescriptions{ {// Model - {0u, 0u, VK_FORMAT_R32G32_SFLOAT, 0}, + {0U, 0U, VK_FORMAT_R32G32_SFLOAT, 0}, // Rect instance attributes - {1u, 1u, VK_FORMAT_R32G32_SFLOAT, offsetof(Rect, pos)}, - {2u, 1u, VK_FORMAT_R32G32_SFLOAT, offsetof(Rect, size)}, - {3u, 1u, VK_FORMAT_R32G32B32A32_SFLOAT, offsetof(Rect, fillColor)}}}; + {1U, 1U, VK_FORMAT_R32G32_SFLOAT, offsetof(Rect, pos)}, + {2U, 1U, VK_FORMAT_R32G32_SFLOAT, offsetof(Rect, size)}, + {3U, 1U, VK_FORMAT_R32G32B32A32_SFLOAT, offsetof(Rect, fillColor)}}}; static constexpr std::array<VkVertexInputBindingDescription, 2> vertexBindingDescriptions{ VkVertexInputBindingDescription{ 0, sizeof(vec2), VK_VERTEX_INPUT_RATE_VERTEX}, VkVertexInputBindingDescription{ - 1u, sizeof(Rect), VK_VERTEX_INPUT_RATE_INSTANCE}}; + 1U, sizeof(Rect), VK_VERTEX_INPUT_RATE_INSTANCE}}; static constexpr VkPipelineInputAssemblyStateCreateInfo inputAssembly{ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, @@ -946,7 +946,7 @@ RectPipeline::init(const sk::VulkanApi& vk, nullptr, pipelineLayout, renderPass.renderPass, - 0u, + 0U, {}, 0}}}; @@ -1049,7 +1049,7 @@ RenderSync::init(const sk::VulkanApi& vk, const sk::Device& device, const uint32_t numImages) { - const auto maxInFlight = std::max(1u, numImages - 1u); + const auto maxInFlight = std::max(1U, numImages - 1U); VkResult r = VK_SUCCESS; imageAvailable = std::vector<sk::Semaphore>(numImages); @@ -1301,19 +1301,19 @@ recordCommandBuffer(sk::CommandScope& cmd, const std::array<VkDeviceSize, 1> offsets{0}; pass.bindVertexBuffers( - 0u, SK_COUNTED(1u, &rectData.modelBuffer.buffer.get(), offsets.data())); + 0U, SK_COUNTED(1U, &rectData.modelBuffer.buffer.get(), offsets.data())); pass.bindVertexBuffers( - 1u, SK_COUNTED(1u, &rectData.instanceBuffer.buffer.get(), offsets.data())); + 1U, SK_COUNTED(1U, &rectData.instanceBuffer.buffer.get(), offsets.data())); pass.bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, rectPipeline.pipelineLayout, - 0u, - SK_COUNTED(1u, rectPipeline.descriptorSets.get()), - 0u, + 0U, + SK_COUNTED(1U, rectPipeline.descriptorSets.get()), + 0U, nullptr); - pass.draw(4u, static_cast<uint32_t>(rectData.numRects), 0u, 0u); + pass.draw(4U, static_cast<uint32_t>(rectData.numRects), 0U, 0U); } VkResult @@ -1397,7 +1397,7 @@ public: RectData rectData; RectShaders rectShaders; uint32_t framesDrawn{0}; - VkExtent2D extent{512u, 512u}; + VkExtent2D extent{512U, 512U}; std::vector<Rect> rects; bool resizing{false}; bool quit{false}; @@ -1621,7 +1621,7 @@ View::onEvent(const pugl::ExposeEvent&) const auto& gpu = _app.gpu; // Acquire the next image, waiting and/or rebuilding if necessary - auto nextImageIndex = 0u; + auto nextImageIndex = 0U; if (beginFrame(_app, gpu.device, nextImageIndex)) { return pugl::Status::unknownError; } @@ -1719,7 +1719,7 @@ run(const char* const programPath, app.world.setClassName("PuglVulkanCppDemo"); app.view.setWindowTitle("Pugl Vulkan C++ Demo"); app.view.setSizeHint(pugl::SizeHint::defaultSize, width, height); - app.view.setSizeHint(pugl::SizeHint::minSize, width / 4u, height / 4u); + app.view.setSizeHint(pugl::SizeHint::minSize, width / 4U, height / 4U); app.view.setBackend(pugl::vulkanBackend()); app.view.setHint(pugl::ViewHint::resizable, opts.resizable); const pugl::Status st = app.view.realize(); diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index b3deb0d..1827991 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -36,7 +36,7 @@ typedef struct { bool verbose; } PuglTestApp; -static const uint8_t pad = 64u; +static const uint8_t pad = 64U; static void onDisplay(PuglView* view) @@ -70,13 +70,13 @@ onKeyPress(PuglView* view, const PuglKeyEvent* event) app->quit = 1; } else if (event->state & PUGL_MOD_SHIFT) { if (event->key == PUGL_KEY_UP) { - puglSetSize(view, frame.width, frame.height - 10u); + puglSetSize(view, frame.width, frame.height - 10U); } else if (event->key == PUGL_KEY_DOWN) { - puglSetSize(view, frame.width, frame.height + 10u); + puglSetSize(view, frame.width, frame.height + 10U); } else if (event->key == PUGL_KEY_LEFT) { - puglSetSize(view, frame.width - 10u, frame.height); + puglSetSize(view, frame.width - 10U, frame.height); } else if (event->key == PUGL_KEY_RIGHT) { - puglSetSize(view, frame.width + 10u, frame.height); + puglSetSize(view, frame.width + 10U, frame.height); } } else { if (event->key == PUGL_KEY_UP) { @@ -187,8 +187,8 @@ main(int argc, char** argv) puglSetWindowTitle(view, "Pugl Window Demo"); puglSetPosition(view, - (PuglCoord)(pad + (128u + pad) * i), - (PuglCoord)(pad + (128u + pad) * i)); + (PuglCoord)(pad + (128U + pad) * i), + (PuglCoord)(pad + (128U + pad) * i)); puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512); puglSetSizeHint(view, PUGL_MIN_SIZE, 128, 128); diff --git a/examples/sybok.hpp b/examples/sybok.hpp index aad1b41..4fe4886 100644 --- a/examples/sybok.hpp +++ b/examples/sybok.hpp @@ -655,7 +655,7 @@ template<class Value, class Vector, class Func, class... Args> inline VkResult wrapVectorAccessor(Vector& vector, Func func, Args... args) noexcept { - uint32_t count = 0u; + uint32_t count = 0U; VkResult r = func(args..., &count, nullptr); if (r > VK_INCOMPLETE) { vector.clear(); @@ -1310,7 +1310,7 @@ public: VkResult enumeratePhysicalDevices(const Instance& instance, Vector& physicalDevices) const noexcept { - uint32_t count = 0u; + uint32_t count = 0U; VkResult r = vkEnumeratePhysicalDevices(instance, &count, nullptr); if (r > VK_INCOMPLETE) { return r; @@ -1355,7 +1355,7 @@ public: const PhysicalDevice& physicalDevice, Vector& queueFamilyProperties) const noexcept { - uint32_t count = 0u; + uint32_t count = 0U; vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, nullptr); queueFamilyProperties = Vector(count); @@ -1420,7 +1420,7 @@ public: const VkSubmitInfo& submit, const Fence& fence) const noexcept { - return vkQueueSubmit(queue, 1u, &submit, fence); + return vkQueueSubmit(queue, 1U, &submit, fence); } template<size_t descriptorWriteCount, size_t descriptorCopyCount> @@ -1440,7 +1440,7 @@ public: VkResult resetFence(const Device& device, const Fence& fence) const noexcept { VkFence h = fence; - return vkResetFences(device, 1u, &h); + return vkResetFences(device, 1U, &h); } VkResult waitForFence(const Device& device, @@ -1448,13 +1448,13 @@ public: uint64_t timeout) const noexcept { VkFence h = fence; - return vkWaitForFences(device, 1u, &h, VK_TRUE, timeout); + return vkWaitForFences(device, 1U, &h, VK_TRUE, timeout); } VkResult waitForFence(const Device& device, const Fence& fence) const noexcept { VkFence h = fence; - return vkWaitForFences(device, 1u, &h, VK_TRUE, UINT64_MAX); + return vkWaitForFences(device, 1U, &h, VK_TRUE, UINT64_MAX); } // Scoped command buffer interface |