03. Resources & Descriptors

Resources & Descriptors | "Use Buffers and Images in Vulkan Shaders" | Vulkan Lecture Series, Ep. 3

Different usage types of buffers

  • As uniform buffer : read-only buffers

  • As storage buffer : load and store buffers (also support atomic operations)

  • As texel buffer : provide access to float[N] as vec3[N/3] through view

    • Uniform texel buffer : formatted load operations on uniform buffers

    • Storage texel buffer : ...

  • As dynamic buffer : additional offset into VkMemory, changeable at run-time with little overhead

    • Dynamic uniform buffer

    • Dynamic storage buffer

  • (Inline uniform block) : 直接包含数据而不指向 vkMemory

Different usage types of images

storage image

  • dicriptor type : VK_DESCRIPTOR_TYPE_STORAGE_IMAGE

  • load and store image (also support atomic operations)

  • Marked pixel at coordinates: (2, 2)

sampled image

  • VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE

  • sampled load operations from image

  • Normalized range: [0, 1] for x and y

  • 插值得到取值结果

input attachment

  • VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT

  • Load-only

  • Within renderpass

  • Framebuffer-local, meaning: Access to one single coordinate only, No access to other coordinates in that image

Descriptor Types

image-20230127235616789

Descriptor Types and Usage in GLSL

SAMPLER + SAMPLED_IMAGE

COMBINED_IMAGE_SAMPLER

STORAGE_IMAGE

UNIFORM_TEXEL_BUFFER

STORAGE_TEXEL_BUFFER

UNIFORM_BUFFER | UNIFORM_BUFFER_DYNAMIC | INLINE_UNIFORM_BLOCK_EXT

STORAGE_BUFFER | STORAGE_BUFFER_DYNAMIC

INPUT_ATTACHMENT

ACCELERATION_STRUCTURE_KHR

最后更新于

这有帮助吗?