Skip to content

Commit 0be0c50

Browse files
pre-commit
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
1 parent ef5d73d commit 0be0c50

3 files changed

Lines changed: 15 additions & 21 deletions

File tree

src/lib/app/RvCommon/QTVulkanVideoDevice.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ namespace Rv
511511
const VkFormat scFmt = m_view ? m_view->swapchainFormat() : VK_FORMAT_UNDEFINED;
512512
cout << "INFO: QTVulkanVideoDevice: syncBuffers: first frame path = " << (sharedInfo ? "GPU-interop" : "CPU-fallback")
513513
<< " swapchainFormat=" << scFmt
514-
<< (scFmt == VK_FORMAT_A2B10G10R10_UNORM_PACK32 ? " (A2B10G10R10 / 10-bit)"
514+
<< (scFmt == VK_FORMAT_A2B10G10R10_UNORM_PACK32 ? " (A2B10G10R10 / 10-bit)"
515515
: scFmt == VK_FORMAT_A2R10G10B10_UNORM_PACK32 ? " (A2R10G10B10 / 10-bit)"
516516
: scFmt == VK_FORMAT_UNDEFINED ? " (UNDEFINED -- swapchain not created yet)"
517517
: " (NOT 10-bit)")
@@ -549,8 +549,7 @@ namespace Rv
549549
const uint32_t gi = static_cast<uint32_t>(g * 1023.f + 0.5f) & 0x3FF;
550550
const uint32_t bi = static_cast<uint32_t>(b * 1023.f + 0.5f) & 0x3FF;
551551
// A2R10G10B10: A|R|G|B (R high). A2B10G10R10: A|B|G|R (R low).
552-
dst[x] = rgbOrder ? ((3u << 30) | (ri << 20) | (gi << 10) | bi)
553-
: ((3u << 30) | (bi << 20) | (gi << 10) | ri);
552+
dst[x] = rgbOrder ? ((3u << 30) | (ri << 20) | (gi << 10) | bi) : ((3u << 30) | (bi << 20) | (gi << 10) | ri);
554553
}
555554
}
556555
m_view->presentPixelData(packed.data(), w, h);
@@ -562,8 +561,7 @@ namespace Rv
562561
// Vulkan side keeps the same export, so a resize does not re-import here;
563562
// m_sharedWidth/m_sharedHeight cache the imported capacity, not the used
564563
// (requested) size.
565-
if (m_sharedWidth[slot] != sharedInfo->strideWidth || m_sharedHeight[slot] != sharedInfo->capacityHeight
566-
|| !m_glMemoryObject[slot])
564+
if (m_sharedWidth[slot] != sharedInfo->strideWidth || m_sharedHeight[slot] != sharedInfo->capacityHeight || !m_glMemoryObject[slot])
567565
{
568566
cleanupSharedGLObjects(slot);
569567

@@ -597,8 +595,8 @@ namespace Rv
597595
// Allocate the imported texture at the image's capacity dimensions
598596
// (stride width x capacity height); the FBO blit below writes only the
599597
// used w x h sub-region into its origin corner.
600-
glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, GL_RGB10_A2, sharedInfo->strideWidth, sharedInfo->capacityHeight,
601-
m_glMemoryObject[slot], 0);
598+
glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, GL_RGB10_A2, sharedInfo->strideWidth, sharedInfo->capacityHeight, m_glMemoryObject[slot],
599+
0);
602600
glBindTexture(GL_TEXTURE_2D, 0);
603601

604602
glGenSemaphoresEXT(1, &m_glReadySemaphore[slot]);

src/lib/app/RvCommon/RvCommon/VulkanView.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ namespace Rv
9191
int vkReadySemaphoreFd{-1};
9292
#endif
9393
size_t size{0};
94-
int width{0}; // used sub-region width presented this frame
95-
int height{0}; // used sub-region height presented this frame
96-
int strideWidth{0}; // GL texture width = capacity rowPitch / 4
94+
int width{0}; // used sub-region width presented this frame
95+
int height{0}; // used sub-region height presented this frame
96+
int strideWidth{0}; // GL texture width = capacity rowPitch / 4
9797
int capacityHeight{0}; // allocated image height (>= height); GL texture height
9898
};
9999

src/lib/app/RvCommon/VulkanView.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ namespace Rv
5757
// fallback) or blitted (GPU interop). A2B10G10R10 (== GL_RGB10_A2) is
5858
// preferred when the surface offers it, but many Linux/RADV surfaces only
5959
// advertise A2R10G10B10.
60-
static bool isTenBitFormat(VkFormat f)
61-
{
62-
return f == VK_FORMAT_A2B10G10R10_UNORM_PACK32 || f == VK_FORMAT_A2R10G10B10_UNORM_PACK32;
63-
}
60+
static bool isTenBitFormat(VkFormat f) { return f == VK_FORMAT_A2B10G10R10_UNORM_PACK32 || f == VK_FORMAT_A2R10G10B10_UNORM_PACK32; }
6461

6562
static const char* formatName(VkFormat f)
6663
{
@@ -643,8 +640,7 @@ namespace Rv
643640
}
644641
else
645642
{
646-
cout << "WARNING: VulkanView: Real surface lacks a 10-bit format (A2B10G10R10/A2R10G10B10); requesting OpenGL fallback"
647-
<< endl;
643+
cout << "WARNING: VulkanView: Real surface lacks a 10-bit format (A2B10G10R10/A2R10G10B10); requesting OpenGL fallback" << endl;
648644
requestGLFallback();
649645
return false;
650646
}
@@ -702,8 +698,7 @@ namespace Rv
702698
vkDeviceWaitIdle(m_vkDevice);
703699
if (!m_vkCommandBuffers.empty())
704700
{
705-
vkFreeCommandBuffers(m_vkDevice, m_vkCommandPool, (uint32_t)m_vkCommandBuffers.size(),
706-
m_vkCommandBuffers.data());
701+
vkFreeCommandBuffers(m_vkDevice, m_vkCommandPool, (uint32_t)m_vkCommandBuffers.size(), m_vkCommandBuffers.data());
707702
m_vkCommandBuffers.clear();
708703
}
709704
vkDestroySwapchainKHR(m_vkDevice, m_vkSwapchain, nullptr);
@@ -958,8 +953,8 @@ namespace Rv
958953

959954
if (ImageRenderer::debugGpu())
960955
{
961-
cout << "INFO: VulkanView: getSharedImageInfo: (re)allocating shared image slot " << slot
962-
<< " capacity " << capW << "x" << capH << " for request " << w << "x" << h << endl;
956+
cout << "INFO: VulkanView: getSharedImageInfo: (re)allocating shared image slot " << slot << " capacity " << capW << "x" << capH
957+
<< " for request " << w << "x" << h << endl;
963958
}
964959

965960
// 1. Create Shared Image
@@ -1641,7 +1636,8 @@ namespace Rv
16411636
region.imageOffset = {0, 0, 0};
16421637
region.imageExtent = {(uint32_t)w, (uint32_t)h, 1};
16431638

1644-
vkCmdCopyBufferToImage(cb, m_vkStagingBuffer[slot], m_vkSwapchainImages[imageIndex], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
1639+
vkCmdCopyBufferToImage(cb, m_vkStagingBuffer[slot], m_vkSwapchainImages[imageIndex], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1,
1640+
&region);
16451641

16461642
// Transition image to present
16471643
barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;

0 commit comments

Comments
 (0)