MCPcopy Create free account
hub / github.com/defold/defold / VulkanDispatchCompute

Function VulkanDispatchCompute

engine/graphics/src/vulkan/graphics_vulkan.cpp:3275–3292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3273 }
3274
3275 static void VulkanDispatchCompute(HContext _context, uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z)
3276 {
3277 DM_PROFILE(__FUNCTION__);
3278 DM_PROPERTY_ADD_U32(rmtp_DispatchCalls, 1);
3279 VulkanContext* context = (VulkanContext*) _context;
3280
3281 // We can't run compute if we have started a render pass
3282 // Perhaps it would work if we could run it in a separate command buffer or a dedicated compute queue?
3283 if (IsRenderTargetbound(context, context->m_CurrentRenderTarget))
3284 {
3285 EndRenderPass(context);
3286 }
3287
3288 const uint8_t ix = context->m_CurrentFrameInFlight;
3289 VkCommandBuffer vk_command_buffer = context->m_MainCommandBuffers[ix];
3290 DrawSetupCompute(context, vk_command_buffer, &context->m_MainScratchBuffers[ix]);
3291 vkCmdDispatch(vk_command_buffer, group_count_x, group_count_y, group_count_z);
3292 }
3293
3294 static bool ValidateShaderModule(VulkanContext* context, ShaderMeta* meta, ShaderModule* shader, ShaderStageFlag stage_flags, char* error_buffer, uint32_t error_buffer_size)
3295 {

Callers

nothing calls this directly

Calls 3

IsRenderTargetboundFunction · 0.70
EndRenderPassFunction · 0.70
DrawSetupComputeFunction · 0.70

Tested by

no test coverage detected