diff --git a/auto_vk_toolkit/src/window.cpp b/auto_vk_toolkit/src/window.cpp index b6cdc8d6..53ae1874 100644 --- a/auto_vk_toolkit/src/window.cpp +++ b/auto_vk_toolkit/src/window.cpp @@ -834,8 +834,8 @@ namespace avk auto newRenderPass = context().create_renderpass(renderpassAttachments, { // We only create one subpass here => create default dependencies as per specification chapter 8.1) Render Pass Creation: avk::subpass_dependency{avk::subpass::external >> avk::subpass::index(0), - stage::color_attachment_output >> stage::early_fragment_tests | stage::late_fragment_tests | stage::color_attachment_output, - access::none >> access::color_attachment_read | access::color_attachment_write | access::depth_stencil_attachment_read | access::depth_stencil_attachment_write + stage::late_fragment_tests | stage::color_attachment_output >> stage::early_fragment_tests | stage::late_fragment_tests | stage::color_attachment_output, + access::depth_stencil_attachment_write >> access::color_attachment_read | access::color_attachment_write | access::depth_stencil_attachment_read | access::depth_stencil_attachment_write }, avk::subpass_dependency{avk::subpass::index(0) >> avk::subpass::external, stage::color_attachment_output >> stage::color_attachment_output, diff --git a/examples/framebuffer/source/framebuffer.cpp b/examples/framebuffer/source/framebuffer.cpp index 060e8726..7407d1c9 100644 --- a/examples/framebuffer/source/framebuffer.cpp +++ b/examples/framebuffer/source/framebuffer.cpp @@ -311,9 +311,6 @@ int main() // <== Starting point == // Compile all the configuration parameters and the invokees into a "composition": auto composition = configure_and_compose( avk::application_name("Auto-Vk-Toolkit Example: Framebuffers"), - [](avk::validation_layers& config) { - //config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); - }, // Pass windows: mainWnd, // Pass invokees: diff --git a/examples/multiple_queues/source/multiple_queues.cpp b/examples/multiple_queues/source/multiple_queues.cpp index 0a8c2c93..b42a74f4 100644 --- a/examples/multiple_queues/source/multiple_queues.cpp +++ b/examples/multiple_queues/source/multiple_queues.cpp @@ -159,9 +159,7 @@ class multiple_queues_app : public avk::invokee // A queue family ownership transfer consists of two distinct parts (as per specification 7.7.4. Queue Family Ownership Transfer): // 2. Acquire exclusive ownership for the destination queue family - // TODO: Problem here vvv Why can't Auto-Vk find out stage and access in this case? It evaluates to none+none. - return sync::buffer_memory_barrier(vertexBuffer, stage::copy + access::transfer_write >> stage::auto_stages() + access::auto_accesses()) - //return sync::buffer_memory_barrier(vertexBuffer, stage::copy + access::transfer_write >> stage::auto_stage + access::auto_access) + return sync::buffer_memory_barrier(vertexBuffer, stage::copy + access::transfer_write >> stage::auto_stage + access::auto_access) .with_queue_family_ownership_transfer(mGraphicsQueue->family_index(), mTransferQueues[j]->family_index()); } ), diff --git a/examples/orca_loader/source/orca_loader.cpp b/examples/orca_loader/source/orca_loader.cpp index bbdfb022..8cec6b40 100644 --- a/examples/orca_loader/source/orca_loader.cpp +++ b/examples/orca_loader/source/orca_loader.cpp @@ -647,7 +647,7 @@ int main() // <== Starting point == auto composition = configure_and_compose( avk::application_name("Auto-Vk-Toolkit Example: ORCA Loader"), [](avk::validation_layers& config) { - //config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); + config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); }, // Pass windows: mainWnd, diff --git a/examples/present_from_compute/source/present_from_compute.cpp b/examples/present_from_compute/source/present_from_compute.cpp index d7c3cb6e..24d6ca72 100644 --- a/examples/present_from_compute/source/present_from_compute.cpp +++ b/examples/present_from_compute/source/present_from_compute.cpp @@ -205,7 +205,7 @@ class present_from_compute_app : public avk::invokee mVertexBuffers[inFlightIndex]->fill(vertexDataCurrentFrame.data(), 0), // Release exclusive ownership from the transfer queue: - sync::buffer_memory_barrier(mVertexBuffers[inFlightIndex].as_reference(), stage::auto_stage + access::auto_access >> stage::none + access::none) + sync::buffer_memory_barrier(mVertexBuffers[inFlightIndex].as_reference(), stage::auto_stage + access::auto_access >> stage::copy + access::transfer_write) .with_queue_family_ownership_transfer(mTransferQueue.family_index(), mGraphicsQueue.family_index()) }, mTransferQueue, stage::auto_stage // Let the framework determine the (source) stage after which the semaphore can be signaled (will be stage::copy due to buffer_t::fill) @@ -245,7 +245,7 @@ class present_from_compute_app : public avk::invokee ), // Acquire exclusive ownership for the graphics queue: - sync::buffer_memory_barrier(mVertexBuffers[inFlightIndex].as_reference(), stage::none + access::none >> stage::vertex_attribute_input + access::vertex_attribute_read) + sync::buffer_memory_barrier(mVertexBuffers[inFlightIndex].as_reference(), stage::copy + access::transfer_write >> stage::vertex_attribute_input + access::vertex_attribute_read) .with_queue_family_ownership_transfer(mTransferQueue.family_index(), mGraphicsQueue.family_index()), // Begin and end one renderpass: @@ -322,7 +322,7 @@ class present_from_compute_app : public avk::invokee // Submit the dispatch calls to the compute queue: avk::context().record({ // Acquire exclusive ownership from the graphics queue: - sync::image_memory_barrier(mFramebuffers[inFlightIndex]->image_at(0), stage::none + access::none >> stage::auto_stage + access::auto_access) + sync::image_memory_barrier(mFramebuffers[inFlightIndex]->image_at(0), stage::copy + access::transfer_write >> stage::auto_stage + access::auto_access) .with_queue_family_ownership_transfer(mGraphicsQueue.family_index(), mComputeQueue.family_index()), sync::image_memory_barrier(mFramebuffers[inFlightIndex]->image_at(0), stage::auto_stage + access::auto_access >> stage::auto_stage + access::auto_access) @@ -438,9 +438,6 @@ int main() // <== Starting point == // Compile all the configuration parameters and the invokees into a "composition": auto composition = configure_and_compose( avk::application_name("Auto-Vk-Toolkit Example: Present from Compute"), - [](avk::validation_layers& config) { - //config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); - }, // Pass windows: mainWnd, // Pass invokees: diff --git a/examples/ray_query_in_ray_tracing_shaders/source/ray_query_in_ray_tracing_shaders.cpp b/examples/ray_query_in_ray_tracing_shaders/source/ray_query_in_ray_tracing_shaders.cpp index 9a6441a6..6115c7c1 100644 --- a/examples/ray_query_in_ray_tracing_shaders/source/ray_query_in_ray_tracing_shaders.cpp +++ b/examples/ray_query_in_ray_tracing_shaders/source/ray_query_in_ray_tracing_shaders.cpp @@ -340,9 +340,10 @@ class ray_query_in_ray_tracing_shaders_invokee : public avk::invokee avk::stage::ray_tracing_shader >> avk::stage::copy, avk::access::shader_write >> avk::access::transfer_read ).with_layout_transition(avk::layout::general >> avk::layout::transfer_src), + // Use dst stage + access to synchronize the image layout transition: avk::sync::image_memory_barrier(mainWnd->current_backbuffer_reference().image_at(0), - avk::stage::none >> avk::stage::copy, - avk::access::none >> avk::access::transfer_write + avk::stage::color_attachment_output >> avk::stage::copy, + avk::access::color_attachment_write >> avk::access::transfer_write ).with_layout_transition(avk::layout::undefined >> avk::layout::transfer_dst), avk::copy_image_to_another( @@ -461,6 +462,9 @@ int main() // <== Starting point == // Compile all the configuration parameters and the invokees into a "composition": auto composition = configure_and_compose( avk::application_name("Auto-Vk-Toolkit Example: Ray Query in Ray Tracing Shaders"), + [](avk::validation_layers& config) { + config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); + }, avk::required_device_extensions() // We need several extensions for ray tracing: .add_extension(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME) diff --git a/examples/ray_tracing_custom_intersection/source/ray_tracing_custom_intersection.cpp b/examples/ray_tracing_custom_intersection/source/ray_tracing_custom_intersection.cpp index 47cc1b48..20ebca09 100644 --- a/examples/ray_tracing_custom_intersection/source/ray_tracing_custom_intersection.cpp +++ b/examples/ray_tracing_custom_intersection/source/ray_tracing_custom_intersection.cpp @@ -367,9 +367,10 @@ class ray_tracing_custom_intersection_app : public avk::invokee avk::stage::ray_tracing_shader >> avk::stage::copy, avk::access::shader_write >> avk::access::transfer_read ).with_layout_transition(avk::layout::general >> avk::layout::transfer_src), + // Use dst stage + access to synchronize the image layout transition: avk::sync::image_memory_barrier(mainWnd->current_backbuffer_reference().image_at(0), - avk::stage::none >> avk::stage::copy, - avk::access::none >> avk::access::transfer_write + avk::stage::color_attachment_output >> avk::stage::copy, + avk::access::color_attachment_write >> avk::access::transfer_write ).with_layout_transition(avk::layout::undefined >> avk::layout::transfer_dst), avk::copy_image_to_another( @@ -449,6 +450,9 @@ int main() // <== Starting point == // Compile all the configuration parameters and the invokees into a "composition": auto composition = configure_and_compose( avk::application_name("Auto-Vk-Toolkit Example: Real-Time Ray Tracing - Custom Intersection Example"), + [](avk::validation_layers& config) { + config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); + }, #if VK_HEADER_VERSION >= 162 avk::required_device_extensions() // We need several extensions for ray tracing: diff --git a/examples/ray_tracing_with_shadows_and_ao/source/ray_tracing_with_shadows_and_ao.cpp b/examples/ray_tracing_with_shadows_and_ao/source/ray_tracing_with_shadows_and_ao.cpp index 5da89e00..6dcb3a67 100644 --- a/examples/ray_tracing_with_shadows_and_ao/source/ray_tracing_with_shadows_and_ao.cpp +++ b/examples/ray_tracing_with_shadows_and_ao/source/ray_tracing_with_shadows_and_ao.cpp @@ -341,9 +341,10 @@ class ray_tracing_with_shadows_and_ao_invokee : public avk::invokee avk::stage::ray_tracing_shader >> avk::stage::copy, avk::access::shader_write >> avk::access::transfer_read ).with_layout_transition(avk::layout::general >> avk::layout::transfer_src), + // Use dst stage + access to synchronize the image layout transition: avk::sync::image_memory_barrier(mainWnd->current_backbuffer_reference().image_at(0), - avk::stage::none >> avk::stage::copy, - avk::access::none >> avk::access::transfer_write + avk::stage::color_attachment_output >> avk::stage::copy, + avk::access::color_attachment_write >> avk::access::transfer_write ).with_layout_transition(avk::layout::undefined >> avk::layout::transfer_dst), avk::copy_image_to_another( @@ -463,6 +464,9 @@ int main() // <== Starting point == // Compile all the configuration parameters and the invokees into a "composition": auto composition = configure_and_compose( avk::application_name("Auto-Vk-Toolkit Example: Real-Time Ray Tracing with Shadows and AO"), + [](avk::validation_layers& config) { + config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); + }, avk::required_device_extensions() // We need several extensions for ray tracing: .add_extension(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME) diff --git a/examples/vertex_buffers/source/vertex_buffers.cpp b/examples/vertex_buffers/source/vertex_buffers.cpp index f79b3e1d..88390181 100644 --- a/examples/vertex_buffers/source/vertex_buffers.cpp +++ b/examples/vertex_buffers/source/vertex_buffers.cpp @@ -148,6 +148,13 @@ class vertex_buffers_app : public avk::invokee auto cmdBfr = commandPool->alloc_command_buffer(vk::CommandBufferUsageFlagBits::eOneTimeSubmit); avk::context().record({ + // Synchronization validation is unable to figure out that frame-3 used this buffer, but is no longer needing it. + // => so we've gotta be explicitly synchronizing it with this barrier: + avk::sync::buffer_memory_barrier(mVertexBuffers[inFlightIndex].as_reference(), + avk::stage::vertex_attribute_input >> avk::stage::copy , + avk::access::vertex_attribute_read >> avk::access::transfer_write + ), + // Fill the vertex buffer that corresponds to this the current inFlightIndex: mVertexBuffers[inFlightIndex]->fill(vertexDataCurrentFrame.data(), 0), @@ -219,7 +226,7 @@ int main() // <== Starting point == auto composition = configure_and_compose( avk::application_name("Auto-Vk-Toolkit Example: Vertex Buffers"), [](avk::validation_layers& config) { - //config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); + config.enable_feature(vk::ValidationFeatureEnableEXT::eSynchronizationValidation); }, // Pass windows: mainWnd,