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

#include <color_buffer.h>

Public Member Functions

 ColorBuffer ()
 
 ColorBuffer (float clear_color[4])
 
void CreateFromSwapChain (const WString &name, ID3D12Resource *swap_chain_resource, float clear_color[4])
 
void Create (const WString &name, UINT width, UINT height, DXGI_FORMAT format)
 
const UINT & GetSRV () const
 
const UINT & GetRTV () const
 
const UINT & GetUAV () const
 
const float * GetClearColor () const
 
const D3D12_CLEAR_VALUE & GetClearValue () const
 
- Public Member Functions inherited from blowbox::PixelBuffer
 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

void CreateDerivedViews (DXGI_FORMAT format)
 
- Protected Member Functions inherited from blowbox::PixelBuffer
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 ()
 

Private Attributes

UINT srv_id_
 
UINT rtv_id_
 
UINT uav_id_
 
float clear_color_ [4]
 
D3D12_CLEAR_VALUE clear_value_
 

Additional Inherited Members

- Static Protected Member Functions inherited from blowbox::PixelBuffer
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 inherited from blowbox::PixelBuffer
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

Buffer-type for buffers with color data in them.

This buffer types allows you to store color data in a buffer. A ColorBuffer is useful for standard textures such as diffuse, specular, normal, etc maps.

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

Constructor & Destructor Documentation

blowbox::ColorBuffer::ColorBuffer ( )

Constructs a ColorBuffer.

blowbox::ColorBuffer::ColorBuffer ( float  clear_color[4])

Constructs a ColorBuffer with an optimized clear value.

Parameters
[in]clear_colorThe clear color that should be used for this buffer when clearing it.

Member Function Documentation

void blowbox::ColorBuffer::Create ( const WString name,
UINT  width,
UINT  height,
DXGI_FORMAT  format 
)

Creates a new ColorBuffer.

Parameters
[in]nameThe name for the ColorBuffer.
[in]widthThe width of the ColorBuffer in texels.
[in]heightThe height of the ColorBuffer in texels.
[in]formatThe per-texel data format.
void blowbox::ColorBuffer::CreateDerivedViews ( DXGI_FORMAT  format)
protected

Creates all the descriptors (views) for this ColorBuffer.

Parameters
[in]formatThe format of the base resource.
void blowbox::ColorBuffer::CreateFromSwapChain ( const WString name,
ID3D12Resource *  swap_chain_resource,
float  clear_color[4] 
)

Creates a ColorBuffer from a SwapChain buffer.

Parameters
[in]nameThe name for the ColorBuffer.
[in]swap_chain_resourceThe resource you got from the SwapChain.
[in]clear_colorThe clear color that should be used for this buffer when clearing it.
const float* blowbox::ColorBuffer::GetClearColor ( ) const
inline
Returns
The default clear color for this ColorBuffer.
const D3D12_CLEAR_VALUE& blowbox::ColorBuffer::GetClearValue ( ) const
inline
Returns
The default clear color for this ColorBuffer.
const UINT& blowbox::ColorBuffer::GetRTV ( ) const
inline
Returns
The Render Target View for this ColorBuffer.
const UINT& blowbox::ColorBuffer::GetSRV ( ) const
inline
Returns
The Shader Resource View for this ColorBuffer.
const UINT& blowbox::ColorBuffer::GetUAV ( ) const
inline
Returns
The Unordered Access View for this ColorBuffer.

Member Data Documentation

float blowbox::ColorBuffer::clear_color_[4]
private

The clear color for this ColorBuffer.

D3D12_CLEAR_VALUE blowbox::ColorBuffer::clear_value_
private

The clear value for this ColorBuffer.

UINT blowbox::ColorBuffer::rtv_id_
private

The RTV for this ColorBuffer.

UINT blowbox::ColorBuffer::srv_id_
private

The SRV for this ColorBuffer.

UINT blowbox::ColorBuffer::uav_id_
private

The UAV for this ColorBuffer.


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