The implementation of the Vulkan image, which can be thought of as a texture.
More...
Go to the source code of this file.
|
void | vulkan_image_create (vulkan_context *context, texture_type type, u32 width, u32 height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags memory_flags, b32 create_view, VkImageAspectFlags view_aspect_flags, const char *name, u32 mip_levels, vulkan_image *out_image) |
| Creates a new Vulkan image. More...
|
|
void | vulkan_image_view_create (vulkan_context *context, texture_type type, VkFormat format, vulkan_image *image, VkImageAspectFlags aspect_flags) |
| Creates a view for the given image. More...
|
|
void | vulkan_image_transition_layout (vulkan_context *context, texture_type type, vulkan_command_buffer *command_buffer, vulkan_image *image, VkFormat format, VkImageLayout old_layout, VkImageLayout new_layout) |
| Transitions the provided image from old_layout to new_layout. More...
|
|
b8 | vulkan_image_mipmaps_generate (vulkan_context *context, vulkan_image *image, vulkan_command_buffer *command_buffer) |
| Generates mipmaps for the given image based on mip_levels set in the image. mip_levels must be > 1 for this to succeed. More...
|
|
void | vulkan_image_copy_from_buffer (vulkan_context *context, texture_type type, vulkan_image *image, VkBuffer buffer, u64 offset, vulkan_command_buffer *command_buffer) |
| Copies data in buffer to provided image. More...
|
|
void | vulkan_image_copy_to_buffer (vulkan_context *context, texture_type type, vulkan_image *image, VkBuffer buffer, vulkan_command_buffer *command_buffer) |
| Copies data in the provided image to the given buffer. More...
|
|
void | vulkan_image_copy_pixel_to_buffer (vulkan_context *context, texture_type type, vulkan_image *image, VkBuffer buffer, u32 x, u32 y, vulkan_command_buffer *command_buffer) |
| Copies a single pixel's data from the given image to the provided buffer. More...
|
|
void | vulkan_image_destroy (vulkan_context *context, vulkan_image *image) |
| Destroys the given image. More...
|
|
The implementation of the Vulkan image, which can be thought of as a texture.
- Author
- Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
- Version
- 1.0
- Date
- 2022-01-11
- Copyright
- Kohi Game Engine is Copyright (c) Travis Vroman 2021-2022
◆ vulkan_image_copy_from_buffer()
Copies data in buffer to provided image.
- Parameters
-
context | The Vulkan context. |
type | The type of texture. Provides hints to creation. |
image | The image to copy the buffer's data to. |
buffer | The buffer whose data will be copied. |
offset | The offset in bytes from the beginning of the buffer. |
command_buffer | A pointer to the command buffer to be used for this operation. |
◆ vulkan_image_copy_pixel_to_buffer()
Copies a single pixel's data from the given image to the provided buffer.
- Parameters
-
context | The Vulkan context. |
type | The type of texture. Provides hints to layer count. |
image | The image to copy the image's data from. |
buffer | The buffer to copy to. |
x | The x-coordinate of the pixel to copy. |
y | The y-coordinate of the pixel to copy. |
command_buffer | The command buffer to be used for the copy. |
◆ vulkan_image_copy_to_buffer()
Copies data in the provided image to the given buffer.
- Parameters
-
context | The Vulkan context. |
type | The type of texture. Provides hints to layer count. |
image | The image to copy the image's data from. |
buffer | The buffer to copy to. |
command_buffer | The command buffer to be used for the copy. |
◆ vulkan_image_create()
void vulkan_image_create |
( |
vulkan_context * |
context, |
|
|
texture_type |
type, |
|
|
u32 |
width, |
|
|
u32 |
height, |
|
|
VkFormat |
format, |
|
|
VkImageTiling |
tiling, |
|
|
VkImageUsageFlags |
usage, |
|
|
VkMemoryPropertyFlags |
memory_flags, |
|
|
b32 |
create_view, |
|
|
VkImageAspectFlags |
view_aspect_flags, |
|
|
const char * |
name, |
|
|
u32 |
mip_levels, |
|
|
vulkan_image * |
out_image |
|
) |
| |
Creates a new Vulkan image.
- Parameters
-
context | A pointer to the Vulkan context. |
type | The type of texture. Provides hints to creation. |
width | The width of the image. For cubemaps, this is for each side of the cube. |
height | The height of the image. For cubemaps, this is for each side of the cube. |
format | The format of the image. |
tiling | The image tiling mode. |
usage | The image usage. |
memory_flags | Memory flags for the memory used by the image. |
create_view | Indicates if a view should be created with the image. |
view_aspect_flags | Aspect flags to be used when creating the view, if applicable. |
name | A name for the image. |
mip_levels | The number of mip map levels to use. Default is 1. |
out_image | A pointer to hold the newly-created image. |
◆ vulkan_image_destroy()
Destroys the given image.
- Parameters
-
context | A pointer to the Vulkan context. |
image | A pointer to the image to be destroyed. |
◆ vulkan_image_mipmaps_generate()
Generates mipmaps for the given image based on mip_levels set in the image. mip_levels must be > 1 for this to succeed.
- Parameters
-
context | A pointer to the Vulkan context. |
image | A pointer to the image to generate mips for. |
command_buffer | A pointer to the command buffer to be used for this operation. |
- Returns
- True on success; otherwise false.
◆ vulkan_image_transition_layout()
Transitions the provided image from old_layout to new_layout.
- Parameters
-
context | A pointer to the Vulkan context. |
type | The type of texture. Provides hints to creation. |
command_buffer | A pointer to the command buffer to be used. |
image | A pointer to the image whose layout will be transitioned. |
format | The image format. |
old_layout | The old layout. |
new_layout | The new layout. |
◆ vulkan_image_view_create()
Creates a view for the given image.
- Parameters
-
context | A pointer to the Vulkan context. |
type | The type of texture. Provides hints to creation. |
format | The image format. |
image | A pointer to the image to associate the view with. |
aspect_flags | Aspect flags to be used when creating the view, if applicable. |