Diligent Engine  v.2.4.g
Classes | Namespaces | Macros | Functions
GraphicsAccessories.cpp File Reference
#include <algorithm>
#include "GraphicsAccessories.hpp"
#include "DebugUtilities.hpp"
#include "Align.hpp"
#include "BasicMath.hpp"

Classes

class  Diligent::TexFormatToViewFormatConverter
 

Namespaces

 Diligent
 The library uses Direct3D-style math:
 

Macros

#define INIT_VALUE_TYPE_STR(ValType)   ValueTypeStrings[ValType] = #ValType
 
#define INIT_TEX_VIEW_FORMAT_INFO(TexFmt, SRVFmt, RTVFmt, DSVFmt, UAVFmt)
 
#define INIT_TEX_FORMAT_INFO(TexFmt, ComponentSize, NumComponents, ComponentType, IsTypeless, BlockWidth, BlockHeight)   FmtAttribs[ TexFmt ] = TextureFormatAttribs(#TexFmt, TexFmt, ComponentSize, NumComponents, ComponentType, IsTypeless, BlockWidth, BlockHeight);
 
#define INIT_TEX_VIEW_TYPE_NAME(ViewType)   TexViewLiteralNames[ViewType] = #ViewType
 
#define INIT_BUFF_VIEW_TYPE_NAME(ViewType)   BuffViewLiteralNames[ViewType] = #ViewType
 
#define RETURN_SHADER_TYPE_NAME(ShaderType)   case ShaderType: return #ShaderType;
 
#define STENCIL_OP_TO_STR(Op)   case Op: return #Op
 
#define BLEND_FACTOR_TO_STR(Factor)   case Factor: return #Factor
 
#define BLEND_OP_TO_STR(BlendOp)   case BlendOp: return #BlendOp
 
#define FILL_MODE_TO_STR(Mode)   case Mode: return #Mode
 
#define CULL_MODE_TO_STR(Mode)   case Mode: return #Mode
 
#define INIT_USGAGE_STR(Usage)   UsageStrings[Usage] = #Usage
 
#define BIND_FLAG_STR_CASE(Flag)   case Flag: return #Flag;
 
#define CPU_ACCESS_FLAG_STR_CASE(Flag)   case Flag: return #Flag;
 
#define INIT_BUFF_MODE_STR(Mode)   BufferModeStrings[Mode] = #Mode
 
#define SRF_TRANSFORM_CASE(Transform)   case Transform: return #Transform
 
#define VERIFY_EXCLUSIVE_STATE(ExclusiveState)
 

Functions

const Char * Diligent::GetValueTypeString (VALUE_TYPE Val)
 Returns the string representing the specified value type. More...
 
TEXTURE_FORMAT Diligent::GetDefaultTextureViewFormat (TEXTURE_FORMAT TextureFormat, TEXTURE_VIEW_TYPE ViewType, Uint32 BindFlags)
 Returns the default format for a specified texture view type. More...
 
const TextureFormatAttribs & Diligent::GetTextureFormatAttribs (TEXTURE_FORMAT Format)
 Returns invariant texture format attributes, see TextureFormatAttribs for details. More...
 
const Char * Diligent::GetTexViewTypeLiteralName (TEXTURE_VIEW_TYPE ViewType)
 Returns the literal name of a texture view type. For instance, for a shader resource view, "TEXTURE_VIEW_SHADER_RESOURCE" will be returned. More...
 
const Char * Diligent::GetBufferViewTypeLiteralName (BUFFER_VIEW_TYPE ViewType)
 Returns the literal name of a buffer view type. For instance, for an unordered access view, "BUFFER_VIEW_UNORDERED_ACCESS" will be returned. More...
 
const Char * Diligent::GetShaderTypeLiteralName (SHADER_TYPE ShaderType)
 Returns the literal name of a shader type. For instance, for a pixel shader, "SHADER_TYPE_PIXEL" will be returned. More...
 
String Diligent::GetShaderStagesString (SHADER_TYPE ShaderStages)
 
const Char * Diligent::GetShaderVariableTypeLiteralName (SHADER_RESOURCE_VARIABLE_TYPE VarType, bool bGetFullName=false)
 Returns the literal name of a shader variable type. For instance, for SHADER_RESOURCE_VARIABLE_TYPE_STATIC, if bGetFullName == true, "SHADER_RESOURCE_VARIABLE_TYPE_STATIC" will be returned; if bGetFullName == false, "static" will be returned. More...
 
const Char * Diligent::GetShaderResourceTypeLiteralName (SHADER_RESOURCE_TYPE ResourceType, bool bGetFullName=false)
 Returns the literal name of a shader resource type. For instance, for SHADER_RESOURCE_TYPE_CONSTANT_BUFFER, if bGetFullName == true, "SHADER_RESOURCE_TYPE_CONSTANT_BUFFER" will be returned; if bGetFullName == false, "constant buffer" will be returned. More...
 
const Char * Diligent::GetFilterTypeLiteralName (FILTER_TYPE FilterType, bool bGetFullName)
 Returns the literal name of a filter type. For instance, for FILTER_TYPE_POINT, if bGetFullName == true, "FILTER_TYPE_POINT" will be returned; if bGetFullName == false, "point" will be returned. More...
 
const Char * Diligent::GetTextureAddressModeLiteralName (TEXTURE_ADDRESS_MODE AddressMode, bool bGetFullName)
 Returns the literal name of a texture address mode. For instance, for TEXTURE_ADDRESS_WRAP, if bGetFullName == true, "TEXTURE_ADDRESS_WRAP" will be returned; if bGetFullName == false, "wrap" will be returned. More...
 
const Char * Diligent::GetComparisonFunctionLiteralName (COMPARISON_FUNCTION ComparisonFunc, bool bGetFullName)
 Returns the literal name of a comparison function. For instance, for COMPARISON_FUNC_LESS, if bGetFullName == true, "COMPARISON_FUNC_LESS" will be returned; if bGetFullName == false, "less" will be returned. More...
 
const Char * Diligent::GetStencilOpLiteralName (STENCIL_OP StencilOp)
 Returns the literal name of a stencil operation. More...
 
const Char * Diligent::GetBlendFactorLiteralName (BLEND_FACTOR BlendFactor)
 Returns the literal name of a blend factor. More...
 
const Char * Diligent::GetBlendOperationLiteralName (BLEND_OPERATION BlendOp)
 Returns the literal name of a blend operation. More...
 
const Char * Diligent::GetFillModeLiteralName (FILL_MODE FillMode)
 Returns the literal name of a fill mode. More...
 
const Char * Diligent::GetCullModeLiteralName (CULL_MODE CullMode)
 Returns the literal name of a cull mode. More...
 
const Char * Diligent::GetMapTypeString (MAP_TYPE MapType)
 Returns the string containing the map type. More...
 
const Char * Diligent::GetUsageString (USAGE Usage)
 Returns the string containing the usage. More...
 
const Char * Diligent::GetResourceDimString (RESOURCE_DIMENSION TexType)
 Returns the string containing the texture type. More...
 
const Char * Diligent::GetBindFlagString (Uint32 BindFlag)
 Returns the string containing single bind flag. More...
 
String Diligent::GetBindFlagsString (Uint32 BindFlags, const char *Delimeter="|")
 Returns the string containing the bind flags. More...
 
String Diligent::GetCPUAccessFlagsString (Uint32 CpuAccessFlags)
 Returns the string containing the CPU access flags. More...
 
template<typename T >
String Diligent::ToString (T Val)
 
String Diligent::GetTextureDescString (const TextureDesc &Desc)
 Returns the string containing the texture description. More...
 
const Char * Diligent::GetBufferModeString (BUFFER_MODE Mode)
 Returns the string containing the buffer mode description. More...
 
String Diligent::GetBufferFormatString (const BufferFormat &Fmt)
 Returns the string containing the buffer format description. More...
 
String Diligent::GetBufferDescString (const BufferDesc &Desc)
 Returns the string containing the buffer description. More...
 
const Char * Diligent::GetResourceStateFlagString (RESOURCE_STATE State)
 Returns the string containing the buffer mode description. More...
 
String Diligent::GetResourceStateString (RESOURCE_STATE State)
 
const char * Diligent::GetQueryTypeString (QUERY_TYPE QueryType)
 
const char * Diligent::GetSurfaceTransformString (SURFACE_TRANSFORM SrfTransform)
 
const char * Diligent::GetPipelineTypeString (PIPELINE_TYPE PipelineType)
 
const char * Diligent::GetShaderCompilerTypeString (SHADER_COMPILER Compiler)
 
String Diligent::GetPipelineResourceFlagsString (PIPELINE_RESOURCE_FLAGS Flags, bool GetFullName=false, const char *DelimeterString="|")
 
PIPELINE_RESOURCE_FLAGS Diligent::GetValidPipelineResourceFlags (SHADER_RESOURCE_TYPE ResourceType)
 
Uint32 Diligent::ComputeMipLevelsCount (Uint32 Width)
 
Uint32 Diligent::ComputeMipLevelsCount (Uint32 Width, Uint32 Height)
 
Uint32 Diligent::ComputeMipLevelsCount (Uint32 Width, Uint32 Height, Uint32 Depth)
 
bool Diligent::VerifyResourceStates (RESOURCE_STATE State, bool IsTexture)
 
MipLevelProperties Diligent::GetMipLevelProperties (const TextureDesc &TexDesc, Uint32 MipLevel)
 
ADAPTER_VENDOR Diligent::VendorIdToAdapterVendor (Uint32 VendorId)
 
bool Diligent::IsConsistentShaderType (SHADER_TYPE ShaderType, PIPELINE_TYPE PipelineType)
 
Int32 Diligent::GetShaderTypePipelineIndex (SHADER_TYPE ShaderType, PIPELINE_TYPE PipelineType)
 
SHADER_TYPE Diligent::GetShaderTypeFromPipelineIndex (Int32 Index, PIPELINE_TYPE PipelineType)
 
PIPELINE_TYPE Diligent::PipelineTypeFromShaderStages (SHADER_TYPE ShaderStages)
 
Uint32 Diligent::GetStagingTextureLocationOffset (const TextureDesc &TexDesc, Uint32 ArraySlice, Uint32 MipLevel, Uint32 Alignment, Uint32 LocationX, Uint32 LocationY, Uint32 LocationZ)
 Returns an offset from the beginning of the buffer backing a staging texture to the specified location within the given subresource. More...
 
BufferToTextureCopyInfo Diligent::GetBufferToTextureCopyInfo (const TextureDesc &TexDesc, Uint32 MipLevel, const Box &Region, Uint32 RowStrideAlignment)
 
void Diligent::CopyTextureSubresource (const TextureSubResData &SrcSubres, Uint32 NumRows, Uint32 NumDepthSlices, Uint32 RowSize, void *pDstData, Uint32 DstRowStride, Uint32 DstDepthStride)
 Copies texture subresource data on the CPU. More...
 

Macro Definition Documentation

◆ BIND_FLAG_STR_CASE

#define BIND_FLAG_STR_CASE (   Flag)    case Flag: return #Flag;

◆ BLEND_FACTOR_TO_STR

#define BLEND_FACTOR_TO_STR (   Factor)    case Factor: return #Factor

◆ BLEND_OP_TO_STR

#define BLEND_OP_TO_STR (   BlendOp)    case BlendOp: return #BlendOp

◆ CPU_ACCESS_FLAG_STR_CASE

#define CPU_ACCESS_FLAG_STR_CASE (   Flag)    case Flag: return #Flag;

◆ CULL_MODE_TO_STR

#define CULL_MODE_TO_STR (   Mode)    case Mode: return #Mode

◆ FILL_MODE_TO_STR

#define FILL_MODE_TO_STR (   Mode)    case Mode: return #Mode

◆ INIT_BUFF_MODE_STR

#define INIT_BUFF_MODE_STR (   Mode)    BufferModeStrings[Mode] = #Mode

