ngfx::VKBuffer

Inherits from ngfx::Buffer

Public Functions

Name
void create(VKGraphicsContext * ctx, const void * data, uint32_t size, VkBufferUsageFlags bufferUsageFlags, VkMemoryPropertyFlags memoryPropertyFlags =VkMemoryPropertyFlags(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
virtual ~VKBuffer()
virtual void * map() override
virtual void unmap() override
virtual void upload(const void * data, uint32_t size, uint32_t offset =0) override
virtual void download(void * data, uint32_t size, uint32_t offset =0) override
const VkDescriptorSet & getUboDescriptorSet(ShaderStageFlags shaderStageFlags)
const VkDescriptorSet & getSsboDescriptorSet(ShaderStageFlags shaderStageFlags)

Protected Functions

Name
void createBuffer(const void * data, uint32_t size, VkBufferUsageFlags bufferUsageFlags)
void createMemory(VkMemoryPropertyFlags memoryPropertyFlags)
void initDescriptorSet(VkDescriptorPool descriptorPool, VkDescriptorSetLayout descriptorSetLayout, VkDescriptorType descriptorType, VkDescriptorSet & descriptorSet)

Public Attributes

Name
VkDeviceMemory memory
VkBuffer v
uint32_t size
VkBufferCreateInfo createInfo
VkMemoryAllocateInfo allocInfo
VkDescriptorSet uboDescriptorSet
VkDescriptorSet ssboDescriptorSet

Protected Attributes

Name
VKGraphicsContext * ctx
VkMemoryRequirements memReqs

Additional inherited members

Public Functions inherited from ngfx::Buffer

Name
virtual ~Buffer()

Public Functions Documentation

function create

void create(
    VKGraphicsContext * ctx,
    const void * data,
    uint32_t size,
    VkBufferUsageFlags bufferUsageFlags,
    VkMemoryPropertyFlags memoryPropertyFlags =VkMemoryPropertyFlags(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
)

function ~VKBuffer

virtual ~VKBuffer()

function map

virtual void * map() override

Reimplements: ngfx::Buffer::map

Map the buffer contents for CPU read/write access

function unmap

virtual void unmap() override

Reimplements: ngfx::Buffer::unmap

Unmap the buffer

function upload

virtual void upload(
    const void * data,
    uint32_t size,
    uint32_t offset =0
) override

Parameters:

  • data The buffer data
  • size The size of the data (in bytes)
  • offset The destination offset (in bytes)

Reimplements: ngfx::Buffer::upload

Upload the CPU data to the GPU buffer

function download

virtual void download(
    void * data,
    uint32_t size,
    uint32_t offset =0
) override

Parameters:

  • data The destination address
  • size The size of the data to download (in bytes)
  • offset The destination offset (in bytes)

Reimplements: ngfx::Buffer::download

Download the GPU data to CPU-accessible memory

function getUboDescriptorSet

const VkDescriptorSet & getUboDescriptorSet(
    ShaderStageFlags shaderStageFlags
)

function getSsboDescriptorSet

const VkDescriptorSet & getSsboDescriptorSet(
    ShaderStageFlags shaderStageFlags
)

Protected Functions Documentation

function createBuffer

void createBuffer(
    const void * data,
    uint32_t size,
    VkBufferUsageFlags bufferUsageFlags
)

function createMemory

void createMemory(
    VkMemoryPropertyFlags memoryPropertyFlags
)

function initDescriptorSet

void initDescriptorSet(
    VkDescriptorPool descriptorPool,
    VkDescriptorSetLayout descriptorSetLayout,
    VkDescriptorType descriptorType,
    VkDescriptorSet & descriptorSet
)

Public Attributes Documentation

variable memory

VkDeviceMemory memory = VK_NULL_HANDLE;

variable v

VkBuffer v = VK_NULL_HANDLE;

variable size

uint32_t size;

variable createInfo

VkBufferCreateInfo createInfo;

variable allocInfo

VkMemoryAllocateInfo allocInfo;

variable uboDescriptorSet

VkDescriptorSet uboDescriptorSet = 0;

variable ssboDescriptorSet

VkDescriptorSet ssboDescriptorSet = 0;

Protected Attributes Documentation

variable ctx

VKGraphicsContext * ctx;

variable memReqs

VkMemoryRequirements memReqs;

Updated on 3 April 2021 at 20:21:51 PDT