Diligent Engine API Reference: D:/GitHub/DiligentEngine/DiligentCore/Graphics/GraphicsEngine/include/RenderDeviceBase.h Source File

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
234 TEX_FORMAT_RGBA16_FLOAT,
235 TEX_FORMAT_RGBA16_UNORM,
236 TEX_FORMAT_RGBA16_SNORM,
237 TEX_FORMAT_RG32_FLOAT, // OpenGL ES3.1 does not require this format to be filterable
238 TEX_FORMAT_R32_FLOAT_X8X24_TYPELESS,
239 //TEX_FORMAT_R10G10B10A2_UNORM,
240 TEX_FORMAT_R11G11B10_FLOAT,
241 TEX_FORMAT_RGBA8_UNORM,
242 TEX_FORMAT_RGBA8_UNORM_SRGB,
243 TEX_FORMAT_RGBA8_SNORM,
244 TEX_FORMAT_RG16_FLOAT,
245 TEX_FORMAT_RG16_UNORM,
246 TEX_FORMAT_RG16_SNORM,
247 TEX_FORMAT_R32_FLOAT, // OpenGL ES3.1 does not require this format to be filterable
248 TEX_FORMAT_R24_UNORM_X8_TYPELESS,
249 TEX_FORMAT_RG8_UNORM,
250 TEX_FORMAT_RG8_SNORM,
251 TEX_FORMAT_R16_FLOAT,
252 TEX_FORMAT_R16_UNORM,
253 TEX_FORMAT_R16_SNORM,
254 TEX_FORMAT_R8_UNORM,
255 TEX_FORMAT_R8_SNORM,
256 TEX_FORMAT_A8_UNORM,
257 TEX_FORMAT_RGB9E5_SHAREDEXP,
258 TEX_FORMAT_RG8_B8G8_UNORM,
259 TEX_FORMAT_G8R8_G8B8_UNORM,
260 TEX_FORMAT_BC1_UNORM,
261 TEX_FORMAT_BC1_UNORM_SRGB,
262 TEX_FORMAT_BC2_UNORM,
263 TEX_FORMAT_BC2_UNORM_SRGB,
264 TEX_FORMAT_BC3_UNORM,
265 TEX_FORMAT_BC3_UNORM_SRGB,
266 TEX_FORMAT_BC4_UNORM,
267 TEX_FORMAT_BC4_SNORM,
268 TEX_FORMAT_BC5_UNORM,
269 TEX_FORMAT_BC5_SNORM,
270 TEX_FORMAT_B5G6R5_UNORM
271 };
272 for( Uint32 fmt = 0; fmt < _countof(FilterableFormats); ++fmt )
273 m_TextureFormatsInfo[ FilterableFormats[fmt] ].Filterable = true;
274 }
275
276 ~RenderDeviceBase()
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
336 size_t GetNumDeferredContexts()const
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.
361 StateObjectsRegistry<SamplerDesc> m_SamplersRegistry;
362 std::vector<TextureFormatInfoExt, STDAllocatorRawMem<TextureFormatInfoExt> > m_TextureFormatsInfo;
363 std::vector<bool, STDAllocatorRawMem<bool> > m_TexFmtInfoInitFlags;
364
367 RefCntWeakPtr<IDeviceContext> m_wpImmediateContext;
368
370 std::vector< RefCntWeakPtr<IDeviceContext>, STDAllocatorRawMem<RefCntWeakPtr<IDeviceContext> > > m_wpDeferredContexts;
371
372 FixedBlockMemoryAllocator m_TexObjAllocator;
373 FixedBlockMemoryAllocator m_TexViewObjAllocator;
374 FixedBlockMemoryAllocator m_BufObjAllocator;
375 FixedBlockMemoryAllocator m_BuffViewObjAllocator;
376 FixedBlockMemoryAllocator m_ShaderObjAllocator;
377 FixedBlockMemoryAllocator m_SamplerObjAllocator;
378 FixedBlockMemoryAllocator m_PSOAllocator;
379 FixedBlockMemoryAllocator m_SRBAllocator;
380 FixedBlockMemoryAllocator m_ResMappingAllocator;
381 };
382
383
384 template<typename BaseInterface>
385 void RenderDeviceBase<BaseInterface>::CreateResourceMapping( const ResourceMappingDesc &MappingDesc, IResourceMapping **ppMapping )
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 }
Diligent::StencilOpDesc::StencilPassOp
STENCIL_OP StencilPassOp
The stencil operation to perform when stencil testing and depth testing both pass.
Definition: DepthStencilState.h:101
Diligent::TEXTURE_FORMAT
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:244
Diligent::RenderDeviceBase::m_ResMappingAllocator
FixedBlockMemoryAllocator m_ResMappingAllocator
Allocator for resource mapping objects.
Definition: RenderDeviceBase.h:380
Diligent::StencilOpDesc::StencilFunc
COMPARISON_FUNCTION StencilFunc
A function that compares stencil data against existing stencil data. See Diligent::COMPARISON_FUNCTIO...
Definition: DepthStencilState.h:105
Diligent::TextureViewDesc::TextureDim
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
Diligent::RenderDeviceBase::SetDeferredContext
void SetDeferredContext(size_t Ctx, IDeviceContext *pDeferredCtx)
Set weak reference to the deferred context.
Definition: RenderDeviceBase.h:329
Diligent::RenderDeviceBase::CreateResourceMapping
virtual void CreateResourceMapping(const ResourceMappingDesc &MappingDesc, IResourceMapping **ppMapping) override final
Implementation of IRenderDevice::CreateResourceMapping().
Definition: RenderDeviceBase.h:385
Diligent::TEX_FORMAT_BC3_UNORM
Four-component unsigned-normalized-integer block-compression format with 5 bits for R...
Definition: GraphicsTypes.h:615
Diligent::RasterizerStateDesc::DepthBias
Int32 DepthBias
Constant value added to the depth of a given pixel.
Definition: RasterizerState.h:105
Diligent::IDeviceObject
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:40
Diligent::TEX_FORMAT_R8_UNORM
Single-component 8-bit unsigned-normalized-integer format. D3D counterpart: DXGI_FORMAT_R8_UNORM. OpenGL counterpart: GL_R8.
Definition: GraphicsTypes.h:510
Diligent::TEX_FORMAT_UNKNOWN
Unknown format.
Definition: GraphicsTypes.h:247
Diligent::ObjectBase< IGLDeviceBaseInterface >
Diligent::RenderDeviceBase::m_TexObjAllocator
FixedBlockMemoryAllocator m_TexObjAllocator
Allocator for texture objects.
Definition: RenderDeviceBase.h:372
Diligent::ResourceMappingDesc::pEntries
ResourceMappingEntry * pEntries
Pointer to the array of resource mapping entries. The last element in the array must be default value...
Definition: ResourceMapping.h:65
Diligent::TEX_FORMAT_RG16_SNORM
Two-component 32-bit signed-normalized-integer format with 16-bit channels. D3D counterpart: DXGI_F...
Definition: GraphicsTypes.h:409
Diligent::TEX_FORMAT_BC5_UNORM
Two-component unsigned-normalized-integer block-compression format with 8 bits for R and 8 bits for G...
Definition: GraphicsTypes.h:667
Diligent::SamplerDesc::MaxLOD
float MaxLOD
Specifies the maximum value that LOD is clamped to before accessing the texture MIP levels...
Definition: Sampler.h:95
Diligent::TEX_FORMAT_BC1_UNORM
Four-component unsigned-normalized-integer block-compression format with 5 bits for R...
Definition: GraphicsTypes.h:563
Diligent::DepthStencilStateDesc::StencilWriteMask
Uint8 StencilWriteMask
Identify which bits of the depth-stencil buffer are accessed when writing stencil data...
Definition: DepthStencilState.h:166
Diligent::RenderDeviceBase::m_wpImmediateContext
RefCntWeakPtr< IDeviceContext > m_wpImmediateContext
Weak reference to the immediate context. Immediate context holds strong reference to the device...
Definition: RenderDeviceBase.h:367
Diligent::TEX_FORMAT_R32_FLOAT
Single-component 32-bit floating-point format. D3D counterpart: DXGI_FORMAT_R32_FLOAT. OpenGL counterpart: GL_R32F.
Definition: GraphicsTypes.h:425
Diligent::RenderDeviceBase::m_SamplersRegistry
StateObjectsRegistry< SamplerDesc > m_SamplersRegistry
Sampler state registry.
Definition: RenderDeviceBase.h:361
Diligent::BlendStateDesc::AlphaToCoverageEnable
Bool AlphaToCoverageEnable
Specifies whether to use alpha-to-coverage as a multisampling technique when setting a pixel to a ren...
Definition: BlendState.h:355
Diligent::DepthStencilStateDesc::DepthEnable
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
Diligent::DepthStencilStateDesc::StencilReadMask
Uint8 StencilReadMask
Identify which bits of the depth-stencil buffer are accessed when reading stencil data...
Definition: DepthStencilState.h:163
Diligent
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Diligent::RenderDeviceBase::SetImmediateContext
void SetImmediateContext(IDeviceContext *pImmediateContext)
Set weak reference to the immediate context.
Definition: RenderDeviceBase.h:322
Diligent::RasterizerStateDesc::FillMode
FILL_MODE FillMode
Determines traingle fill mode, see Diligent::FILL_MODE for details.
Definition: RasterizerState.h:93
std
Definition: AdvancedMath.h:316
Diligent::RasterizerStateDesc::DepthClipEnable
Bool DepthClipEnable
Enable clipping based on distance.
Definition: RasterizerState.h:117
Diligent::RasterizerStateDesc::FrontCounterClockwise
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
Diligent::SamplerDesc::AddressV
TEXTURE_ADDRESS_MODE AddressV
Texture address mode for V coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
Definition: Sampler.h:69
Diligent::DeviceCaps
Device capabilities.
Definition: DeviceCaps.h:96
Diligent::RenderDeviceBase::m_TexViewObjAllocator
FixedBlockMemoryAllocator m_TexViewObjAllocator
Allocator for texture view objects.
Definition: RenderDeviceBase.h:373
Diligent::TEX_FORMAT_RG8_UNORM
Two-component 16-bit unsigned-normalized-integer format with 8-bit channels. D3D counterpart: DXGI_...
Definition: GraphicsTypes.h:458
Diligent::TEX_FORMAT_RGBA16_UNORM
Four-component 64-bit unsigned-normalized-integer format with 16-bit channels. D3D counterpart: DXG...
Definition: GraphicsTypes.h:297
Diligent::DepthStencilStateDesc::FrontFace
StencilOpDesc FrontFace
Identify stencil operations for the front-facing triangles, see Diligent::StencilOpDesc.
Definition: DepthStencilState.h:169
Diligent::GetRawAllocator
IMemoryAllocator & GetRawAllocator()
Returns raw memory allocator.
Definition: EngineMemory.cpp:46
Diligent::TEX_FORMAT_BC4_UNORM
One-component unsigned-normalized-integer block-compression format with 8 bits for R channel...
Definition: GraphicsTypes.h:641
Diligent::TEX_FORMAT_R16_UNORM
Single-component 16-bit unsigned-normalized-integer format. D3D counterpart: DXGI_FORMAT_R16_UNORM...
Definition: GraphicsTypes.h:488
Diligent::IResourceMapping
Resouce mapping.
Definition: ResourceMapping.h:80
Diligent::TEX_FORMAT_RG16_FLOAT
Two-component 32-bit half-precision floating-point format with 16-bit channels. D3D counterpart: DX...
Definition: GraphicsTypes.h:393
Diligent::TextureViewDesc::MostDetailedMip
Uint32 MostDetailedMip
Most detailed mip level to use.
Definition: TextureView.h:72
Diligent::RenderDeviceBase::GetTextureFormatInfo
virtual const TextureFormatInfo & GetTextureFormatInfo(TEXTURE_FORMAT TexFormat) override final
Implementation of IRenderDevice::GetTextureFormatInfo().
Definition: RenderDeviceBase.h:292
Diligent::TEX_FORMAT_RGBA8_SNORM
Four-component 32-bit signed-normalized-integer format with 8-bit channels. D3D counterpart: DXGI_F...
Definition: GraphicsTypes.h:381
Diligent::StencilOpDesc::StencilFailOp
STENCIL_OP StencilFailOp
The stencil operation to perform when stencil testing fails.
Definition: DepthStencilState.h:95
Diligent::TEX_FORMAT_A8_UNORM
Single-component 8-bit unsigned-normalized-integer format for alpha only. D3D counterpart: DXGI_FOR...
Definition: GraphicsTypes.h:527
Diligent::TEX_FORMAT_B5G6R5_UNORM
Three-component 16-bit unsigned-normalized-integer format with 5 bits for blue, 6 bits for green...
Definition: GraphicsTypes.h:681
Diligent::RenderDeviceBase::m_wpDeferredContexts
std::vector< RefCntWeakPtr< IDeviceContext >, STDAllocatorRawMem< RefCntWeakPtr< IDeviceContext > > > m_wpDeferredContexts
Weak references to deferred contexts.
Definition: RenderDeviceBase.h:370
Diligent::StencilOpDesc
Describes stencil operations that are performed based on the results of depth test.
Definition: DepthStencilState.h:92
Diligent::TEX_FORMAT_RGBA8_UNORM
Four-component 32-bit unsigned-normalized-integer format with 8-bit channels. D3D counterpart: DXGI...
Definition: GraphicsTypes.h:369
Diligent::SamplerDesc::AddressU
TEXTURE_ADDRESS_MODE AddressU
Texture address mode for U coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
Definition: Sampler.h:66
Diligent::RenderDeviceBase::m_PSOAllocator
FixedBlockMemoryAllocator m_PSOAllocator
Allocator for pipeline state objects.
Definition: RenderDeviceBase.h:378
Diligent::SamplerDesc::AddressW
TEXTURE_ADDRESS_MODE AddressW
Texture address mode for W coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
Definition: Sampler.h:72
Diligent::TEX_FORMAT_R11G11B10_FLOAT
Three-component 32-bit format encoding three partial precision channels using 11 bits for red and gre...
Definition: GraphicsTypes.h:361
Diligent::SamplerDesc
Sampler description.
Definition: Sampler.h:52
Diligent::BlendStateDesc
Blend state description.
Definition: BlendState.h:351
Diligent::TEX_FORMAT_RG8_B8G8_UNORM
Four-component unsigned-normalized integer format analogous to UYVY encoding. D3D counterpart: DXGI...
Definition: GraphicsTypes.h:541
Diligent::SamplerDesc::MipLODBias
Float32 MipLODBias
Offset from the calculated mipmap level. For example, if a sampler calculates that a texture should b...
Definition: Sampler.h:77
Diligent::TEX_FORMAT_R16_FLOAT
Single-component 16-bit half-precisoin floating-point format. D3D counterpart: DXGI_FORMAT_R16_FLOA...
Definition: GraphicsTypes.h:478
Diligent::RasterizerStateDesc::ScissorEnable
Bool ScissorEnable
Enable scissor-rectangle culling. All pixels outside an active scissor rectangle are culled...
Definition: RasterizerState.h:120
Diligent::TEX_FORMAT_BC2_UNORM
Four-component unsigned-normalized-integer block-compression format with 5 bits for R...
Definition: GraphicsTypes.h:589
Diligent::SamplerDesc::ComparisonFunc
COMPARISON_FUNCTION ComparisonFunc
A function that compares sampled data against existing sampled data when comparsion filter is used...
Definition: Sampler.h:84
Diligent::SamplerDesc::MinLOD
float MinLOD
Specifies the minimum value that LOD is clamped to before accessing the texture MIP levels...
Definition: Sampler.h:91
Diligent::RenderDeviceBase::m_BufObjAllocator
FixedBlockMemoryAllocator m_BufObjAllocator
Allocator for buffer objects.
Definition: RenderDeviceBase.h:374
Diligent::IDeviceContext
Device context interface.
Definition: DeviceContext.h:443
Diligent::StateObjectsRegistry
Template class implementing state object registry.
Definition: StateObjectsRegistry.h:58
Diligent::ResourceMappingDesc
Resource mapping description.
Definition: ResourceMapping.h:60
Diligent::RenderDeviceBase::GetNumDeferredContexts
size_t GetNumDeferredContexts() const
Returns number of deferred contexts.
Definition: RenderDeviceBase.h:336
Diligent::TEX_FORMAT_BC1_UNORM_SRGB
Four-component unsigned-normalized-integer block-compression sRGB format with 5 bits for R...
Definition: GraphicsTypes.h:572
Diligent::RenderDeviceBase::m_BuffViewObjAllocator
FixedBlockMemoryAllocator m_BuffViewObjAllocator
Allocator for buffer view objects.
Definition: RenderDeviceBase.h:375
Diligent::RenderDeviceBase
Base implementation of a render device.
Definition: DeviceObjectBase.h:36
Diligent::StencilOpDesc::StencilDepthFailOp
STENCIL_OP StencilDepthFailOp
The stencil operation to perform when stencil testing passes and depth testing fails.
Definition: DepthStencilState.h:98
Diligent::RefCntWeakPtr
Implementation of weak pointers.
Definition: RefCntAutoPtr.h:38
Diligent::TEX_FORMAT_R24_UNORM_X8_TYPELESS
Two-component 32-bit format with 24 bits for unsigned-normalized-integer data and 8 bits of unreferen...
Definition: GraphicsTypes.h:445
Diligent::TEX_FORMAT_RG32_FLOAT
Two-component 64-bit floating-point format with 32-bit channels. D3D counterpart: DXGI_FORMAT_R32G3...
Definition: GraphicsTypes.h:320
Diligent::DepthStencilStateDesc::DepthWriteEnable
Bool DepthWriteEnable
Enable or disable writes to a depth buffer.
Definition: DepthStencilState.h:153
Diligent::RasterizerStateDesc::CullMode
CULL_MODE CullMode
Determines traingle cull mode, see Diligent::CULL_MODE for details.
Definition: RasterizerState.h:96
Diligent::TEX_FORMAT_RGBA16_SNORM
Four-component 64-bit signed-normalized-integer format with 16-bit channels. D3D counterpart: DXGI_...
Definition: GraphicsTypes.h:308
Diligent::RasterizerStateDesc::SlopeScaledDepthBias
Float32 SlopeScaledDepthBias
Scalar that scales the given pixel&#39;s slope before adding to the pixel&#39;s depth.
Definition: RasterizerState.h:112
Diligent::DepthStencilStateDesc::BackFace
StencilOpDesc BackFace
Identify stencil operations for the back-facing triangles, see Diligent::StencilOpDesc.
Definition: DepthStencilState.h:172
Diligent::RasterizerStateDesc
Rasterizer state description.
Definition: RasterizerState.h:90
Diligent::FixedBlockMemoryAllocator
Memory allocator that allocates memory in a fixed-size chunks.
Definition: FixedBlockMemoryAllocator.h:50
Diligent::TEX_FORMAT_BC3_UNORM_SRGB
Four-component unsigned-normalized-integer block-compression sRGB format with 5 bits for R...
Definition: GraphicsTypes.h:624
Diligent::TEX_FORMAT_BC4_SNORM
One-component signed-normalized-integer block-compression format with 8 bits for R channel...
Definition: GraphicsTypes.h:650
Diligent::RenderDeviceBase::GetDeviceCaps
virtual const DeviceCaps & GetDeviceCaps() const override final
Implementation of IRenderDevice::GetDeviceCaps().
Definition: RenderDeviceBase.h:286
Diligent::TextureViewDesc
Texture view description.
Definition: TextureView.h:55
Diligent::TextureViewDesc::ViewType
TEXTURE_VIEW_TYPE ViewType
Describes the texture view type, see Diligent::TEXTURE_VIEW_TYPE for details.
Definition: TextureView.h:58
Diligent::TEX_FORMAT_BC5_SNORM
Two-component signed-normalized-integer block-compression format with 8 bits for R and 8 bits for G c...
Definition: GraphicsTypes.h:676
Diligent::TEX_FORMAT_RGB9E5_SHAREDEXP
Three partial-precision floating pointer numbers sharing single exponent encoded into a 32-bit value...
Definition: GraphicsTypes.h:536
Diligent::TEX_FORMAT_G8R8_G8B8_UNORM
Four-component unsigned-normalized integer format analogous to YUY2 encoding. D3D counterpart: DXGI...
Definition: GraphicsTypes.h:546
Diligent::BlendStateDesc::IndependentBlendEnable
Bool IndependentBlendEnable
Specifies whether to enable independent blending in simultaneous render targets. If set to False...
Definition: BlendState.h:359
Diligent::RenderDeviceBase::CreateDeviceObject
void CreateDeviceObject(const Char *ObjectTypeName, const TObjectDescType &Desc, TObjectType **ppObject, TObjectConstructor ConstructObject)
Helper template function to facilitate device object creation.
Definition: RenderDeviceBase.h:413
Diligent::DepthStencilStateDesc::StencilEnable
Bool StencilEnable
Enable stencil opertaions.
Definition: DepthStencilState.h:160
Diligent::ResourceMappingEntry::Name
const Char * Name
Object name.
Definition: ResourceMapping.h:41
Diligent::DepthStencilStateDesc
Depth stencil state description.
Definition: DepthStencilState.h:145
Diligent::TEX_FORMAT_R8_SNORM
Single-component 8-bit signed-normalized-integer format. D3D counterpart: DXGI_FORMAT_R8_SNORM. OpenGL counterpart: GL_R8_SNORM.
Definition: GraphicsTypes.h:518
Diligent::TextureFormatInfoExt
Extended texture format description.
Definition: GraphicsTypes.h:1115
Diligent::BlendStateDesc::MaxRenderTargets
static constexpr int MaxRenderTargets
Constant member defining the maximum number of render targets.
Definition: BlendState.h:362
Diligent::TEX_FORMAT_RGBA8_UNORM_SRGB
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
Diligent::RasterizerStateDesc::DepthBiasClamp
Float32 DepthBiasClamp
Maximum depth bias of a pixel.
Definition: RasterizerState.h:109
Diligent::RenderDeviceBase::m_SRBAllocator
FixedBlockMemoryAllocator m_SRBAllocator
Allocator for shader resource binding objects.
Definition: RenderDeviceBase.h:379
Diligent::TEX_FORMAT_NUM_FORMATS
Helper member containing the total number of texture formats in the enumeration.
Definition: GraphicsTypes.h:772
Diligent::TextureViewDesc::NumMipLevels
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
Diligent::SamplerDesc::MipFilter
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
Diligent::RenderDeviceBase::RenderDeviceBase
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
Diligent::RefCntAutoPtr
Template class that implements reference counting.
Definition: RefCntAutoPtr.h:71
Diligent::SamplerDesc::BorderColor
Float32 BorderColor[4]
Border color to use if TEXTURE_ADDRESS_BORDER is specified for AddressU, AddressV, or AddressW.
Definition: Sampler.h:87
Diligent::SamplerDesc::MaxAnisotropy
Uint32 MaxAnisotropy
Maximum anisotropy level for the anisotropic filter.
Definition: Sampler.h:80
Diligent::SamplerDesc::MinFilter
FILTER_TYPE MinFilter
Texture minification filter, see Diligent::FILTER_TYPE for details.
Definition: Sampler.h:55
Diligent::TEX_FORMAT_RGBA32_FLOAT
Four-component 128-bit floating-point format with 32-bit channels. D3D counterpart: DXGI_FORMAT_R32...
Definition: GraphicsTypes.h:255
Diligent::RenderDeviceBase::m_SamplerObjAllocator
FixedBlockMemoryAllocator m_SamplerObjAllocator
Allocator for sampler objects.
Definition: RenderDeviceBase.h:377
Diligent::TEX_FORMAT_RG8_SNORM
Two-component 16-bit signed-normalized-integer format with 8-bit channels. D3D counterpart: DXGI_FO...
Definition: GraphicsTypes.h:466
Diligent::ResourceMappingImpl
Implementation of the resource mapping.
Definition: ResourceMappingImpl.h:93
Diligent::TEX_FORMAT_BC2_UNORM_SRGB
Four-component signed-normalized-integer block-compression sRGB format with 5 bits for R...
Definition: GraphicsTypes.h:598
Diligent::TextureViewDesc::NumArraySlices
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
Diligent::SamplerDesc::MagFilter
FILTER_TYPE MagFilter
Texture magnification filter, see Diligent::FILTER_TYPE for details.
Definition: Sampler.h:58
Diligent::TextureViewDesc::Format
TEXTURE_FORMAT Format
View format. If default value Diligent::TEX_FORMAT_UNKNOWN is provided, the view format will match th...
Definition: TextureView.h:69
Diligent::TEX_FORMAT_RG16_UNORM
Two-component 32-bit unsigned-normalized-integer format with 16-bit channels. D3D counterpart: DXGI...
Definition: GraphicsTypes.h:399
Diligent::TEX_FORMAT_R32_FLOAT_X8X24_TYPELESS
Two-component 64-bit format with 32-bit floating-point R channel and 8+24-bits of typeless data...
Definition: GraphicsTypes.h:340
Diligent::TextureViewDesc::AccessFlags
Uint32 AccessFlags
For an unordered access view, allowed access flags. See Diligent::UAV_ACCESS_FLAG for details...
Definition: TextureView.h:103
Diligent::TEX_FORMAT_RGBA16_FLOAT
Four-component 64-bit half-precision floating-point format with 16-bit channels. D3D counterpart: D...
Definition: GraphicsTypes.h:291
Diligent::DepthStencilStateDesc::DepthFunc
COMPARISON_FUNCTION DepthFunc
A function that compares depth data against existing depth data. See Diligent::COMPARISON_FUNCTION fo...
Definition: DepthStencilState.h:157
Diligent::BlendStateDesc::RenderTargets
RenderTargetBlendDesc RenderTargets[MaxRenderTargets]
An array of RenderTargetBlendDesc structures that describe the blend states for render targets...
Definition: BlendState.h:366
Diligent::RenderDeviceBase::m_ShaderObjAllocator
FixedBlockMemoryAllocator m_ShaderObjAllocator
Allocator for shader objects.
Definition: RenderDeviceBase.h:376
Diligent::RasterizerStateDesc::AntialiasedLineEnable
Bool AntialiasedLineEnable
Specifies whether to enable line antialiasing.
Definition: RasterizerState.h:123
Diligent::RenderDeviceBase::GetTextureFormatInfoExt
virtual const TextureFormatInfoExt & GetTextureFormatInfoExt(TEXTURE_FORMAT TexFormat) override final
Implementation of IRenderDevice::GetTextureFormatInfoExt().
Definition: RenderDeviceBase.h:301
Diligent::TEX_FORMAT_R16_SNORM
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
Diligent::TextureFormatInfo
Basic texture format description.
Definition: GraphicsTypes.h:1101
Diligent::TextureViewDesc::FirstArraySlice
Uint32 FirstArraySlice
For a texture array, first array slice to address in the view.
Definition: TextureView.h:84