Class VulkanTexture

Inheritance Relationships

Base Type

Class Documentation

class VulkanTexture : public portal::renderer::Texture

Vulkan texture with automatic mipmap generation and sampler management.

Wraps VulkanImage with texture-specific functionality: automatic mipmap generation, CPU buffer management, sampler configuration, and texture type support (2D/cube).

Public Functions

explicit VulkanTexture(const StringId &id, const TextureProperties &properties, const Buffer &data, const VulkanContext &context)

Constructs Vulkan texture.

Parameters:
  • idTexture ID

  • propertiesTexture properties

  • data – CPU texture data

  • context – Vulkan context

virtual void resize(const glm::uvec3 &size) override

Resizes texture.

Parameters:

size – New size

virtual void resize(size_t width, size_t height, size_t depth) override

Resizes texture.

Parameters:
  • width – New width

  • height – New height

  • depth – New depth

void update_image()

Updates GPU image from CPU buffer.

void set_sampler(const Reference<Sampler> &sampler)

Sets texture sampler.

Parameters:

samplerSampler to use

virtual ImageFormat get_format() const override

Gets texture format.

virtual size_t get_width() const override

Gets texture width.

virtual size_t get_height() const override

Gets texture height.

virtual size_t get_depth() const override

Gets texture depth.

virtual glm::uvec3 get_size() const override

Gets texture size as 3D vector.

virtual uint32_t get_mip_level_count() const override

Gets mipmap level count.

virtual glm::uvec3 get_mip_size(uint32_t mip) const override

Gets dimensions of mip level.

Parameters:

mip – Mip level index

Returns:

Mip size (width/height/depth)

virtual Reference<Image> get_image() const override

Gets underlying Vulkan image.

virtual Buffer get_buffer() const override

Gets CPU buffer (const)

virtual Buffer get_writeable_buffer() override

Gets CPU buffer (mutable)

virtual TextureType get_type() const override

Gets texture type (2D/cube)

const vk::DescriptorImageInfo &get_descriptor_image_info() const

Gets descriptor image info for binding.

virtual bool loaded() const override

Checks if texture data is loaded.