13 #include <android_native_app_glue.h> 14 #include <android/asset_manager.h> 15 #define VK_USE_PLATFORM_ANDROID_KHR 16 extern struct android_app *vkz_android_app;
20 #include <MoltenVK/mvk_vulkan.h> 22 #include <vulkan/vulkan.h> 69 const char** enabled_extension_names,
70 size_t enabled_extension_count);
139 int (*set_input_state)(VkPipelineVertexInputStateCreateInfo*),
140 int (*set_pipeline_layout)(VkPipelineLayoutCreateInfo*), uint32_t* index);
159 const VkCommandBuffer* command_buffer);
219 int vkz_draw(VkCommandBuffer* command_buffer);
231 VkBufferUsageFlags buffer_usage_flags,
232 uint32_t buffer_size,
233 VkDeviceMemory* memory,
234 VkMemoryPropertyFlags memory_property_flags);
252 int vkz_copy_buffer(VkBuffer source, VkBuffer destination, VkDeviceSize size);
267 uint32_t image_width, uint32_t image_height,
268 VkFormat image_format, VkImageTiling image_tiling,
269 VkImageUsageFlags image_usage_flags,
270 VkDeviceMemory* memory,
271 VkMemoryPropertyFlags memory_property_flags);
290 VkImageLayout old_layout,
291 VkImageLayout new_layout);
302 uint32_t width, uint32_t height);
313 VkFormat format, VkImageAspectFlags aspect_flags);
VkPhysicalDevice vkz_physical_device
The physical device that is selected vkz_init().
Definition: vkzos.c:92
uint32_t vkz_swapchain_image_count
Number of images in the swapchain, set by vkz_create_swapchain().
Definition: vkzos.c:110
int vkz_destroy_swapchain(void)
Destroy the swapchain.
Definition: vkzos.c:963
VkClearColorValue vkz_clear_colour
The colour used to clear the screen.
Definition: vkzos.c:94
int vkz_transition_image_layout(VkImage image, VkFormat format, VkImageLayout old_layout, VkImageLayout new_layout)
Transition the layout of a Vulkan image.
Definition: vkzos.c:1818
int vkz_destroy_buffer(VkBuffer buffer, VkDeviceMemory memory)
Destroy a buffer.
Definition: vkzos.c:1703
int vkz_destroy_sync_objects(void)
Destroy sync objects for a given pipeline.
Definition: vkzos.c:1532
int vkz_init(void)
Initialise. Internally this means create physical device, select queue families and create logical de...
Definition: vkzos.c:666
int vkz_acquire_next_image(uint32_t pipeline_index, uint32_t *image_index)
Acquire next swapchain image.
Definition: vkzos.c:1569
int vkz_destroy_draw_command_buffer(VkCommandBuffer *command_buffer)
Destroy a command buffer.
Definition: vkzos.c:1477
int vkz_create_swapchain(int with_image_sampler)
Create the swapchain that will be used. This will also create the associated image views.
Definition: vkzos.c:874
int vkz_create_sampler(VkSampler *sampler)
Create a Vulkan sampler.
Definition: vkzos.c:1918
int vkz_bind_pipeline_to_command_buffer(uint32_t pipeline_index, const VkCommandBuffer *command_buffer)
Bind a pipeline to a command buffer.
Definition: vkzos.c:1456
int vkz_end_draw_command_buffer(VkCommandBuffer *command_buffer)
Finish recording a command buffer.
Definition: vkzos.c:1466
int vkz_draw(VkCommandBuffer *command_buffer)
Send draw commands (will take effect on the current pipeline image acquired by vkz_acquire_next_image...
Definition: vkzos.c:1617
int vkz_present_next_image(void)
Present next swapchain image (the one acquired by vkz_acquire_next_image())
Definition: vkzos.c:1591
int vkz_create_pipeline(const char *vertex_shader_path, const char *fragment_shader_path, int(*set_input_state)(VkPipelineVertexInputStateCreateInfo *), int(*set_pipeline_layout)(VkPipelineLayoutCreateInfo *), uint32_t *index)
Create a pipeline. This will also create associated Vulkan objects.
Definition: vkzos.c:1041
int vkz_destroy_depth_image(void)
Destroy the image used for depth testing.
Definition: vkzos.c:659
int vkz_recreate_pipelines_and_swapchain(void)
Recreate the swapchain and the pipelines.
Definition: vkzos.c:1553
int vkz_create_depth_image(void)
Create the image used for depth testing. This function must be called right after vkz_create_swapchai...
Definition: vkzos.c:616
int vkz_destroy_image(VkImage image, VkDeviceMemory image_memory)
Destroy a Vulkan image.
Definition: vkzos.c:1812
int vkz_create_buffer(VkBuffer *buffer, VkBufferUsageFlags buffer_usage_flags, uint32_t buffer_size, VkDeviceMemory *memory, VkMemoryPropertyFlags memory_property_flags)
Create a buffer.
Definition: vkzos.c:1661
VkInstance vkz_instance
The Vulkan instance.
Definition: vkzos.c:90
int vkz_set_width_height(const uint32_t width, const uint32_t height)
Set width and height for all rendering calculations.
Definition: vkzos.c:868
int vkz_create_image_view(VkImageView *image_view, VkImage image, VkFormat format, VkImageAspectFlags aspect_flags)
Create a Vulkan image view.
Definition: vkzos.c:703
int vkz_create_sync_objects(void)
Create sync objects for a given pipeline.
Definition: vkzos.c:1493
VkSurfaceKHR vkz_surface
The surface on which graphics will be presented.
Definition: vkzos.c:91
int vkz_create_instance(const char *application_name, const char **enabled_extension_names, size_t enabled_extension_count)
Create a vulkan instance.
Definition: vkzos.c:153
VkPipelineLayout * vkz_pipeline_layout
The pipeline layouts, one for each pipeline created.
Definition: vkzos.c:135
VkDevice vkz_logical_device
The logical device that is created by vkz_init().
Definition: vkzos.c:93
int vkz_copy_buffer(VkBuffer source, VkBuffer destination, VkDeviceSize size)
Copy a buffer to another.
Definition: vkzos.c:1748
int vkz_copy_buffer_to_image(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height)
Copy a buffer to an image.
Definition: vkzos.c:1890
int vkz_begin_draw_command_buffer(VkCommandBuffer *command_buffer)
Begin creating a drawing command buffer for a given pipeline not bound to a specific pipeline.
Definition: vkzos.c:1398
int vkz_shutdown(void)
Cleanup the memory, destroy any debug callbacks, as well as the logical device and the Vulkan instanc...
Definition: vkzos.c:1941
int vkz_create_image(VkImage *image, uint32_t image_width, uint32_t image_height, VkFormat image_format, VkImageTiling image_tiling, VkImageUsageFlags image_usage_flags, VkDeviceMemory *memory, VkMemoryPropertyFlags memory_property_flags)
Create a Vulkan image.
Definition: vkzos.c:1762