Go to the documentation of this file.
40 template <
typename D3D_SHADER_RESOURCE_VIEW_DESC>
43 memset(&d3dSRVDesc, 0,
sizeof(d3dSRVDesc));
58 d3dSRVDesc.Texture1DArray.MipLevels = SRVDesc.
NumMipLevels;
66 d3dSRVDesc.Texture2DMS.UnusedField_NothingToDefine = 0;
88 d3dSRVDesc.Texture2DArray.MipLevels = SRVDesc.
NumMipLevels;
101 d3dSRVDesc.TextureCube.MipLevels = SRVDesc.
NumMipLevels;
107 d3dSRVDesc.TextureCubeArray.MipLevels = SRVDesc.
NumMipLevels;
109 d3dSRVDesc.TextureCubeArray.First2DArrayFace = SRVDesc.
FirstArraySlice;
110 d3dSRVDesc.TextureCubeArray.NumCubes = SRVDesc.
NumArraySlices / 6;
118 template <
typename D3D_RENDER_TARGET_VIEW_DESC>
121 memset(&d3dRTVDesc, 0,
sizeof(d3dRTVDesc));
143 d3dRTVDesc.Texture2DMS.UnusedField_NothingToDefine = 0;
180 template <
typename D3D_DEPTH_STENCIL_VIEW_DESC>
183 memset(&d3dDSVDesc, 0,
sizeof(d3dDSVDesc));
205 d3dDSVDesc.Texture2DMS.UnusedField_NothingToDefine = 0;
239 template <
typename D3D_UNORDERED_ACCESS_VIEW_DESC>
242 memset(&d3dUAVDesc, 0,
sizeof(d3dUAVDesc));
283 template <
typename D3D_UNORDERED_ACCESS_VIEW_DESC>
288 memset(&d3dSRVDesc, 0,
sizeof(d3dSRVDesc));
289 const auto& BuffFmt = SRVDesc.
Format;
291 d3dSRVDesc.Format =
TypeToDXGI_Format(BuffFmt.ValueType, BuffFmt.NumComponents, BuffFmt.IsNormalized);
293 Uint32 ElementByteStride = 0;
297 ElementByteStride = 4;
299 if (ElementByteStride != 0)
301 DEV_CHECK_ERR((SRVDesc.
ByteOffset % ElementByteStride) == 0,
"Byte offest (", SRVDesc.
ByteOffset,
") is not multiple of element byte stride (", ElementByteStride,
")");
302 DEV_CHECK_ERR((SRVDesc.
ByteWidth % ElementByteStride) == 0,
"Byte width (", SRVDesc.
ByteWidth,
")is not multiple of element byte stride (", ElementByteStride,
")");
303 d3dSRVDesc.Buffer.FirstElement = SRVDesc.
ByteOffset / ElementByteStride;
304 d3dSRVDesc.Buffer.NumElements = SRVDesc.
ByteWidth / ElementByteStride;
309 template <
typename D3D_UNORDERED_ACCESS_VIEW_DESC>
314 memset(&d3dUAVDesc, 0,
sizeof(d3dUAVDesc));
315 const auto& BuffFmt = UAVDesc.
Format;
317 d3dUAVDesc.Format =
TypeToDXGI_Format(BuffFmt.ValueType, BuffFmt.NumComponents, BuffFmt.IsNormalized);
319 Uint32 ElementByteStride = 0;
323 ElementByteStride = 4;
325 if (ElementByteStride != 0)
327 DEV_CHECK_ERR((UAVDesc.
ByteOffset % ElementByteStride) == 0,
"Byte offest (", UAVDesc.
ByteOffset,
") is not multiple of element byte stride (", ElementByteStride,
")");
328 DEV_CHECK_ERR((UAVDesc.
ByteWidth % ElementByteStride) == 0,
"Byte width (", UAVDesc.
ByteWidth,
")is not multiple of element byte stride (", ElementByteStride,
")");
329 d3dUAVDesc.Buffer.FirstElement = UAVDesc.
ByteOffset / ElementByteStride;
330 d3dUAVDesc.Buffer.NumElements = UAVDesc.
ByteWidth / ElementByteStride;
335 d3dUAVDesc.Format = DXGI_FORMAT_R32_TYPELESS;
Buffer view description.
Definition: BufferView.h:88
@ RESOURCE_DIM_TEX_3D
Three-dimensional texture.
Definition: GraphicsTypes.h:264
@ RESOURCE_DIM_TEX_1D
One-dimensional texture.
Definition: GraphicsTypes.h:260
@ RESOURCE_DIM_TEX_1D_ARRAY
One-dimensional texture array.
Definition: GraphicsTypes.h:261
TEXTURE_FORMAT Format
View format. If default value Diligent::TEX_FORMAT_UNKNOWN is provided, the view format will match th...
Definition: TextureView.h:94
@ RESOURCE_DIM_TEX_2D_ARRAY
Two-dimensional texture array.
Definition: GraphicsTypes.h:263
@ BIND_UNORDERED_ACCESS
A buffer or a texture can be bound as an unordered access view.
Definition: GraphicsTypes.h:127
#define LOG_ERROR_AND_THROW(...)
Definition: Errors.hpp:101
Uint32 MostDetailedMip
Most detailed mip level to use.
Definition: TextureView.h:97
#define D3D_RTV_DIMENSION_TEXTURE2DMS
Definition: D3D11TypeDefinitions.h:164
#define D3D_SRV_DIMENSION_TEXTURE2D
Definition: D3D12TypeDefinitions.h:155
struct BufferFormat Format
Format of the view. This member is only used for formatted and raw buffers. To create raw view of a r...
Definition: BufferView.h:96
#define D3D_UAV_DIMENSION_TEXTURE1DARRAY
Definition: D3D11TypeDefinitions.h:182
#define D3D_DSV_DIMENSION_TEXTURE2DMSARRAY
Definition: D3D11TypeDefinitions.h:176
Uint32 NumMipLevels
Total number of mip levels for the view of the texture. Render target and depth stencil views can add...
Definition: TextureView.h:104
#define D3D_RTV_DIMENSION_TEXTURE2D
Definition: D3D11TypeDefinitions.h:162
#define UNEXPECTED(...)
Definition: DebugUtilities.hpp:77
void TextureViewDesc_to_D3D_RTV_DESC(const TextureViewDesc &RTVDesc, D3D_RENDER_TARGET_VIEW_DESC &d3dRTVDesc, Uint32 SampleCount)
Definition: D3DViewDescConversionImpl.hpp:119
Uint32 NumArraySlices
For a texture array, number of array slices to address in the view. Set to 0 to address all array sli...
Definition: TextureView.h:119
#define D3D_SRV_DIMENSION_TEXTURECUBEARRAY
Definition: D3D12TypeDefinitions.h:161
#define D3D_DSV_DIMENSION_TEXTURE1D
Definition: D3D11TypeDefinitions.h:171
#define D3D_SRV_DIMENSION_TEXTURE2DMSARRAY
Definition: D3D12TypeDefinitions.h:158
BUFFER_MODE Mode
Buffer mode, see Diligent::BUFFER_MODE.
Definition: Buffer.h:95
#define D3D_BUFFER_UAV_FLAG_NONE
Definition: D3D11TypeDefinitions.h:189
#define D3D_SRV_DIMENSION_TEXTURE2DMS
Definition: D3D12TypeDefinitions.h:157
@ VT_UNDEFINED
Undefined type.
Definition: GraphicsTypes.h:51
#define DEV_CHECK_ERR(...)
Definition: DebugUtilities.hpp:90
@ RESOURCE_DIM_TEX_CUBE_ARRAY
Cube-map array texture.
Definition: GraphicsTypes.h:266
#define D3D_RTV_DIMENSION_TEXTURE2DMSARRAY
Definition: D3D11TypeDefinitions.h:165
#define D3D_RTV_DIMENSION_TEXTURE3D
Definition: D3D11TypeDefinitions.h:166
void BufferViewDesc_to_D3D_UAV_DESC(const BufferDesc &BuffDesc, const BufferViewDesc &UAVDesc, D3D_UNORDERED_ACCESS_VIEW_DESC &d3dUAVDesc)
Definition: D3DViewDescConversionImpl.hpp:310
#define D3D_UAV_DIMENSION_TEXTURE2DARRAY
Definition: D3D11TypeDefinitions.h:184
Uint32 ElementByteStride
Buffer element stride, in bytes.
Definition: Buffer.h:104
Uint32 FirstArraySlice
For a texture array, first array slice to address in the view.
Definition: TextureView.h:109
#define D3D_SRV_DIMENSION_BUFFER
Definition: D3D12TypeDefinitions.h:152
@ RESOURCE_DIM_TEX_CUBE
Cube-map texture.
Definition: GraphicsTypes.h:265
#define D3D_BUFFER_UAV_FLAG_RAW
Definition: D3D11TypeDefinitions.h:188
@ BUFFER_MODE_FORMATTED
Formated buffer. Access to the buffer will use format conversion operations. In this mode,...
Definition: Buffer.h:56
#define D3D_DSV_DIMENSION_TEXTURE1DARRAY
Definition: D3D11TypeDefinitions.h:172
Uint32 ByteWidth
Size in bytes of the referenced buffer region.
Definition: BufferView.h:103
Uint32 ByteOffset
Offset in bytes from the beginnig of the buffer to the start of the buffer region referenced by the v...
Definition: BufferView.h:100
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
void TextureViewDesc_to_D3D_SRV_DESC(const TextureViewDesc &SRVDesc, D3D_SHADER_RESOURCE_VIEW_DESC &d3dSRVDesc, Uint32 SampleCount)
Definition: D3DViewDescConversionImpl.hpp:41
#define D3D_SRV_DIMENSION_TEXTURECUBE
Definition: D3D12TypeDefinitions.h:160
@ BUFFER_VIEW_SHADER_RESOURCE
A buffer view will define a shader resource view that will be used as the source for the shader read ...
Definition: GraphicsTypes.h:310
RESOURCE_DIMENSION TextureDim
View interpretation of the original texture. For instance, one slice of a 2D texture array can be vie...
Definition: TextureView.h:90
#define D3D_SRV_DIMENSION_TEXTURE3D
Definition: D3D12TypeDefinitions.h:159
@ RESOURCE_DIM_TEX_2D
Two-dimensional texture.
Definition: GraphicsTypes.h:262
#define D3D_DSV_DIMENSION_TEXTURE2DMS
Definition: D3D11TypeDefinitions.h:175
#define D3D_SRV_DIMENSION_TEXTURE2DARRAY
Definition: D3D12TypeDefinitions.h:156
Buffer description.
Definition: Buffer.h:74
@ BUFFER_VIEW_UNORDERED_ACCESS
A buffer view will define an unordered access view that will be used for unordered read/write operati...
Definition: GraphicsTypes.h:314
@ BIND_DEPTH_STENCIL
A texture can be bound as a depth-stencil target.
Definition: GraphicsTypes.h:126
DXGI_FORMAT TypeToDXGI_Format(VALUE_TYPE ValType, Uint32 NumComponents, Bool bIsNormalized)
Definition: DXGITypeConversions.cpp:36
#define D3D_SRV_DIMENSION_TEXTURE1DARRAY
Definition: D3D12TypeDefinitions.h:154
DXGI_FORMAT TexFormatToDXGI_Format(TEXTURE_FORMAT TexFormat, Uint32 BindFlags=0)
Definition: DXGITypeConversions.cpp:276
void BufferViewDesc_to_D3D_SRV_DESC(const BufferDesc &BuffDesc, const BufferViewDesc &SRVDesc, D3D_UNORDERED_ACCESS_VIEW_DESC &d3dSRVDesc)
Definition: D3DViewDescConversionImpl.hpp:284
BUFFER_VIEW_TYPE ViewType
View type. See Diligent::BUFFER_VIEW_TYPE for details.
Definition: BufferView.h:91
@ BUFFER_MODE_STRUCTURED
Structured buffer. In this mode, ElementByteStride member of BufferDesc defines the structure stride.
Definition: Buffer.h:60
Uint32 FirstDepthSlice
For a 3D texture, first depth slice to address the view.
Definition: TextureView.h:112
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
@ BIND_RENDER_TARGET
A texture can be bound as a render target.
Definition: GraphicsTypes.h:125
#define D3D_DSV_DIMENSION_TEXTURE2DARRAY
Definition: D3D11TypeDefinitions.h:174
#define D3D_DSV_DIMENSION_TEXTURE2D
Definition: D3D11TypeDefinitions.h:173
@ BUFFER_MODE_RAW
Raw buffer. In this mode, the buffer is accessed as raw bytes. Formatted views of a raw buffer can al...
Definition: Buffer.h:67
#define D3D_UAV_DIMENSION_BUFFER
Definition: D3D11TypeDefinitions.h:180
#define D3D_RTV_DIMENSION_TEXTURE1DARRAY
Definition: D3D11TypeDefinitions.h:161
Texture view description.
Definition: TextureView.h:80
#define D3D_UAV_DIMENSION_TEXTURE3D
Definition: D3D11TypeDefinitions.h:185
void TextureViewDesc_to_D3D_UAV_DESC(const TextureViewDesc &UAVDesc, D3D_UNORDERED_ACCESS_VIEW_DESC &d3dUAVDesc)
Definition: D3DViewDescConversionImpl.hpp:240
#define D3D_SRV_DIMENSION_TEXTURE1D
Definition: D3D12TypeDefinitions.h:153
#define D3D_RTV_DIMENSION_TEXTURE2DARRAY
Definition: D3D11TypeDefinitions.h:163
#define D3D_UAV_DIMENSION_TEXTURE2D
Definition: D3D11TypeDefinitions.h:183
#define D3D_UAV_DIMENSION_TEXTURE1D
Definition: D3D11TypeDefinitions.h:181
void TextureViewDesc_to_D3D_DSV_DESC(const TextureViewDesc &DSVDesc, D3D_DEPTH_STENCIL_VIEW_DESC &d3dDSVDesc, Uint32 SampleCount)
Definition: D3DViewDescConversionImpl.hpp:181
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
@ BIND_SHADER_RESOURCE
A buffer or a texture can be bound as a shader resource.
Definition: GraphicsTypes.h:122
#define D3D_RTV_DIMENSION_TEXTURE1D
Definition: D3D11TypeDefinitions.h:160
Uint32 NumDepthSlices
For a 3D texture, number of depth slices to address in the view Set to 0 to address all depth slices.
Definition: TextureView.h:123