Skip to content

Commit

Permalink
Merge branch 'SaschaWillems:master' into patch-compile-shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Vovan675 authored May 15, 2024
2 parents ad1a81b + 478b6c3 commit 460f1aa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions examples/computeshader/computeshader.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Vulkan Example - Compute shader image processing
*
*
* This sample uses a compute shader to apply different filters to an image
*
* Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
Expand Down Expand Up @@ -344,20 +344,20 @@ class VulkanExample : public VulkanExampleBase
// Create a semaphore for compute & graphics sync
VkSemaphoreCreateInfo semaphoreCreateInfo = vks::initializers::semaphoreCreateInfo();
VK_CHECK_RESULT(vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &graphics.semaphore));

// Signal the semaphore
VkSubmitInfo submitInfo = vks::initializers::submitInfo();
submitInfo.signalSemaphoreCount = 1;
submitInfo.pSignalSemaphores = &graphics.semaphore;
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
VK_CHECK_RESULT(vkQueueWaitIdle(queue));
VK_CHECK_RESULT(vkQueueWaitIdle(queue));

// Setup descriptors

// The graphics pipeline uses two sets with two bindings
// One set for displaying the input image and one set for displaying the output image with the compute filter applied
// Binding 0: Vertex shader uniform buffer
// Binding 1: Sampled image (before/after compute filter is applied)
// Binding 1: Sampled image (before/after compute filter is applied)

std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings = {
vks::initializers::descriptorSetLayoutBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_VERTEX_BIT, 0),
Expand Down Expand Up @@ -562,9 +562,11 @@ class VulkanExample : public VulkanExampleBase
virtual void render()
{
if (!prepared)
{
return;
draw();
}
updateUniformBuffers();
draw();
}

virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
Expand Down

0 comments on commit 460f1aa

Please sign in to comment.