UgTextureArray

Layered texture array for batch rendering

It

GPU texture array with its image, memory, view, sampler, and descriptor set

struct It {
  VkImage image;
  VkDeviceMemory memory;
  VkImageView view;
  VkSampler sampler;
  VkDescriptorSetLayout setLayout;
  VkDescriptorSet descriptorSet;
  U32 layerCount;
};

create

Load multiple images as layers and upload them as a texture array

UgTextureArray.It create(UgContext.It& ctx, const I8** paths, U32 count);

Parameters

  • ctx — Vulkan context
  • paths — Array of file paths, one per layer
  • count — Number of layers

Returns — Initialized texture array object


bind

Bind the texture array's descriptor set to a pipeline slot

U0 bind(UgTextureArray.It& arr, UgCommandBuffer.It& cmd, VkPipelineLayout pipelineLayout, U32 slot);

Parameters

  • arr — Texture array to bind
  • cmd — Active command buffer
  • pipelineLayout — Pipeline layout the descriptor set is compatible with
  • slot — Descriptor set index (texture slot)

destroy

Destroy the texture array and free all GPU resources

U0 destroy(UgContext.It& ctx, UgTextureArray.It& arr);

Parameters

  • ctx — Vulkan context
  • arr — Texture array to destroy