Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
blowbox::PixelBuffer Class Reference

#include <pixel_buffer.h>

Public Member Functions

 PixelBuffer ()
 
const UINT & GetWidth () const
 
const UINT & GetHeight () const
 
const DXGI_FORMAT & GetFormat () const
 
- Public Member Functions inherited from blowbox::GpuResource
 GpuResource ()
 
 GpuResource (ID3D12Resource *resource, D3D12_RESOURCE_STATES current_state)
 
virtual ~GpuResource ()
 
void Associate (ID3D12Resource *resource, D3D12_RESOURCE_STATES current_state)
 
void Destroy ()
 
ID3D12Resource * operator-> ()
 
const ID3D12Resource * operator-> () const
 
 operator ID3D12Resource * ()
 
ID3D12Resource * Get ()
 
const D3D12_RESOURCE_STATES & GetState () const
 
const D3D12_RESOURCE_STATES & GetTransitionState () const
 

Protected Member Functions

D3D12_RESOURCE_DESC DescribeTex2D (UINT width, UINT height, UINT depth_or_array_size, UINT num_mips, DXGI_FORMAT format, UINT flags)
 
void AssociateWithResource (const WString &name, ID3D12Resource *resource, const D3D12_RESOURCE_STATES &current_resource_state)
 
void CreateTextureResource (const WString &name, const D3D12_RESOURCE_DESC &resource_desc, const D3D12_CLEAR_VALUE &clear_value)
 
- Protected Member Functions inherited from blowbox::GpuResource
void AddToMemoryProfiler ()
 
void RemoveFromMemoryProfiler ()
 

Static Protected Member Functions

static DXGI_FORMAT GetBaseFormat (DXGI_FORMAT format)
 
static DXGI_FORMAT GetUAVFormat (DXGI_FORMAT format)
 
static DXGI_FORMAT GetDSVFormat (DXGI_FORMAT format)
 
static DXGI_FORMAT GetDepthFormat (DXGI_FORMAT format)
 
static DXGI_FORMAT GetStencilFormat (DXGI_FORMAT format)
 

Protected Attributes

UINT width_
 
UINT height_
 
UINT array_size_
 
DXGI_FORMAT format_
 
- Protected Attributes inherited from blowbox::GpuResource
WString name_
 
ID3D12Resource * resource_
 
D3D12_RESOURCE_STATES usage_state_
 
D3D12_RESOURCE_STATES transition_state_
 
D3D12_GPU_VIRTUAL_ADDRESS gpu_virtual_address_
 

Detailed Description

Wrapper for pixel-type resources.

A buffer type for pixel-based resources like depth buffers and color buffers. This class is not usable in and of itself, but provides instead a bunch of helper functions for inheriting classes, such as format converters and texture creation.

Inheritance diagram for blowbox::PixelBuffer:
blowbox::GpuResource blowbox::ColorBuffer blowbox::DepthBuffer

Constructor & Destructor Documentation

blowbox::PixelBuffer::PixelBuffer ( )

Constructs a PixelBuffer resource.

Member Function Documentation

void blowbox::PixelBuffer::AssociateWithResource ( const WString name,
ID3D12Resource *  resource,
const D3D12_RESOURCE_STATES &  current_resource_state 
)
protected

Associates this PixelBuffer with a pre-existing resource (useful for stuff like SwapChain buffers)

Parameters
[in]nameThe name for the resource (any previous names on the resource will be overridden)
[in]resourceThe resource to associate this PixelBuffer with.
[in]current_resource_stateThe resource state of the resource we're associating with.
void blowbox::PixelBuffer::CreateTextureResource ( const WString name,
const D3D12_RESOURCE_DESC &  resource_desc,
const D3D12_CLEAR_VALUE &  clear_value 
)
protected

Creates a new texture resource for this PixelBuffer.

Parameters
[in]nameThe name for this resource.
[in]resource_descThe resource description for the resource to be created.
[in]clear_valueThe default clear value for this resource.
D3D12_RESOURCE_DESC blowbox::PixelBuffer::DescribeTex2D ( UINT  width,
UINT  height,
UINT  depth_or_array_size,
UINT  num_mips,
DXGI_FORMAT  format,
UINT  flags 
)
protected

Generates a D3D12_RESOURCE_DESC for Texture2D resources.

Parameters
[in]widthThe width of the Texture2D resource in pixels.
[in]heightThe height of the Texture2D resource in pixels
[in]depth_or_array_sizeThe depth/array size of the resource.
[in]num_mipsThe number of mip levels in the resource.
[in]formatThe format of the resource.
[in]flagsAny flags that should be set on the resource.
Returns
A filled out D3D12_RESOURCE_DESC for Texture2D resources.
DXGI_FORMAT blowbox::PixelBuffer::GetBaseFormat ( DXGI_FORMAT  format)
staticprotected
Returns
A TYPELESS DXGI_FORMAT that can be used inside of D3D12_RESOURCE_DESC's for texture resources.
DXGI_FORMAT blowbox::PixelBuffer::GetDepthFormat ( DXGI_FORMAT  format)
staticprotected
Returns
A DXGI_FORMAT compatible with SRV descriptors based on a given DXGI_FORMAT.
DXGI_FORMAT blowbox::PixelBuffer::GetDSVFormat ( DXGI_FORMAT  format)
staticprotected
Returns
A DXGI_FORMAT compatible with DSV descriptors based on a given DXGI_FORMAT.
const DXGI_FORMAT& blowbox::PixelBuffer::GetFormat ( ) const
inline
Returns
The resource format of the pixel buffer.
const UINT& blowbox::PixelBuffer::GetHeight ( ) const
inline
Returns
The height of the pixel buffer in pixels.
DXGI_FORMAT blowbox::PixelBuffer::GetStencilFormat ( DXGI_FORMAT  format)
staticprotected
Returns
A DXGI_FORMAT for stencil buffers based on a given format.
DXGI_FORMAT blowbox::PixelBuffer::GetUAVFormat ( DXGI_FORMAT  format)
staticprotected
Returns
A DXGI_FORMAT compatible with UAV descriptors based on a given DXGI_FORMAT.
const UINT& blowbox::PixelBuffer::GetWidth ( ) const
inline
Returns
The width of the pixel buffer in pixels.

Member Data Documentation

UINT blowbox::PixelBuffer::array_size_
protected

The array size of the pixel buffer.

DXGI_FORMAT blowbox::PixelBuffer::format_
protected

The format of the resource itself.

UINT blowbox::PixelBuffer::height_
protected

The height of the pixel buffer in texels.

UINT blowbox::PixelBuffer::width_
protected

The width of the pixel buffer in texels.


The documentation for this class was generated from the following files: