![]() |
The small3d framework
|
vkzos header file More...
#include <vulkan/vulkan.h>Go to the source code of this file.
Functions | |
| int | vkz_create_instance (const char *application_name, const char **enabled_extension_names, size_t enabled_extension_count) |
| Create a vulkan instance. More... | |
| int | vkz_init (void) |
| Initialise. Internally this means create physical device, select queue families and create logical device. More... | |
| int | vkz_set_width_height (const uint32_t width, const uint32_t height) |
| Set width and height for all rendering calculations. More... | |
| int | vkz_create_swapchain (int with_image_sampler) |
| Create the swapchain that will be used. This will also create the associated image views. More... | |
| int | vkz_destroy_swapchain (void) |
| Destroy the swapchain. | |
| int | vkz_create_depth_image (void) |
| Create the image used for depth testing. This function must be called right after vkz_create_swapchain(). This is not perfect but, for the time being it is what it is. | |
| int | vkz_destroy_depth_image (void) |
| Destroy the image used for depth testing. | |
| 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. More... | |
| 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. More... | |
| int | vkz_bind_pipeline_to_command_buffer (uint32_t pipeline_index, const VkCommandBuffer *command_buffer) |
| Bind a pipeline to a command buffer. More... | |
| int | vkz_end_draw_command_buffer (VkCommandBuffer *command_buffer) |
| Finish recording a command buffer. More... | |
| int | vkz_destroy_draw_command_buffer (VkCommandBuffer *command_buffer) |
| Destroy a command buffer. More... | |
| int | vkz_create_sync_objects (void) |
| Create sync objects for a given pipeline. More... | |
| int | vkz_destroy_sync_objects (void) |
| Destroy sync objects for a given pipeline. More... | |
| int | vkz_recreate_pipelines_and_swapchain (void) |
| Recreate the swapchain and the pipelines. More... | |
| int | vkz_acquire_next_image (uint32_t pipeline_index, uint32_t *image_index) |
| Acquire next swapchain image. More... | |
| int | vkz_present_next_image (void) |
| Present next swapchain image (the one acquired by vkz_acquire_next_image()) More... | |
| int | vkz_draw (VkCommandBuffer *command_buffer) |
| Send draw commands (will take effect on the current pipeline image acquired by vkz_acquire_next_image()) More... | |
| int | vkz_create_buffer (VkBuffer *buffer, VkBufferUsageFlags buffer_usage_flags, uint32_t buffer_size, VkDeviceMemory *memory, VkMemoryPropertyFlags memory_property_flags) |
| Create a buffer. More... | |
| int | vkz_destroy_buffer (VkBuffer buffer, VkDeviceMemory memory) |
| Destroy a buffer. More... | |
| int | vkz_copy_buffer (VkBuffer source, VkBuffer destination, VkDeviceSize size) |
| Copy a buffer to another. More... | |
| 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. More... | |
| int | vkz_destroy_image (VkImage image, VkDeviceMemory image_memory) |
| Destroy a Vulkan image. More... | |
| int | vkz_transition_image_layout (VkImage image, VkFormat format, VkImageLayout old_layout, VkImageLayout new_layout) |
| Transition the layout of a Vulkan image. More... | |
| int | vkz_copy_buffer_to_image (VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) |
| Copy a buffer to an image. More... | |
| int | vkz_create_image_view (VkImageView *image_view, VkImage image, VkFormat format, VkImageAspectFlags aspect_flags) |
| Create a Vulkan image view. More... | |
| int | vkz_create_sampler (VkSampler *sampler) |
| Create a Vulkan sampler. More... | |
| int | vkz_shutdown (void) |
| Cleanup the memory, destroy any debug callbacks, as well as the logical device and the Vulkan instance. More... | |
Variables | |
| VkInstance | vkz_instance |
| The Vulkan instance. | |
| VkSurfaceKHR | vkz_surface |
| The surface on which graphics will be presented. | |
| VkPhysicalDevice | vkz_physical_device |
| The physical device that is selected vkz_init(). | |
| VkDevice | vkz_logical_device |
| The logical device that is created by vkz_init(). | |
| VkPipelineLayout * | vkz_pipeline_layout |
| The pipeline layouts, one for each pipeline created. | |
| uint32_t | vkz_swapchain_image_count |
| Number of images in the swapchain, set by vkz_create_swapchain(). | |
| VkClearColorValue | vkz_clear_colour |
| The colour used to clear the screen. | |
vkzos header file
Created on: 2018/05/01 Author: Dimitri Kourkoulis License: BSD 3-Clause License (see LICENSE file)
| int vkz_acquire_next_image | ( | uint32_t | pipeline_index, |
| uint32_t * | image_index | ||
| ) |
Acquire next swapchain image.
| pipeline_index | The index of the pipeline TODO: Independentise synchronisation from pipelines perhaps... |
| image_index | The index of the acquired swapchain image |
| 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.
| command_buffer | Pointer to the command buffer. |
| int vkz_bind_pipeline_to_command_buffer | ( | uint32_t | pipeline_index, |
| const VkCommandBuffer * | command_buffer | ||
| ) |
Bind a pipeline to a command buffer.
| pipeline_index | The index of the pipeline |
| command_buffer | Pointer to the command buffer. |
| int vkz_copy_buffer | ( | VkBuffer | source, |
| VkBuffer | destination, | ||
| VkDeviceSize | size | ||
| ) |
Copy a buffer to another.
| source | The source buffer |
| destination | The destination buffer |
| size | The size of the buffer to be copied, in bytes |
| int vkz_copy_buffer_to_image | ( | VkBuffer | buffer, |
| VkImage | image, | ||
| uint32_t | width, | ||
| uint32_t | height | ||
| ) |
Copy a buffer to an image.
| buffer | The buffer |
| image | The image |
| width | The width of the image |
| height | The height of the image |
| int vkz_create_buffer | ( | VkBuffer * | buffer, |
| VkBufferUsageFlags | buffer_usage_flags, | ||
| uint32_t | buffer_size, | ||
| VkDeviceMemory * | memory, | ||
| VkMemoryPropertyFlags | memory_property_flags | ||
| ) |
Create a buffer.
| buffer | Variable in which to store the buffer |
| buffer_usage_flags | Vulkan usage flags for the buffer |
| buffer_size | The size of the buffer, in bytes |
| memory | The GPU memory reserved for the buffer |
| memory_property_flags | Vulkan properties of the reserved memory |
| 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.
| image | Variable in which to store the image |
| image_width | The width of the image |
| image_height | The height of the image |
| image_format | The format of the image |
| image_tiling | The tiling of the image |
| image_usage_flags | The usage flags of the image |
| memory | The GPU memory reserved for the image |
| memory_property_flags | Vulkan properties of the reserved memory |
| int vkz_create_image_view | ( | VkImageView * | image_view, |
| VkImage | image, | ||
| VkFormat | format, | ||
| VkImageAspectFlags | aspect_flags | ||
| ) |
Create a Vulkan image view.
| image_view | The image view to be created |
| image | The image for which the image view will be created |
| format | The image view format |
| aspect_flags | The aspect flags (mask) e.g. VK_IMAGE_ASPECT_COLOR_BIT |
| int vkz_create_instance | ( | const char * | application_name, |
| const char ** | enabled_extension_names, | ||
| size_t | enabled_extension_count | ||
| ) |
Create a vulkan instance.
| application_name | The name of the application that will be using Vulkan |
| enabled_extension_names | Names of extensions used |
| enabled_extension_count | Number of extensions used |
| int vkz_create_pipeline | ( | const char * | vertex_shader_path, |
| const char * | fragment_shader_path, | ||
| int(*)(VkPipelineVertexInputStateCreateInfo *) | set_input_state, | ||
| int(*)(VkPipelineLayoutCreateInfo *) | set_pipeline_layout, | ||
| uint32_t * | index | ||
| ) |
Create a pipeline. This will also create associated Vulkan objects.
| vertex_shader_path | The path to the SPV file for the vertex shader that will be used in the pipeline. |
| fragment_shader_path | The path to the SPV file for the fragment shader that will be used in the pipeline. |
| set_input_state | Callback function, allowing e.g. the addition of information on buffers that will be used by the pipeline (vertex, uniform) before the pipeline is created. If there is no such information to be added, NULL should be passed here. |
| set_pipeline_layout | Callback function, allowing e.g. the addition of information on descriptors that will be used by the pipeline before the pipeline is created. If there is no such information to be added, NULL should be passed here. |
| index | If 100 is passed here, a new "slot" will be used for the pipeline and returned via the same variable. If not, the pipeline will be created over a previously deleted pipeline at the index position of the internal array containing pipelines. In that case, the shader path parameters will be ignored, because the previously used shaders will be reused. Also in that case the callback functions parameters will be ignored. |
| int vkz_create_sampler | ( | VkSampler * | sampler | ) |
Create a Vulkan sampler.
| sampler | The sampler to be created |
| int vkz_create_swapchain | ( | int | with_image_sampler | ) |
Create the swapchain that will be used. This will also create the associated image views.
| with_image_sampler | 1 If an image sampler will be used, 0 otherwise. |
| int vkz_create_sync_objects | ( | void | ) |
Create sync objects for a given pipeline.
| int vkz_destroy_buffer | ( | VkBuffer | buffer, |
| VkDeviceMemory | memory | ||
| ) |
Destroy a buffer.
| buffer | The buffer to be destroyed |
| memory | The GPU memory previously reserved for the buffer, to be released |
| int vkz_destroy_draw_command_buffer | ( | VkCommandBuffer * | command_buffer | ) |
Destroy a command buffer.
| command_buffer | Pointer to the command buffer. |
| int vkz_destroy_image | ( | VkImage | image, |
| VkDeviceMemory | image_memory | ||
| ) |
Destroy a Vulkan image.
| image | The image to be destroyed |
| image_memory | The GPU memory previously reserved for the image, to be released |
| int vkz_destroy_sync_objects | ( | void | ) |
Destroy sync objects for a given pipeline.
| int vkz_draw | ( | VkCommandBuffer * | command_buffer | ) |
Send draw commands (will take effect on the current pipeline image acquired by vkz_acquire_next_image())
| command_buffer | Pointer to the command buffer containing the commands. |
| int vkz_end_draw_command_buffer | ( | VkCommandBuffer * | command_buffer | ) |
Finish recording a command buffer.
| command_buffer | Pointer to the command buffer. |
| int vkz_init | ( | void | ) |
Initialise. Internally this means create physical device, select queue families and create logical device.
| int vkz_present_next_image | ( | void | ) |
Present next swapchain image (the one acquired by vkz_acquire_next_image())
| int vkz_recreate_pipelines_and_swapchain | ( | void | ) |
Recreate the swapchain and the pipelines.
| int vkz_set_width_height | ( | const uint32_t | width, |
| const uint32_t | height | ||
| ) |
Set width and height for all rendering calculations.
| width | The new width |
| height | The new height |
| int vkz_shutdown | ( | void | ) |
Cleanup the memory, destroy any debug callbacks, as well as the logical device and the Vulkan instance.
| int vkz_transition_image_layout | ( | VkImage | image, |
| VkFormat | format, | ||
| VkImageLayout | old_layout, | ||
| VkImageLayout | new_layout | ||
| ) |
Transition the layout of a Vulkan image.
| image | The Vulkan image |
| format | The image format |
| old_layout | The old layout |
| new_layout | The new layout |
1.8.15