From 2a84eeaceace9f150a53fbf2280a12bc23fcc0e3 Mon Sep 17 00:00:00 2001 From: Karol Suprynowicz Date: Wed, 1 Jan 2025 22:31:14 +0100 Subject: [PATCH] Fix UI on Vulkan --- interface/src/ui/ApplicationOverlay.cpp | 1 + libraries/gpu-vk/src/gpu/vk/VKBackend.cpp | 13 ------------- libraries/gpu-vk/src/gpu/vk/VKTexture.cpp | 9 ++++----- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index 144f64c385f..72e8c334b71 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -106,6 +106,7 @@ void ApplicationOverlay::renderQmlUi(RenderArgs* renderArgs) { bool newTextureAvailable = offscreenUI ? offscreenUI->fetchTexture(newTextureAndFence) : false; if (newTextureAvailable) { _uiTexture->setExternalTexture(newTextureAndFence.first, newTextureAndFence.second); + _uiTexture->setSize(offscreenUI->size().width(), offscreenUI->size().height()); } auto geometryCache = DependencyManager::get(); gpu::Batch& batch = *renderArgs->_batch; diff --git a/libraries/gpu-vk/src/gpu/vk/VKBackend.cpp b/libraries/gpu-vk/src/gpu/vk/VKBackend.cpp index c1e796b25ab..c984c627f70 100644 --- a/libraries/gpu-vk/src/gpu/vk/VKBackend.cpp +++ b/libraries/gpu-vk/src/gpu/vk/VKBackend.cpp @@ -219,19 +219,7 @@ void VKBackend::executeFrame(const FramePointer& frame) { { const auto& commandBuffer = _currentCommandBuffer; for (const auto& batchPtr : frame->batches) { - /*if (batch_count == 6) {//12 - return; - }*/ const auto& batch = *batchPtr; - /*if (batch.getName() == "CompositeHUD") { - continue; // VKTODO: crashes frame player currently - }*/ - /*if (batch.getName() == "Resample::run") { - continue; // VKTODO: no framebuffer commands support yet"ApplicationOverlay::render" - }*/ - /*if (batch.getName() == "ApplicationOverlay::render") { - continue; // VKTODO: no overlay support yet - }*/ cmdBeginLabel(commandBuffer, "batch:" + batch.getName(), glm::vec4{ 1, 1, 0, 1 }); const auto& commands = batch.getCommands(); const auto& offsets = batch.getCommandOffsets(); @@ -888,7 +876,6 @@ void VKBackend::updateVkDescriptorWriteSetsTexture(VkDescriptorSet target) { for (size_t i = 0; i < _resource._textures.size(); i++) { if (_resource._textures[i].texture && (vertexReflection.validTexture(i) || fragmentReflection.validTexture(i))) { // VKTODO: move vulkan texture creation to the transfer parts - // VKTODO: this doesn't work yet VKTexture* texture = syncGPUObject(*_resource._textures[i].texture); VkDescriptorImageInfo imageInfo{}; if (texture) { diff --git a/libraries/gpu-vk/src/gpu/vk/VKTexture.cpp b/libraries/gpu-vk/src/gpu/vk/VKTexture.cpp index 7a5d036cbbe..ffa67062112 100644 --- a/libraries/gpu-vk/src/gpu/vk/VKTexture.cpp +++ b/libraries/gpu-vk/src/gpu/vk/VKTexture.cpp @@ -200,15 +200,14 @@ void VKAttachmentTexture::createTexture(VKBackend &backend) { imageCI.arrayLayers = _gpuObject.isArray() ? _gpuObject.getNumSlices() : 1; imageCI.samples = VK_SAMPLE_COUNT_1_BIT; imageCI.tiling = VK_IMAGE_TILING_OPTIMAL; - if (_gpuObject.isColorRenderTarget() + /*if (_gpuObject.isColorRenderTarget() || _gpuObject.getTexelFormat().getSemantic() == gpu::R11G11B10 || _gpuObject.getTexelFormat().getSemantic() == gpu::SRGB - || _gpuObject.getTexelFormat().getSemantic() == gpu::SRGBA) { - imageCI.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; - } else if (_gpuObject.isDepthStencilRenderTarget()) { + || _gpuObject.getTexelFormat().getSemantic() == gpu::SRGBA) {*/ + if (_gpuObject.isDepthStencilRenderTarget()) { imageCI.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; } else { - Q_ASSERT(false); + imageCI.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; } // Create image for this attachment