Fixing up Vulkan validation errors 70/317870/4
authorDavid Steele <david.steele@samsung.com>
Thu, 19 Sep 2024 09:56:27 +0000 (10:56 +0100)
committerDavid Steele <david.steele@samsung.com>
Wed, 25 Sep 2024 17:24:45 +0000 (18:24 +0100)
Changed BindVertexBuffers to use single instance
 (To work around GLES impl using 0)

Changed command submission to use PipelineStage: eFragmentShader

Added DeviceWaitIdle() to SwapBuffers() (now called from PostRender)
Ensured SwapBuffers() is called to change swapchain index.

Change-Id: I6c53e369c60969fb920d097bece73dea4b7da0f1

dali/internal/graphics/vulkan-impl/vulkan-command-buffer-impl.cpp
dali/internal/graphics/vulkan-impl/vulkan-swapchain-impl.cpp
dali/internal/graphics/vulkan/vulkan-device.cpp
dali/internal/graphics/vulkan/vulkan-graphics-impl.cpp

index cd3a1b4fee82376b1e8f539f1d9a0d882654e17c..85e869e1132962e128cf4b778754cc846ed7d6c8 100644 (file)
@@ -309,6 +309,10 @@ void CommandBufferImpl::Draw(uint32_t vertexCount,
       BindResources(set);
     }
   }
+  if(instanceCount == 0)
+  {
+    instanceCount = 1;
+  }
   mCommandBuffer.draw(vertexCount, instanceCount, firstVertex, firstInstance);
 }
 
@@ -328,6 +332,10 @@ void CommandBufferImpl::DrawIndexed(uint32_t indexCount,
     }
   }
   // draw here
+  if(instanceCount == 0)
+  {
+    instanceCount = 1;
+  }
   mCommandBuffer.drawIndexed(indexCount,
                              instanceCount,
                              firstIndex,
index 5d72ade4938c9ebab11217a8a1558a04115a1189..b4511f293b816c55b27aa5a479125ce70baf8fd8 100644 (file)
@@ -339,7 +339,7 @@ void Swapchain::Submit(CommandBufferImpl* commandBuffer)
   mGraphicsDevice.Submit(*mQueue,
                          {Vulkan::SubmissionData{
                            {swapchainBuffer->acquireNextImageSemaphore},
-                           {},
+                           {vk::PipelineStageFlagBits::eFragmentShader},
                            {commandBuffer},
                            {swapchainBuffer->submitSemaphore}}},
                          swapchainBuffer->endOfFrameFence.get());
index 68e9f89ee3dd7160bfcdf67c73fe9b6f60887692..24f12e22bbb8fb0c0150e2bb80ead38915cbe0de 100644 (file)
@@ -561,6 +561,7 @@ void Device::SurfaceResized(unsigned int width, unsigned int height)
 
 uint32_t Device::SwapBuffers()
 {
+  DeviceWaitIdle();
   mCurrentBufferIndex = (mCurrentBufferIndex + 1) & 1;
   return mCurrentBufferIndex;
 }
index 8784003d8117324354f6b5d27b1e4cf63c925771..43ffa2b6c001c6e5ecad4f19fa8b73d6a8b69f13 100644 (file)
@@ -123,6 +123,7 @@ void VulkanGraphics::MakeContextCurrent(Graphics::SurfaceId surfaceId)
 
 void VulkanGraphics::PostRender()
 {
+  mGraphicsDevice.SwapBuffers();
 }
 
 void VulkanGraphics::Shutdown()