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::DepthBuffer Class Reference

#include <depth_buffer.h>

Public Member Functions

 DepthBuffer (float depth_clear=1.0f, UINT stencil_clear=0)
 
void Create (const eastl::wstring &name, UINT width, UINT height, DXGI_FORMAT format)
 
const UINT & GetDSV () const
 
const UINT & GetDSVDepthReadOnly () const
 
const UINT & GetDSVStencilReadOnly () const
 
const UINT & GetDSVReadOnly () const
 
const UINT & GetDepthSRV () const
 
const UINT & GetStencilSRV () const
 
const UINT & GetStencilClearValue () const
 
const float & GetDepthClearValue () 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 dsv_id_
 
UINT dsv_depth_read_id_
 
UINT dsv_stencil_read_id_
 
UINT dsv_read_id_
 
UINT srv_depth_id_
 
UINT srv_stencil_id_
 
UINT stencil_clear_
 
float depth_clear_
 

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

Wrapper for DepthBuffer-like resources.

This buffer wraps all functionality for a depth buffer. DepthBuffers are useful for depth-testing. If you didn't know that, you probably shouldn't be reading this anyway.

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

Constructor & Destructor Documentation

blowbox::DepthBuffer::DepthBuffer ( float  depth_clear = 1.0f,
UINT  stencil_clear = 0 
)

Constructs a DepthBuffer with a preset depth and stencil clear value.

Parameters
[in]depth_clearThe default value the depth part of the buffer should be cleared to.
[in]stencil_clearThe default value the stencil part of the buffer should be cleared to.

Member Function Documentation

void blowbox::DepthBuffer::Create ( const eastl::wstring &  name,
UINT  width,
UINT  height,
DXGI_FORMAT  format 
)

Creates the actual DepthBuffer.

Parameters
[in]nameThe name of the DepthBuffer resource.
[in]widthThe width of the DepthBuffer resource in texels.
[in]heightThe height of the DepthBuffer resource in texels.
[in]formatThe format of the DepthBuffer. From this, it is automatically determined if it should have a stencil part or not.
void blowbox::DepthBuffer::CreateDerivedViews ( DXGI_FORMAT  format)
protected

Creates all the resource descriptors (views) for this resource.

const float& blowbox::DepthBuffer::GetDepthClearValue ( ) const
inline
Returns
The depth clear value for this DepthBuffer.
const UINT& blowbox::DepthBuffer::GetDepthSRV ( ) const
inline
Returns
A Shader Resource View for the depth part of this DepthBuffer.
const UINT& blowbox::DepthBuffer::GetDSV ( ) const
inline
Returns
The Depth Stencil View for this DepthBuffer.
const UINT& blowbox::DepthBuffer::GetDSVDepthReadOnly ( ) const
inline
Returns
A depth-read-only Depth Stencil View for this DepthBuffer.
const UINT& blowbox::DepthBuffer::GetDSVReadOnly ( ) const
inline
Returns
A read-only Depth Stencil View for this DepthBuffer.
const UINT& blowbox::DepthBuffer::GetDSVStencilReadOnly ( ) const
inline
Returns
A stencil-read-only Depth Stencil View for this DepthBuffer.
const UINT& blowbox::DepthBuffer::GetStencilClearValue ( ) const
inline
Returns
The stencil clear value for this DepthBuffer.
const UINT& blowbox::DepthBuffer::GetStencilSRV ( ) const
inline
Returns
A Shader Resource View for the stencil part of this DepthBuffer.

Member Data Documentation

float blowbox::DepthBuffer::depth_clear_
private

The depth clear value.

UINT blowbox::DepthBuffer::dsv_depth_read_id_
private

The Depth Stencil View for this DepthBuffer with depth read only.

UINT blowbox::DepthBuffer::dsv_id_
private

The base Depth Stencil View for this DepthBuffer.

UINT blowbox::DepthBuffer::dsv_read_id_
private

The Depth Stencil View for this DepthBuffer which is completely read only.

UINT blowbox::DepthBuffer::dsv_stencil_read_id_
private

The Depth Stencil View for this DepthBuffer with stencil read only.

UINT blowbox::DepthBuffer::srv_depth_id_
private

The Shader Resource View for this DepthBuffer for the depth part.

UINT blowbox::DepthBuffer::srv_stencil_id_
private

The Shader Resource View for this DepthBuffer for the stencil part.

UINT blowbox::DepthBuffer::stencil_clear_
private

The stencil clear value.


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