◆ INIT_BUFF_VIEW_TYPE_NAME

#define INIT_BUFF_VIEW_TYPE_NAME (   ViewType)    BuffViewLiteralNames[ViewType] = #ViewType

◆ INIT_TEX_FORMAT_INFO

#define INIT_TEX_FORMAT_INFO (   TexFmt,
  ComponentSize,
  NumComponents,
  ComponentType,
  IsTypeless,
  BlockWidth,
  BlockHeight 
)    FmtAttribs[ TexFmt ] = TextureFormatAttribs(#TexFmt, TexFmt, ComponentSize, NumComponents, ComponentType, IsTypeless, BlockWidth, BlockHeight);

◆ INIT_TEX_VIEW_FORMAT_INFO

#define INIT_TEX_VIEW_FORMAT_INFO (   TexFmt,
  SRVFmt,
  RTVFmt,
  DSVFmt,
  UAVFmt 
)
Value:
{\
m_ViewFormats[ TexFmt ][TEXTURE_VIEW_SHADER_RESOURCE-1] = TEX_FORMAT_##SRVFmt; \
m_ViewFormats[ TexFmt ][TEXTURE_VIEW_RENDER_TARGET-1] = TEX_FORMAT_##RTVFmt; \
m_ViewFormats[ TexFmt ][TEXTURE_VIEW_DEPTH_STENCIL-1] = TEX_FORMAT_##DSVFmt; \
m_ViewFormats[ TexFmt ][TEXTURE_VIEW_UNORDERED_ACCESS-1] = TEX_FORMAT_##UAVFmt; \
}

◆ INIT_TEX_VIEW_TYPE_NAME

#define INIT_TEX_VIEW_TYPE_NAME (   ViewType)    TexViewLiteralNames[ViewType] = #ViewType

◆ INIT_USGAGE_STR

#define INIT_USGAGE_STR (   Usage)    UsageStrings[Usage] = #Usage

◆ INIT_VALUE_TYPE_STR

#define INIT_VALUE_TYPE_STR (   ValType)    ValueTypeStrings[ValType] = #ValType

◆ RETURN_SHADER_TYPE_NAME

#define RETURN_SHADER_TYPE_NAME (   ShaderType)    case ShaderType: return #ShaderType;

◆ SRF_TRANSFORM_CASE

#define SRF_TRANSFORM_CASE (   Transform)    case Transform: return #Transform

◆ STENCIL_OP_TO_STR

#define STENCIL_OP_TO_STR (   Op)    case Op: return #Op

◆ VERIFY_EXCLUSIVE_STATE

#define VERIFY_EXCLUSIVE_STATE (   ExclusiveState)
Value:
if ( (State & ExclusiveState) != 0 && (State & ~ExclusiveState) != 0 )\
{\
LOG_ERROR_MESSAGE("State ", GetResourceStateString(State), " is invalid: " #ExclusiveState " can't be combined with any other state");\
return false;\
}
Diligent::TEXTURE_VIEW_RENDER_TARGET
@ TEXTURE_VIEW_RENDER_TARGET
A texture view will define a render target view that will be used as the target for rendering operati...
Definition: GraphicsTypes.h:285
Diligent::TEXTURE_VIEW_UNORDERED_ACCESS
@ TEXTURE_VIEW_UNORDERED_ACCESS
A texture view will define an unordered access view that will be used for unordered read/write operat...
Definition: GraphicsTypes.h:293
Diligent::GetResourceStateString
String GetResourceStateString(RESOURCE_STATE State)
Definition: GraphicsAccessories.cpp:1080
Diligent::TEXTURE_VIEW_DEPTH_STENCIL
@ TEXTURE_VIEW_DEPTH_STENCIL
A texture view will define a depth stencil view that will be used as the target for rendering operati...
Definition: GraphicsTypes.h:289
Diligent::TEXTURE_VIEW_SHADER_RESOURCE
@ TEXTURE_VIEW_SHADER_RESOURCE
A texture view will define a shader resource view that will be used as the source for the shader read...
Definition: GraphicsTypes.h:281