ngfx::D3DBuffer

Inherits from ngfx::Buffer

Inherited by ngfx::D3DReadbackBuffer

Public Functions

Name
void create(D3DGraphicsContext * ctx, const void * data, uint32_t size, BufferUsageFlags bufferUsageFlags)
void create(D3DGraphicsContext * ctx, const void * data, uint32_t size, D3D12_HEAP_TYPE heapType =D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAGS resourceFlags =D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATES initialResourceState =D3D12_RESOURCE_STATE_GENERIC_READ)
virtual ~D3DBuffer()
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

Public Attributes

Name
uint32_t size
ComPtr< ID3D12Resource > v

Protected Attributes

Name
D3DGraphicsContext * ctx
D3D12_HEAP_TYPE heapType
D3D12_RESOURCE_STATES initialResourceState
D3D12_RESOURCE_STATES currentResourceState
D3DReadbackBuffer * d3dReadbackBuffer
void * d3dReadBackBufferPtr

Additional inherited members

Public Functions inherited from ngfx::Buffer

Name
virtual ~Buffer()

Public Functions Documentation

function create

void create(
    D3DGraphicsContext * ctx,
    const void * data,
    uint32_t size,
    BufferUsageFlags bufferUsageFlags
)

function create

void create(
    D3DGraphicsContext * ctx,
    const void * data,
    uint32_t size,
    D3D12_HEAP_TYPE heapType =D3D12_HEAP_TYPE_DEFAULT,
    D3D12_RESOURCE_FLAGS resourceFlags =D3D12_RESOURCE_FLAG_NONE,
    D3D12_RESOURCE_STATES initialResourceState =D3D12_RESOURCE_STATE_GENERIC_READ
)

function ~D3DBuffer

virtual ~D3DBuffer()

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

inline 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

Public Attributes Documentation

variable size

uint32_t size;

variable v

ComPtr< ID3D12Resource > v;

Protected Attributes Documentation

variable ctx

D3DGraphicsContext * ctx;

variable heapType

D3D12_HEAP_TYPE heapType;

variable initialResourceState

D3D12_RESOURCE_STATES initialResourceState;

variable currentResourceState

D3D12_RESOURCE_STATES currentResourceState;

variable d3dReadbackBuffer

D3DReadbackBuffer * d3dReadbackBuffer = nullptr;

variable d3dReadBackBufferPtr

void * d3dReadBackBufferPtr = nullptr;

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