From b80b8ec9213e404062e449c7baad6db00483aef2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 8 Feb 2023 15:18:04 +0100 Subject: Disambiguate Vulkan debug constants They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I4dfef40309a42b8fa662dfa3d99b65d920480aba Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../vulkanserverbufferintegration.cpp | 20 ++++++------- .../vulkanserverbufferintegration.cpp | 14 ++++----- .../compositor/vulkan-server/vulkanwrapper.cpp | 34 +++++++++++----------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp index e3bcef1f..8f1ff9a4 100644 --- a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp +++ b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp @@ -14,7 +14,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -static constexpr bool extraDebug = +static constexpr bool sbiExtraDebug = #ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG true; #else @@ -88,7 +88,7 @@ VulkanServerBuffer::~VulkanServerBuffer() if (m_texture) { //only do gl cleanup if import has been called m_integration->deleteGLTextureWhenPossible(m_texture); - if (extraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject; + if (sbiExtraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject; funcs->glDeleteMemoryObjectsEXT(1, &m_memoryObject); } qt_server_buffer_release(m_server_buffer); @@ -100,7 +100,7 @@ void VulkanServerBuffer::import() if (m_texture) return; - if (extraDebug) qDebug() << "importing" << m_fd << Qt::hex << glGetError(); + if (sbiExtraDebug) qDebug() << "importing" << m_fd << Qt::hex << glGetError(); auto *glContext = QOpenGLContext::currentContext(); if (!glContext) @@ -110,21 +110,21 @@ void VulkanServerBuffer::import() return; funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject); - if (extraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError(); + if (sbiExtraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError(); funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, m_fd); - if (extraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError(); + if (sbiExtraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError(); m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D); m_texture->create(); - if (extraDebug) qDebug() << "created texture" << m_texture->textureId() << Qt::hex << glGetError(); + if (sbiExtraDebug) qDebug() << "created texture" << m_texture->textureId() << Qt::hex << glGetError(); m_texture->bind(); - if (extraDebug) qDebug() << "bound texture" << Qt::hex << glGetError(); + if (sbiExtraDebug) qDebug() << "bound texture" << Qt::hex << glGetError(); funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_internalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 ); - if (extraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError(); - if (extraDebug) qDebug() << "format" << Qt::hex << m_internalFormat << GL_RGBA8; + if (sbiExtraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError(); + if (sbiExtraDebug) qDebug() << "format" << Qt::hex << m_internalFormat << GL_RGBA8; } QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture() @@ -157,7 +157,7 @@ void VulkanServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_regis void VulkanServerBufferIntegration::zqt_vulkan_server_buffer_v1_server_buffer_created(qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format) { - if (extraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd; + if (sbiExtraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd; auto *server_buffer = new VulkanServerBuffer(this, id, fd, width, height, memory_size, format); qt_server_buffer_set_user_data(id, server_buffer); } diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp index eb10353b..1b5aea29 100644 --- a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp +++ b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp @@ -16,7 +16,7 @@ #include QT_BEGIN_NAMESPACE -static constexpr bool extraDebug = false; +static constexpr bool vsbiExtraDebug = false; #define DECL_GL_FUNCTION(name, type) \ type name @@ -179,7 +179,7 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture() return nullptr; funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject); - if (extraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError(); + if (vsbiExtraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError(); int dupfd = fcntl(m_fd, F_DUPFD_CLOEXEC, 0); @@ -189,7 +189,7 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture() } funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, dupfd); - if (extraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError(); + if (vsbiExtraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError(); if (!m_texture) @@ -197,13 +197,13 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture() m_texture->create(); GLuint texId = m_texture->textureId(); - if (extraDebug) qDebug() << "created texture" << texId << Qt::hex << glGetError(); + if (vsbiExtraDebug) qDebug() << "created texture" << texId << Qt::hex << glGetError(); m_texture->bind(); - if (extraDebug) qDebug() << "bound texture" << texId << Qt::hex << glGetError(); + if (vsbiExtraDebug) qDebug() << "bound texture" << texId << Qt::hex << glGetError(); funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_glInternalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 ); - if (extraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError(); - if (extraDebug) qDebug() << "format" << Qt::hex << m_glInternalFormat << GL_RGBA8; + if (vsbiExtraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError(); + if (vsbiExtraDebug) qDebug() << "format" << Qt::hex << m_glInternalFormat << GL_RGBA8; return m_texture; diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp index 7c8718cb..bf3700ae 100644 --- a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp +++ b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp @@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE -static constexpr bool extraDebug = false; +static constexpr bool vwExtraDebug = false; #define DECL_VK_FUNCTION(name) \ PFN_ ## name name = nullptr; @@ -228,7 +228,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createImage(VkFormat format, VkImageTi int res = vkBindImageMemory(m_device, image, imageWrapper->textureImageMemory, 0); Q_UNUSED(res); - if (extraDebug) qDebug() << "vkBindImageMemory res" << res; + if (vwExtraDebug) qDebug() << "vkBindImageMemory res" << res; VkMemoryGetFdInfoKHR memoryFdInfo = {}; memoryFdInfo.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR; @@ -236,7 +236,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createImage(VkFormat format, VkImageTi memoryFdInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; res = vkGetMemoryFdKHR(m_device, &memoryFdInfo, &imageWrapper->imgFd); - if (extraDebug) qDebug() << "vkGetMemoryFdKHR res" << res << "fd" << imageWrapper->imgFd; + if (vwExtraDebug) qDebug() << "vkGetMemoryFdKHR res" << res << "fd" << imageWrapper->imgFd; return imageWrapper.release(); } @@ -331,19 +331,19 @@ VkCommandBuffer VulkanWrapperPrivate::beginSingleTimeCommands() allocInfo.commandPool = m_commandPool; allocInfo.commandBufferCount = 1; - if (extraDebug) qDebug() << "allocating..."; + if (vwExtraDebug) qDebug() << "allocating..."; VkCommandBuffer commandBuffer; int res = vkAllocateCommandBuffers(m_device, &allocInfo, &commandBuffer); Q_UNUSED(res); - if (extraDebug) qDebug() << "vkAllocateCommandBuffers res" << res; + if (vwExtraDebug) qDebug() << "vkAllocateCommandBuffers res" << res; VkCommandBufferBeginInfo beginInfo = {}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; res = vkBeginCommandBuffer(commandBuffer, &beginInfo); - if (extraDebug) qDebug() << "BEGIN res" << res; + if (vwExtraDebug) qDebug() << "BEGIN res" << res; return commandBuffer; } @@ -352,7 +352,7 @@ void VulkanWrapperPrivate::endSingleTimeCommands(VkCommandBuffer commandBuffer) { int res = vkEndCommandBuffer(commandBuffer); Q_UNUSED(res); - if (extraDebug) qDebug() << "END res" << res; + if (vwExtraDebug) qDebug() << "END res" << res; VkSubmitInfo submitInfo = {}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; @@ -409,7 +409,7 @@ QueueFamilyIndices VulkanWrapperPrivate::findQueueFamilies(VkPhysicalDevice devi uint32_t queueFamilyCount = 0; vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, nullptr); - if (extraDebug) qDebug() << "queueFamilyCount" << queueFamilyCount; + if (vwExtraDebug) qDebug() << "queueFamilyCount" << queueFamilyCount; std::vector queueFamilies(queueFamilyCount); @@ -482,7 +482,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar int texWidth = size.width(); int texHeight = size.height(); bool ok; - if (extraDebug) qDebug("image load %p %dx%d", pixels, texWidth, texHeight); + if (vwExtraDebug) qDebug("image load %p %dx%d", pixels, texWidth, texHeight); if (!pixels) { qCritical("VulkanWrapper: failed to load texture image!"); return nullptr; @@ -497,17 +497,17 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar void* data; vkMapMemory(m_device, stagingBufferMemory, 0, bufferSize, 0, &data); - if (extraDebug) qDebug() << "mapped" << data << bufferSize; + if (vwExtraDebug) qDebug() << "mapped" << data << bufferSize; memcpy(data, pixels, static_cast(bufferSize)); vkUnmapMemory(m_device, stagingBufferMemory); - if (extraDebug) qDebug() << "creating image..."; + if (vwExtraDebug) qDebug() << "creating image..."; std::unique_ptr imageWrapper(createImage(vkFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size, bufferSize)); if (!imageWrapper) return nullptr; - if (extraDebug) qDebug() << "transition..."; + if (vwExtraDebug) qDebug() << "transition..."; const VkImage textureImage = imageWrapper->textureImage; @@ -516,7 +516,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar if (!ok) return nullptr; - if (extraDebug) qDebug() << "copyBufferToImage..."; + if (vwExtraDebug) qDebug() << "copyBufferToImage..."; copyBufferToImage(stagingBuffer, textureImage, static_cast(texWidth), static_cast(texHeight)); transitionImageLayout(textureImage, vkFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); @@ -541,7 +541,7 @@ void VulkanWrapperPrivate::freeTextureImage(VulkanImageWrapper *imageWrapper) VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext) { - if (extraDebug) qDebug("Creating Vulkan instance"); + if (vwExtraDebug) qDebug("Creating Vulkan instance"); VkApplicationInfo applicationInfo = {}; applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; applicationInfo.pNext = nullptr; @@ -573,7 +573,7 @@ VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext) VkResult instanceCreationResult = vkCreateInstance(&instanceCreateInfo, nullptr, &m_instance); - if (extraDebug) qDebug() << "result" << instanceCreationResult; + if (vwExtraDebug) qDebug() << "result" << instanceCreationResult; if (instanceCreationResult != VK_SUCCESS) { qCritical() << "VulkanWrapper: Failed to create Vulkan instance: Error " @@ -585,12 +585,12 @@ VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext) uint32_t devCount; auto res = vkEnumeratePhysicalDevices(m_instance, &devCount, nullptr); - if (extraDebug) qDebug() << "vkEnumeratePhysicalDevices res =" << res << "count =" << devCount; + if (vwExtraDebug) qDebug() << "vkEnumeratePhysicalDevices res =" << res << "count =" << devCount; QVarLengthArray dev(devCount); res = vkEnumeratePhysicalDevices(m_instance, &devCount, dev.data()); - if (extraDebug) qDebug() << "...devs res =" << res << "count =" << devCount; + if (vwExtraDebug) qDebug() << "...devs res =" << res << "count =" << devCount; #ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG VkPhysicalDeviceProperties props; -- cgit v1.2.1