]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/commands_backend.cpp
Support compute shaders and compute operations
[libs/gl.git] / source / backends / vulkan / commands_backend.cpp
index ff9e6cf62da0ae0b851e11f572dd416cabddd968..bca1a678940d75b1625a59ac03a62c719efd86e6 100644 (file)
@@ -233,6 +233,23 @@ void VulkanCommands::draw_instanced(const Batch &batch, unsigned count)
        vkCmd.DrawIndexed(batch.size(), count, first_index, 0, 0);
 }
 
+void VulkanCommands::dispatch(unsigned count_x, unsigned count_y, unsigned count_z)
+{
+       if(!pipeline_state)
+               throw invalid_operation("VulkanCommands::draw_instanced");
+
+       if(framebuffer)
+               end_render_pass();
+
+       VulkanCommandRecorder vkCmd(device.get_functions(), primary_buffer);
+
+       pipeline_state->refresh();
+       pipeline_state->synchronize_resources();
+       device.get_synchronizer().barrier(vkCmd);
+       pipeline_state->apply(vkCmd, 0, frame_index, false);
+       vkCmd.Dispatch(count_x, count_y, count_z);
+}
+
 void VulkanCommands::resolve_multisample(Framebuffer &)
 {
        throw logic_error("VulkanCommands::resolve_multisample is unimplemented");