You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapters/image_copies.adoc
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,9 @@ There are 3 main ways to copy to/from a `VkImage`
17
17
[options="header"]
18
18
|===
19
19
| Copy Type | Original (Vulkan 1.0) | `VK_KHR_copy_commands2` (Vulkan 1.3) - Added a missing `pNext` in the structs | `VK_EXT_host_image_copy` (Vulkan 1.4) - allows copies on host without a `VkBuffer` or `VkCommandBuffer`
| Buffer to Image | `vkCmdCopyBufferToImage` | `vkCmdCopyBufferToImage2` | `vkCopyMemoryToImage`
21
+
| Image to Buffer | `vkCmdCopyImageToBuffer` | `vkCmdCopyImageToBuffer2` | `vkCopyImageToMemory`
22
+
| Image to Image | `vkCmdCopyImage` | `vkCmdCopyImage2` | `vkCopyImageToImage`
23
23
|===
24
24
25
25
== Image Subresource
@@ -39,6 +39,8 @@ When creating an image, the memory is not always going to be tightly packed toge
39
39
When dealing with a CPU, you can normally assume a 2D or 3D image is just laid out in as large 1D buffer.
40
40
GPU hardware has various memory alignment requirements, and will adjust the memory as required.
41
41
42
+
While buffers and CPU memory are addressed with a single linear offset, images are addressed in multiple dimensions (ex. 2D image needs an `x` and `y` offset). When copying data in or out of images, each of these dimensions must be specified to describe the data being copied.
43
+
42
44
The following is a small example to show how two GPU can represent a `VkImage` layout differently.
The tricky part is when you deal with a uncompressed image that has a block extent of `{1, 1, 1}`, here you will set the `VkImageCopy::extent` to match the `srcImage` (link:https://docs.vulkan.org/spec/latest/chapters/formats.html#formats-size-compatibility[details in spec]).
174
+
The tricky part is when you deal with a uncompressed image that has a block extent of `{1, 1, 1}`. You will set the `VkImageCopy::extent` to match the `texels` in the `srcImage`, and the `dstImage` is scaled link:https://docs.vulkan.org/spec/latest/chapters/formats.html#formats-size-compatibility[as described in the spec].
0 commit comments