Diligent Engine API Reference
RenderDeviceBase.h
1 /* Copyright 2015-2018 Egor Yusov
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12  *
13  * In no event and under no legal theory, whether in tort (including negligence),
14  * contract, or otherwise, unless required by applicable law (such as deliberate
15  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
16  * liable for any damages, including any direct, indirect, special, incidental,
17  * or consequential damages of any character arising as a result of this License or
18  * out of the use or inability to use the software (including but not limited to damages
19  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20  * all other commercial damages or losses), even if such Contributor has been advised
21  * of the possibility of such damages.
22  */
23 
24 #pragma once
25 
28 
29 #include "RenderDevice.h"
30 #include "DeviceObjectBase.h"
31 #include "Defines.h"
32 #include "ResourceMappingImpl.h"
33 #include "StateObjectsRegistry.h"
34 #include "HashUtils.h"
35 #include "ObjectBase.h"
36 #include "DeviceContext.h"
37 #include "SwapChain.h"
38 #include "GraphicsAccessories.h"
39 #include "FixedBlockMemoryAllocator.h"
40 #include "EngineMemory.h"
41 #include "STDAllocator.h"
42 
43 namespace std
44 {
46  template<>
47  struct hash<Diligent::SamplerDesc>
48  {
49  size_t operator()( const Diligent::SamplerDesc &SamDesc ) const
50  {
51  // Sampler name is ignored in comparison operator
52  // and should not be hashed
53  return Diligent::ComputeHash( // SamDesc.Name,
54  static_cast<int>(SamDesc.MinFilter),
55  static_cast<int>(SamDesc.MagFilter),
56  static_cast<int>(SamDesc.MipFilter),
57  static_cast<int>(SamDesc.AddressU),
58  static_cast<int>(SamDesc.AddressV),
59  static_cast<int>(SamDesc.AddressW),
60  SamDesc.MipLODBias,
61  SamDesc.MaxAnisotropy,
62  static_cast<int>(SamDesc.ComparisonFunc),
63  SamDesc.BorderColor[0],
64  SamDesc.BorderColor[1],
65  SamDesc.BorderColor[2],
66  SamDesc.BorderColor[3],
67  SamDesc.MinLOD, SamDesc.MaxLOD );
68  }
69  };
70 
72  template<>
73  struct hash<Diligent::StencilOpDesc>
74  {
75  size_t operator()( const Diligent::StencilOpDesc &StOpDesc ) const
76  {
77  return Diligent::ComputeHash( static_cast<int>( StOpDesc.StencilFailOp ),
78  static_cast<int>( StOpDesc.StencilDepthFailOp ),
79  static_cast<int>( StOpDesc.StencilPassOp ),
80  static_cast<int>( StOpDesc.StencilFunc ) );
81  }
82  };
83 
85  template<>
86  struct hash<Diligent::DepthStencilStateDesc>
87  {
88  size_t operator()( const Diligent::DepthStencilStateDesc &DepthStencilDesc ) const
89  {
90  return Diligent::ComputeHash( DepthStencilDesc.DepthEnable,
91  DepthStencilDesc.DepthWriteEnable,
92  static_cast<int>(DepthStencilDesc.DepthFunc),
93  DepthStencilDesc.StencilEnable,
94  DepthStencilDesc.StencilReadMask,
95  DepthStencilDesc.StencilWriteMask,
96  DepthStencilDesc.FrontFace,
97  DepthStencilDesc.BackFace );
98  }
99  };
100 
102  template<>
103  struct hash<Diligent::RasterizerStateDesc>
104  {
105  size_t operator()( const Diligent::RasterizerStateDesc &RasterizerDesc ) const
106  {
107  return Diligent::ComputeHash( static_cast<int>( RasterizerDesc.FillMode ),
108  static_cast<int>( RasterizerDesc.CullMode ),
109  RasterizerDesc.FrontCounterClockwise,
110  RasterizerDesc.DepthBias,
111  RasterizerDesc.DepthBiasClamp,
112  RasterizerDesc.SlopeScaledDepthBias,
113  RasterizerDesc.DepthClipEnable,
114  RasterizerDesc.ScissorEnable,
115  RasterizerDesc.AntialiasedLineEnable );
116  }
117  };
118 
120  template<>
121  struct hash<Diligent::BlendStateDesc>
122  {
123  size_t operator()( const Diligent::BlendStateDesc &BSDesc ) const
124  {
125  std::size_t Seed = 0;
126  for( int i = 0; i < Diligent::BlendStateDesc::MaxRenderTargets; ++i )
127  {
128  const auto& rt = BSDesc.RenderTargets[i];
129  Diligent::HashCombine( Seed,
130  rt.BlendEnable,
131  static_cast<int>( rt.SrcBlend ),
132  static_cast<int>( rt.DestBlend ),
133  static_cast<int>( rt.BlendOp ),
134  static_cast<int>( rt.SrcBlendAlpha ),
135  static_cast<int>( rt.DestBlendAlpha ),
136  static_cast<int>( rt.BlendOpAlpha ),
137  rt.RenderTargetWriteMask );
138  }
139  Diligent::HashCombine( Seed,
140  BSDesc.AlphaToCoverageEnable,
141  BSDesc.IndependentBlendEnable );
142  return Seed;
143  }
144  };
145 
146 
148  template<>
149  struct hash<Diligent::TextureViewDesc>
150  {
151  size_t operator()( const Diligent::TextureViewDesc &TexViewDesc ) const
152  {
153  std::size_t Seed = 0;
154  Diligent::HashCombine( Seed,
155  static_cast<Diligent::Int32>(TexViewDesc.ViewType),
156  static_cast<Diligent::Int32>(TexViewDesc.TextureDim),
157  static_cast<Diligent::Int32>(TexViewDesc.Format),
158  TexViewDesc.MostDetailedMip,
159  TexViewDesc.NumMipLevels,
160  TexViewDesc.FirstArraySlice,
161  TexViewDesc.NumArraySlices,
162  TexViewDesc.AccessFlags );
163  return Seed;
164  }
165  };
166 }
167 
168 namespace Diligent
169 {
170 
172 
180 template<typename BaseInterface>
181 class RenderDeviceBase : public ObjectBase<BaseInterface>
182 {
183 public:
184 
185  typedef ObjectBase<BaseInterface> TObjectBase;
186 
200  RenderDeviceBase(IReferenceCounters *pRefCounters,
201  IMemoryAllocator &RawMemAllocator,
202  Uint32 NumDeferredContexts,
203  size_t TextureObjSize,
204  size_t TexViewObjSize,
205  size_t BufferObjSize,
206  size_t BuffViewObjSize,
207  size_t ShaderObjSize,
208  size_t SamplerObjSize,
209  size_t PSOSize,
210  size_t SRBSize) :
211  TObjectBase(pRefCounters),
212  m_TextureFormatsInfo( TEX_FORMAT_NUM_FORMATS, TextureFormatInfoExt(), STD_ALLOCATOR_RAW_MEM(TextureFormatInfoExt, RawMemAllocator, "Allocator for vector<TextureFormatInfoExt>") ),
213  m_TexFmtInfoInitFlags( TEX_FORMAT_NUM_FORMATS, false, STD_ALLOCATOR_RAW_MEM(bool, RawMemAllocator, "Allocator for vector<bool>") ),
214  m_wpDeferredContexts(NumDeferredContexts, RefCntWeakPtr<IDeviceContext>(), STD_ALLOCATOR_RAW_MEM(RefCntWeakPtr<IDeviceContext>, RawMemAllocator, "Allocator for vector< RefCntWeakPtr<IDeviceContext> >")),
215  m_SamplersRegistry(RawMemAllocator, "sampler"),
216  m_TexObjAllocator(RawMemAllocator, TextureObjSize, 64),
217  m_TexViewObjAllocator(RawMemAllocator, TexViewObjSize, 64),
218  m_BufObjAllocator(RawMemAllocator, BufferObjSize, 128),
219  m_BuffViewObjAllocator(RawMemAllocator, BuffViewObjSize, 128),
220  m_ShaderObjAllocator(RawMemAllocator, ShaderObjSize, 32),
221  m_SamplerObjAllocator(RawMemAllocator, SamplerObjSize, 32),
222  m_PSOAllocator(RawMemAllocator, PSOSize, 128),
223  m_SRBAllocator(RawMemAllocator, SRBSize, 1024),
224  m_ResMappingAllocator(RawMemAllocator, sizeof(ResourceMappingImpl), 16)
225  {
226  // Initialize texture format info
227  for( Uint32 Fmt = TEX_FORMAT_UNKNOWN; Fmt < TEX_FORMAT_NUM_FORMATS; ++Fmt )
228  static_cast<TextureFormatAttribs&>(m_TextureFormatsInfo[Fmt]) = GetTextureFormatAttribs( static_cast<TEXTURE_FORMAT>(Fmt) );
229 
230  // https://msdn.microsoft.com/en-us/library/windows/desktop/ff471325(v=vs.85).aspx
231  TEXTURE_FORMAT FilterableFormats[] =
232  {
233  TEX_FORMAT_RGBA32_FLOAT, // OpenGL ES3.1 does not require this format to be filterable
237  TEX_FORMAT_RG32_FLOAT, // OpenGL ES3.1 does not require this format to be filterable
239  //TEX_FORMAT_R10G10B10A2_UNORM,
247  TEX_FORMAT_R32_FLOAT, // OpenGL ES3.1 does not require this format to be filterable
271  };
272  for( Uint32 fmt = 0; fmt < _countof(FilterableFormats); ++fmt )
273  m_TextureFormatsInfo[ FilterableFormats[fmt] ].Filterable = true;
274  }
275 
277  {
278  }
279 
280  IMPLEMENT_QUERY_INTERFACE_IN_PLACE( IID_RenderDevice, ObjectBase<BaseInterface> )
281 
282 
283  virtual void CreateResourceMapping( const ResourceMappingDesc &MappingDesc, IResourceMapping **ppMapping )override final;
284 
286  virtual const DeviceCaps& GetDeviceCaps()const override final
287  {
288  return m_DeviceCaps;
289  }
290 
292  virtual const TextureFormatInfo &GetTextureFormatInfo(TEXTURE_FORMAT TexFormat)override final
293  {
294  VERIFY( TexFormat >= TEX_FORMAT_UNKNOWN && TexFormat < TEX_FORMAT_NUM_FORMATS, "Texture format out of range" );
295  const auto& TexFmtInfo = m_TextureFormatsInfo[TexFormat];
296  VERIFY( TexFmtInfo.Format == TexFormat, "Sanity check failed" );
297  return TexFmtInfo;
298  }
299 
301  virtual const TextureFormatInfoExt &GetTextureFormatInfoExt( TEXTURE_FORMAT TexFormat )override final
302  {
303  VERIFY( TexFormat >= TEX_FORMAT_UNKNOWN && TexFormat < TEX_FORMAT_NUM_FORMATS, "Texture format out of range" );
304  const auto& TexFmtInfo = m_TextureFormatsInfo[TexFormat];
305  VERIFY( TexFmtInfo.Format == TexFormat, "Sanity check failed" );
306  if( !m_TexFmtInfoInitFlags[TexFormat] )
307  {
308  if( TexFmtInfo.Supported )
309  TestTextureFormat(TexFormat);
310  m_TexFmtInfoInitFlags[TexFormat] = true;
311  }
312  return TexFmtInfo;
313  }
314 
315  void OnCreateDeviceObject( IDeviceObject *pNewObject )
316  {
317  }
318 
319  StateObjectsRegistry<SamplerDesc> &GetSamplerRegistry(){ return m_SamplersRegistry; }
320 
322  void SetImmediateContext(IDeviceContext *pImmediateContext)
323  {
324  VERIFY( m_wpImmediateContext.Lock() == nullptr, "Immediate context has already been set" );
325  m_wpImmediateContext = pImmediateContext;
326  }
327 
329  void SetDeferredContext(size_t Ctx, IDeviceContext *pDeferredCtx)
330  {
331  VERIFY( m_wpDeferredContexts[Ctx].Lock() == nullptr, "Deferred context has already been set" );
332  m_wpDeferredContexts[Ctx] = pDeferredCtx;
333  }
334 
337  {
338  return m_wpDeferredContexts.size();
339  }
340 
341  RefCntAutoPtr<IDeviceContext> GetImmediateContext(){ return m_wpImmediateContext.Lock(); }
342  RefCntAutoPtr<IDeviceContext> GetDeferredContext(size_t Ctx){ return m_wpDeferredContexts[Ctx].Lock(); }
343 
344  FixedBlockMemoryAllocator& GetTexViewObjAllocator(){return m_TexViewObjAllocator;}
345  FixedBlockMemoryAllocator& GetBuffViewObjAllocator(){return m_BuffViewObjAllocator;}
346  FixedBlockMemoryAllocator& GetSRBAllocator(){return m_SRBAllocator;}
347 
348 protected:
349 
350  virtual void TestTextureFormat(TEXTURE_FORMAT TexFormat) = 0;
351 
353  template<typename TObjectType, typename TObjectDescType, typename TObjectConstructor>
354  void CreateDeviceObject( const Char *ObjectTypeName, const TObjectDescType &Desc, TObjectType **ppObject, TObjectConstructor ConstructObject );
355 
356  DeviceCaps m_DeviceCaps;
357 
358  // All state object registries hold raw pointers.
359  // This is safe because every object unregisters itself
360  // when it is deleted.
362  std::vector<TextureFormatInfoExt, STDAllocatorRawMem<TextureFormatInfoExt> > m_TextureFormatsInfo;
363  std::vector<bool, STDAllocatorRawMem<bool> > m_TexFmtInfoInitFlags;
364 
368 
370  std::vector< RefCntWeakPtr<IDeviceContext>, STDAllocatorRawMem<RefCntWeakPtr<IDeviceContext> > > m_wpDeferredContexts;
371 
381 };
382 
383 
384 template<typename BaseInterface>
386 {
387  VERIFY( ppMapping != nullptr, "Null pointer provided" );
388  if( ppMapping == nullptr )
389  return;
390  VERIFY( *ppMapping == nullptr, "Overwriting reference to existing object may cause memory leaks" );
391 
392  auto *pResourceMapping( NEW_RC_OBJ(m_ResMappingAllocator, "ResourceMappingImpl instance", ResourceMappingImpl)(GetRawAllocator()) );
393  pResourceMapping->QueryInterface( IID_ResourceMapping, reinterpret_cast<IObject**>(ppMapping) );
394  if( MappingDesc.pEntries )
395  {
396  for( auto *pEntry = MappingDesc.pEntries; pEntry->Name && pEntry->pObject; ++pEntry )
397  {
398  (*ppMapping)->AddResourceArray( pEntry->Name, pEntry->ArrayIndex, &pEntry->pObject, 1, true );
399  }
400  }
401 }
402 
403 
411 template<typename BaseInterface>
412 template<typename TObjectType, typename TObjectDescType, typename TObjectConstructor>
413 void RenderDeviceBase<BaseInterface> :: CreateDeviceObject( const Char *ObjectTypeName, const TObjectDescType &Desc, TObjectType **ppObject, TObjectConstructor ConstructObject )
414 {
415  VERIFY( ppObject != nullptr, "Null pointer provided" );
416  if(!ppObject)
417  return;
418 
419  VERIFY( *ppObject == nullptr, "Overwriting reference to existing object may cause memory leaks" );
420  // Do not release *ppObject here!
421  // Should this happen, RefCntAutoPtr<> will take care of this!
422  //if( *ppObject )
423  //{
424  // (*ppObject)->Release();
425  // *ppObject = nullptr;
426  //}
427 
428  *ppObject = nullptr;
429 
430  try
431  {
432  ConstructObject();
433  }
434  catch( const std::runtime_error & )
435  {
436  VERIFY( *ppObject == nullptr, "Object was created despite error" );
437  if( *ppObject )
438  {
439  (*ppObject)->Release();
440  *ppObject = nullptr;
441  }
442  auto ObjectDescString = GetObjectDescString( Desc );
443  if( ObjectDescString.length() )
444  {
445  LOG_ERROR( "Failed to create ", ObjectTypeName, " object \"", Desc.Name ? Desc.Name : "", "\"\n", ObjectDescString );
446  }
447  else
448  {
449  LOG_ERROR( "Failed to create ", ObjectTypeName, " object \"", Desc.Name ? Desc.Name : "", "\"" );
450  }
451  }
452 }
453 
454 }
STENCIL_OP StencilPassOp
The stencil operation to perform when stencil testing and depth testing both pass.
Definition: DepthStencilState.h:101
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:244
FixedBlockMemoryAllocator m_ResMappingAllocator
Allocator for resource mapping objects.
Definition: RenderDeviceBase.h:380
COMPARISON_FUNCTION StencilFunc
A function that compares stencil data against existing stencil data. See Diligent::COMPARISON_FUNCTIO...
Definition: DepthStencilState.h:105
RESOURCE_DIMENSION TextureDim
View interpretation of the original texture. For instance, one slice of a 2D texture array can be vie...
Definition: TextureView.h:65
void SetDeferredContext(size_t Ctx, IDeviceContext *pDeferredCtx)
Set weak reference to the deferred context.
Definition: RenderDeviceBase.h:329
virtual void CreateResourceMapping(const ResourceMappingDesc &MappingDesc, IResourceMapping **ppMapping) override final
Implementation of IRenderDevice::CreateResourceMapping().
Definition: RenderDeviceBase.h:385
Four-component unsigned-normalized-integer block-compression format with 5 bits for R...
Definition: GraphicsTypes.h:615
Int32 DepthBias
Constant value added to the depth of a given pixel.
Definition: RasterizerState.h:105
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:40
Single-component 8-bit unsigned-normalized-integer format. D3D counterpart: DXGI_FORMAT_R8_UNORM. OpenGL counterpart: GL_R8.
Definition: GraphicsTypes.h:510
Unknown format.
Definition: GraphicsTypes.h:247
FixedBlockMemoryAllocator m_TexObjAllocator
Allocator for texture objects.
Definition: RenderDeviceBase.h:372
ResourceMappingEntry * pEntries
Pointer to the array of resource mapping entries. The last element in the array must be default value...
Definition: ResourceMapping.h:65
Two-component 32-bit signed-normalized-integer format with 16-bit channels. D3D counterpart: DXGI_F...
Definition: GraphicsTypes.h:409
Two-component unsigned-normalized-integer block-compression format with 8 bits for R and 8 bits for G...
Definition: GraphicsTypes.h:667
float MaxLOD
Specifies the maximum value that LOD is clamped to before accessing the texture MIP levels...
Definition: Sampler.h:95
Four-component unsigned-normalized-integer block-compression format with 5 bits for R...
Definition: GraphicsTypes.h:563
Uint8 StencilWriteMask
Identify which bits of the depth-stencil buffer are accessed when writing stencil data...
Definition: DepthStencilState.h:166
RefCntWeakPtr< IDeviceContext > m_wpImmediateContext
Weak reference to the immediate context. Immediate context holds strong reference to the device...
Definition: RenderDeviceBase.h:367
Single-component 32-bit floating-point format. D3D counterpart: DXGI_FORMAT_R32_FLOAT. OpenGL counterpart: GL_R32F.
Definition: GraphicsTypes.h:425
StateObjectsRegistry< SamplerDesc > m_SamplersRegistry
Sampler state registry.
Definition: RenderDeviceBase.h:361
Bool AlphaToCoverageEnable
Specifies whether to use alpha-to-coverage as a multisampling technique when setting a pixel to a ren...
Definition: BlendState.h:355
Bool DepthEnable
Enable depth-stencil operations. When it is set to False, depth test always passes, depth writes are disabled, and no stencil operations are performed.
Definition: DepthStencilState.h:150
Uint8 StencilReadMask
Identify which bits of the depth-stencil buffer are accessed when reading stencil data...
Definition: DepthStencilState.h:163
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
void SetImmediateContext(IDeviceContext *pImmediateContext)
Set weak reference to the immediate context.
Definition: RenderDeviceBase.h:322
FILL_MODE FillMode
Determines traingle fill mode, see Diligent::FILL_MODE for details.
Definition: RasterizerState.h:93
Definition: AdvancedMath.h:316
Bool DepthClipEnable
Enable clipping based on distance.
Definition: RasterizerState.h:117
Bool FrontCounterClockwise
Determines if a triangle is front- or back-facing. If this parameter is True, a triangle will be cons...
Definition: RasterizerState.h:102
TEXTURE_ADDRESS_MODE AddressV
Texture address mode for V coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
Definition: Sampler.h:69
Device capabilities.
Definition: DeviceCaps.h:96
FixedBlockMemoryAllocator m_TexViewObjAllocator
Allocator for texture view objects.
Definition: RenderDeviceBase.h:373
Two-component 16-bit unsigned-normalized-integer format with 8-bit channels. D3D counterpart: DXGI_...
Definition: GraphicsTypes.h:458
Four-component 64-bit unsigned-normalized-integer format with 16-bit channels. D3D counterpart: DXG...
Definition: GraphicsTypes.h:297
StencilOpDesc FrontFace
Identify stencil operations for the front-facing triangles, see Diligent::StencilOpDesc.
Definition: DepthStencilState.h:169
IMemoryAllocator & GetRawAllocator()
Returns raw memory allocator.
Definition: EngineMemory.cpp:46
One-component unsigned-normalized-integer block-compression format with 8 bits for R channel...
Definition: GraphicsTypes.h:641
Single-component 16-bit unsigned-normalized-integer format. D3D counterpart: DXGI_FORMAT_R16_UNORM...
Definition: GraphicsTypes.h:488
Resouce mapping.
Definition: ResourceMapping.h:80
Two-component 32-bit half-precision floating-point format with 16-bit channels. D3D counterpart: DX...
Definition: GraphicsTypes.h:393
Uint32 MostDetailedMip
Most detailed mip level to use.
Definition: TextureView.h:72
virtual const TextureFormatInfo & GetTextureFormatInfo(TEXTURE_FORMAT TexFormat) override final
Implementation of IRenderDevice::GetTextureFormatInfo().
Definition: RenderDeviceBase.h:292
Four-component 32-bit signed-normalized-integer format with 8-bit channels. D3D counterpart: DXGI_F...
Definition: GraphicsTypes.h:381
STENCIL_OP StencilFailOp
The stencil operation to perform when stencil testing fails.
Definition: DepthStencilState.h:95
Single-component 8-bit unsigned-normalized-integer format for alpha only. D3D counterpart: DXGI_FOR...
Definition: GraphicsTypes.h:527
Three-component 16-bit unsigned-normalized-integer format with 5 bits for blue, 6 bits for green...
Definition: GraphicsTypes.h:681
std::vector< RefCntWeakPtr< IDeviceContext >, STDAllocatorRawMem< RefCntWeakPtr< IDeviceContext > > > m_wpDeferredContexts
Weak references to deferred contexts.
Definition: RenderDeviceBase.h:370
Describes stencil operations that are performed based on the results of depth test.
Definition: DepthStencilState.h:92
Four-component 32-bit unsigned-normalized-integer format with 8-bit channels. D3D counterpart: DXGI...
Definition: GraphicsTypes.h:369
TEXTURE_ADDRESS_MODE AddressU
Texture address mode for U coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
Definition: Sampler.h:66
FixedBlockMemoryAllocator m_PSOAllocator
Allocator for pipeline state objects.
Definition: RenderDeviceBase.h:378
TEXTURE_ADDRESS_MODE AddressW
Texture address mode for W coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
Definition: Sampler.h:72
Three-component 32-bit format encoding three partial precision channels using 11 bits for red and gre...
Definition: GraphicsTypes.h:361
Sampler description.
Definition: Sampler.h:52
Blend state description.
Definition: BlendState.h:351
Four-component unsigned-normalized integer format analogous to UYVY encoding. D3D counterpart: DXGI...
Definition: GraphicsTypes.h:541
Float32 MipLODBias
Offset from the calculated mipmap level. For example, if a sampler calculates that a texture should b...
Definition: Sampler.h:77
Single-component 16-bit half-precisoin floating-point format. D3D counterpart: DXGI_FORMAT_R16_FLOA...
Definition: GraphicsTypes.h:478
Bool ScissorEnable
Enable scissor-rectangle culling. All pixels outside an active scissor rectangle are culled...
Definition: RasterizerState.h:120
Four-component unsigned-normalized-integer block-compression format with 5 bits for R...
Definition: GraphicsTypes.h:589
COMPARISON_FUNCTION ComparisonFunc
A function that compares sampled data against existing sampled data when comparsion filter is used...
Definition: Sampler.h:84
float MinLOD
Specifies the minimum value that LOD is clamped to before accessing the texture MIP levels...
Definition: Sampler.h:91
FixedBlockMemoryAllocator m_BufObjAllocator
Allocator for buffer objects.
Definition: RenderDeviceBase.h:374
Device context interface.
Definition: DeviceContext.h:443
Template class implementing state object registry.
Definition: StateObjectsRegistry.h:58
Resource mapping description.
Definition: ResourceMapping.h:60
size_t GetNumDeferredContexts() const
Returns number of deferred contexts.
Definition: RenderDeviceBase.h:336
Four-component unsigned-normalized-integer block-compression sRGB format with 5 bits for R...
Definition: GraphicsTypes.h:572
FixedBlockMemoryAllocator m_BuffViewObjAllocator
Allocator for buffer view objects.
Definition: RenderDeviceBase.h:375
Base implementation of a render device.
Definition: DeviceObjectBase.h:36
STENCIL_OP StencilDepthFailOp
The stencil operation to perform when stencil testing passes and depth testing fails.
Definition: DepthStencilState.h:98
Implementation of weak pointers.
Definition: RefCntAutoPtr.h:38
Two-component 32-bit format with 24 bits for unsigned-normalized-integer data and 8 bits of unreferen...
Definition: GraphicsTypes.h:445
Two-component 64-bit floating-point format with 32-bit channels. D3D counterpart: DXGI_FORMAT_R32G3...
Definition: GraphicsTypes.h:320
Bool DepthWriteEnable
Enable or disable writes to a depth buffer.
Definition: DepthStencilState.h:153
CULL_MODE CullMode
Determines traingle cull mode, see Diligent::CULL_MODE for details.
Definition: RasterizerState.h:96
Four-component 64-bit signed-normalized-integer format with 16-bit channels. D3D counterpart: DXGI_...
Definition: GraphicsTypes.h:308
Float32 SlopeScaledDepthBias
Scalar that scales the given pixel&#39;s slope before adding to the pixel&#39;s depth.
Definition: RasterizerState.h:112
StencilOpDesc BackFace
Identify stencil operations for the back-facing triangles, see Diligent::StencilOpDesc.
Definition: DepthStencilState.h:172
Rasterizer state description.
Definition: RasterizerState.h:90
Memory allocator that allocates memory in a fixed-size chunks.
Definition: FixedBlockMemoryAllocator.h:50
Four-component unsigned-normalized-integer block-compression sRGB format with 5 bits for R...
Definition: GraphicsTypes.h:624
One-component signed-normalized-integer block-compression format with 8 bits for R channel...
Definition: GraphicsTypes.h:650
virtual const DeviceCaps & GetDeviceCaps() const override final
Implementation of IRenderDevice::GetDeviceCaps().
Definition: RenderDeviceBase.h:286
Texture view description.
Definition: TextureView.h:55
TEXTURE_VIEW_TYPE ViewType
Describes the texture view type, see Diligent::TEXTURE_VIEW_TYPE for details.
Definition: TextureView.h:58
Two-component signed-normalized-integer block-compression format with 8 bits for R and 8 bits for G c...
Definition: GraphicsTypes.h:676
Three partial-precision floating pointer numbers sharing single exponent encoded into a 32-bit value...
Definition: GraphicsTypes.h:536
Four-component unsigned-normalized integer format analogous to YUY2 encoding. D3D counterpart: DXGI...
Definition: GraphicsTypes.h:546
Bool IndependentBlendEnable
Specifies whether to enable independent blending in simultaneous render targets. If set to False...
Definition: BlendState.h:359
void CreateDeviceObject(const Char *ObjectTypeName, const TObjectDescType &Desc, TObjectType **ppObject, TObjectConstructor ConstructObject)
Helper template function to facilitate device object creation.
Definition: RenderDeviceBase.h:413
Bool StencilEnable
Enable stencil opertaions.
Definition: DepthStencilState.h:160
const Char * Name
Object name.
Definition: ResourceMapping.h:41
Depth stencil state description.
Definition: DepthStencilState.h:145
Single-component 8-bit signed-normalized-integer format. D3D counterpart: DXGI_FORMAT_R8_SNORM. OpenGL counterpart: GL_R8_SNORM.
Definition: GraphicsTypes.h:518
Extended texture format description.
Definition: GraphicsTypes.h:1115
static constexpr int MaxRenderTargets
Constant member defining the maximum number of render targets.
Definition: BlendState.h:362
Four-component 32-bit unsigned-normalized-integer sRGB format with 8-bit channels. D3D counterpart: DXGI_FORMAT_R8G8B8A8_UNORM_SRGB. OpenGL counterpart: GL_SRGB8_ALPHA8.
Definition: GraphicsTypes.h:373
Float32 DepthBiasClamp
Maximum depth bias of a pixel.
Definition: RasterizerState.h:109
FixedBlockMemoryAllocator m_SRBAllocator
Allocator for shader resource binding objects.
Definition: RenderDeviceBase.h:379
Helper member containing the total number of texture formats in the enumeration.
Definition: GraphicsTypes.h:772
Uint32 NumMipLevels
Total number of mip levels for the view of the texture. Render target and depth stencil views can add...
Definition: TextureView.h:79
FILTER_TYPE MipFilter
Mip filter, see Diligent::FILTER_TYPE for details. Only FILTER_TYPE_POINT, FILTER_TYPE_LINEAR, FILTER_TYPE_ANISOTROPIC, and FILTER_TYPE_COMPARISON_ANISOTROPIC are allowed.
Definition: Sampler.h:63
RenderDeviceBase(IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator, Uint32 NumDeferredContexts, size_t TextureObjSize, size_t TexViewObjSize, size_t BufferObjSize, size_t BuffViewObjSize, size_t ShaderObjSize, size_t SamplerObjSize, size_t PSOSize, size_t SRBSize)
Definition: RenderDeviceBase.h:200
Template class that implements reference counting.
Definition: RefCntAutoPtr.h:71
Float32 BorderColor[4]
Border color to use if TEXTURE_ADDRESS_BORDER is specified for AddressU, AddressV, or AddressW.
Definition: Sampler.h:87
Uint32 MaxAnisotropy
Maximum anisotropy level for the anisotropic filter.
Definition: Sampler.h:80
FILTER_TYPE MinFilter
Texture minification filter, see Diligent::FILTER_TYPE for details.
Definition: Sampler.h:55
Four-component 128-bit floating-point format with 32-bit channels. D3D counterpart: DXGI_FORMAT_R32...
Definition: GraphicsTypes.h:255
FixedBlockMemoryAllocator m_SamplerObjAllocator
Allocator for sampler objects.
Definition: RenderDeviceBase.h:377
Two-component 16-bit signed-normalized-integer format with 8-bit channels. D3D counterpart: DXGI_FO...
Definition: GraphicsTypes.h:466
Implementation of the resource mapping.
Definition: ResourceMappingImpl.h:93
Four-component signed-normalized-integer block-compression sRGB format with 5 bits for R...
Definition: GraphicsTypes.h:598
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:94
FILTER_TYPE MagFilter
Texture magnification filter, see Diligent::FILTER_TYPE for details.
Definition: Sampler.h:58
TEXTURE_FORMAT Format
View format. If default value Diligent::TEX_FORMAT_UNKNOWN is provided, the view format will match th...
Definition: TextureView.h:69
Two-component 32-bit unsigned-normalized-integer format with 16-bit channels. D3D counterpart: DXGI...
Definition: GraphicsTypes.h:399
Two-component 64-bit format with 32-bit floating-point R channel and 8+24-bits of typeless data...
Definition: GraphicsTypes.h:340
Uint32 AccessFlags
For an unordered access view, allowed access flags. See Diligent::UAV_ACCESS_FLAG for details...
Definition: TextureView.h:103
Four-component 64-bit half-precision floating-point format with 16-bit channels. D3D counterpart: D...
Definition: GraphicsTypes.h:291
COMPARISON_FUNCTION DepthFunc
A function that compares depth data against existing depth data. See Diligent::COMPARISON_FUNCTION fo...
Definition: DepthStencilState.h:157
RenderTargetBlendDesc RenderTargets[MaxRenderTargets]
An array of RenderTargetBlendDesc structures that describe the blend states for render targets...
Definition: BlendState.h:366
FixedBlockMemoryAllocator m_ShaderObjAllocator
Allocator for shader objects.
Definition: RenderDeviceBase.h:376
Bool AntialiasedLineEnable
Specifies whether to enable line antialiasing.
Definition: RasterizerState.h:123
virtual const TextureFormatInfoExt & GetTextureFormatInfoExt(TEXTURE_FORMAT TexFormat) override final
Implementation of IRenderDevice::GetTextureFormatInfoExt().
Definition: RenderDeviceBase.h:301
Single-component 16-bit signed-normalized-integer format. D3D counterpart: DXGI_FORMAT_R16_SNORM. OpenGL counterpart: GL_R16_SNORM. OpenGLES: GL_EXT_texture_norm16 extension is required.
Definition: GraphicsTypes.h:498
Basic texture format description.
Definition: GraphicsTypes.h:1101
Uint32 FirstArraySlice
For a texture array, first array slice to address in the view.
Definition: TextureView.h:84