1#ifndef HALIDE_RUNTIME_VULKAN_INTERNAL_H
2#define HALIDE_RUNTIME_VULKAN_INTERNAL_H
25class VulkanMemoryAllocator;
26struct VulkanShaderBinding;
27struct VulkanCompilationCacheEntry;
39VulkanMemoryAllocator *vk_create_memory_allocator(
void *user_context, VkDevice device, VkPhysicalDevice physical_device,
42int vk_destroy_memory_allocator(
void *user_context, VulkanMemoryAllocator *allocator);
43int vk_clear_device_buffer(
void *user_context,
44 VulkanMemoryAllocator *allocator,
45 VkCommandPool command_pool,
46 VkQueue command_queue,
47 VkBuffer device_buffer);
54 VulkanMemoryAllocator **allocator,
57 VkPhysicalDevice *physical_device,
58 VkCommandPool *command_pool,
59 VkQueue *queue,
uint32_t *queue_family_index);
61int vk_destroy_context(
63 VulkanMemoryAllocator *allocator,
66 VkPhysicalDevice physical_device,
67 VkCommandPool command_pool,
70int vk_find_compute_capability(
void *user_context,
int *major,
int *minor);
73int vk_destroy_instance(
void *user_context, VkInstance instance,
const VkAllocationCallbacks *alloc_callbacks);
75int vk_select_device_for_context(
void *user_context,
76 VkInstance *instance, VkDevice *device,
77 VkPhysicalDevice *physical_device,
80int vk_create_device(
void *user_context,
const StringTable &requested_layers, VkInstance *instance, VkDevice *device, VkQueue *queue,
91uint32_t vk_get_supported_device_extensions(
void *user_context, VkPhysicalDevice physical_device,
StringTable &ext_table);
92bool vk_validate_required_extension_support(
void *user_context,
101int vk_create_command_pool(
void *user_context, VulkanMemoryAllocator *allocator,
uint32_t queue_index, VkCommandPool *command_pool);
102int vk_destroy_command_pool(
void *user_context, VulkanMemoryAllocator *allocator, VkCommandPool command_pool);
105const VkCommandPool VkInvalidCommandPool(
uint64_t(-1));
108int vk_create_command_buffer(
void *user_context, VulkanMemoryAllocator *allocator, VkCommandPool pool, VkCommandBuffer *command_buffer);
109int vk_destroy_command_buffer(
void *user_context, VulkanMemoryAllocator *allocator, VkCommandPool command_pool, VkCommandBuffer command_buffer);
111int vk_fill_command_buffer_with_dispatch_call(
void *user_context,
113 VkCommandBuffer command_buffer,
114 VkPipeline compute_pipeline,
116 VkDescriptorSet descriptor_set,
118 int blocksX,
int blocksY,
int blocksZ);
120int vk_submit_command_buffer(
void *user_context, VkQueue queue, VkCommandBuffer command_buffer);
123bool vk_needs_scalar_uniform_buffer(
void *user_context,
128size_t vk_estimate_scalar_uniform_buffer_size(
void *user_context,
133MemoryRegion *vk_create_scalar_uniform_buffer(
void *user_context,
134 VulkanMemoryAllocator *allocator,
135 size_t scalar_buffer_size);
137int vk_update_scalar_uniform_buffer(
void *user_context,
138 VulkanMemoryAllocator *allocator,
144int vk_destroy_scalar_uniform_buffer(
void *user_context, VulkanMemoryAllocator *allocator,
147int vk_create_descriptor_pool(
void *user_context,
148 VulkanMemoryAllocator *allocator,
151 VkDescriptorPool *descriptor_pool);
153int vk_destroy_descriptor_pool(
void *user_context,
154 VulkanMemoryAllocator *allocator,
155 VkDescriptorPool descriptor_pool);
158uint32_t vk_count_bindings_for_descriptor_set(
void *user_context,
163int vk_create_descriptor_set_layout(
void *user_context,
164 VulkanMemoryAllocator *allocator,
167 VkDescriptorSetLayout *layout);
169int vk_destroy_descriptor_set_layout(
void *user_context,
170 VulkanMemoryAllocator *allocator,
171 VkDescriptorSetLayout descriptor_set_layout);
174int vk_create_descriptor_set(
void *user_context,
175 VulkanMemoryAllocator *allocator,
176 VkDescriptorSetLayout descriptor_set_layout,
177 VkDescriptorPool descriptor_pool,
178 VkDescriptorSet *descriptor_set);
180int vk_update_descriptor_set(
void *user_context,
181 VulkanMemoryAllocator *allocator,
182 VkBuffer *scalar_args_buffer,
183 size_t uniform_buffer_count,
184 size_t storage_buffer_count,
188 VkDescriptorSet descriptor_set);
191int vk_create_pipeline_layout(
void *user_context,
192 VulkanMemoryAllocator *allocator,
197int vk_destroy_pipeline_layout(
void *user_context,
198 VulkanMemoryAllocator *allocator,
201int vk_create_compute_pipeline(
void *user_context,
202 VulkanMemoryAllocator *allocator,
203 const char *pipeline_name,
207 VkPipeline *compute_pipeline);
209int vk_setup_compute_pipeline(
void *user_context,
210 VulkanMemoryAllocator *allocator,
214 VkPipeline *compute_pipeline);
216int vk_destroy_compute_pipeline(
void *user_context,
217 VulkanMemoryAllocator *allocator,
218 VkPipeline compute_pipeline);
221VulkanShaderBinding *vk_decode_shader_bindings(
void *user_context, VulkanMemoryAllocator *allocator,
224VulkanCompilationCacheEntry *vk_compile_shader_module(
void *user_context, VulkanMemoryAllocator *allocator,
225 const char *src,
int size);
227int vk_destroy_shader_modules(
void *user_context, VulkanMemoryAllocator *allocator);
230int vk_do_multidimensional_copy(
void *user_context, VkCommandBuffer command_buffer,
232 int d,
bool from_host,
bool to_host);
239const char *vk_get_error_name(
VkResult error) {
244 return "VK_NOT_READY";
248 return "VK_EVENT_SET";
250 return "VK_EVENT_RESET";
252 return "VK_INCOMPLETE";
254 return "VK_ERROR_OUT_OF_HOST_MEMORY";
256 return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
258 return "VK_ERROR_INITIALIZATION_FAILED";
260 return "VK_ERROR_DEVICE_LOST";
262 return "VK_ERROR_MEMORY_MAP_FAILED";
264 return "VK_ERROR_LAYER_NOT_PRESENT";
266 return "VK_ERROR_EXTENSION_NOT_PRESENT";
268 return "VK_ERROR_FEATURE_NOT_PRESENT";
270 return "VK_ERROR_INCOMPATIBLE_DRIVER";
272 return "VK_ERROR_TOO_MANY_OBJECTS";
274 return "VK_ERROR_FORMAT_NOT_SUPPORTED";
276 return "VK_ERROR_FRAGMENTED_POOL";
278 return "VK_ERROR_SURFACE_LOST_KHR";
280 return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
282 return "VK_SUBOPTIMAL_KHR";
284 return "VK_ERROR_OUT_OF_DATE_KHR";
286 return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
288 return "VK_ERROR_VALIDATION_FAILED_EXT";
290 return "VK_ERROR_INVALID_SHADER_NV";
292 return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
294 return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
296 return "<Unknown Vulkan Result Code>";
@ VK_ERROR_VALIDATION_FAILED_EXT
@ VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR
@ VK_ERROR_INVALID_SHADER_NV
@ VK_ERROR_EXTENSION_NOT_PRESENT
@ VK_ERROR_OUT_OF_POOL_MEMORY_KHR
@ VK_ERROR_OUT_OF_HOST_MEMORY
@ VK_ERROR_INITIALIZATION_FAILED
@ VK_ERROR_INCOMPATIBLE_DISPLAY_KHR
@ VK_ERROR_OUT_OF_DEVICE_MEMORY
@ VK_ERROR_NATIVE_WINDOW_IN_USE_KHR
@ VK_ERROR_OUT_OF_DATE_KHR
@ VK_ERROR_FORMAT_NOT_SUPPORTED
@ VK_ERROR_FRAGMENTED_POOL
@ VK_ERROR_SURFACE_LOST_KHR
@ VK_ERROR_FEATURE_NOT_PRESENT
@ VK_ERROR_TOO_MANY_OBJECTS
@ VK_ERROR_MEMORY_MAP_FAILED
@ VK_ERROR_LAYER_NOT_PRESENT
@ VK_ERROR_INCOMPATIBLE_DRIVER
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
unsigned __INT64_TYPE__ uint64_t
signed __INT64_TYPE__ int64_t
unsigned __INT32_TYPE__ uint32_t
signed __INT8_TYPE__ int8_t
VkDescriptorSetLayout * descriptor_set_layouts
VulkanShaderBinding * shader_bindings
VkPipelineLayout pipeline_layout
VkShaderModule shader_module
The raw representation of an image passed around by generated Halide code.