forked from DiligentGraphics/DiligentTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderStateNotationLoaderImpl.cpp
More file actions
482 lines (402 loc) · 22.3 KB
/
RenderStateNotationLoaderImpl.cpp
File metadata and controls
482 lines (402 loc) · 22.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
/*
* Copyright 2019-2025 Diligent Graphics LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* In no event and under no legal theory, whether in tort (including negligence),
* contract, or otherwise, unless required by applicable law (such as deliberate
* and grossly negligent acts) or agreed to in writing, shall any Contributor be
* liable for any damages, including any direct, indirect, special, incidental,
* or consequential damages of any character arising as a result of this License or
* out of the use or inability to use the software (including but not limited to damages
* for loss of goodwill, work stoppage, computer failure or malfunction, or any and
* all other commercial damages or losses), even if such Contributor has been advised
* of the possibility of such damages.
*/
#include "RenderStateNotationLoaderImpl.hpp"
#include "DefaultRawMemoryAllocator.hpp"
#include "CallbackWrapper.hpp"
#include "DynamicLinearAllocator.hpp"
namespace Diligent
{
RenderStateNotationLoaderImpl::RenderStateNotationLoaderImpl(IReferenceCounters* pRefCounters, const RenderStateNotationLoaderCreateInfo& CreateInfo) :
TBase{pRefCounters},
m_DeviceWithCache{CreateInfo.pDevice, CreateInfo.pStateCache},
m_pParser{CreateInfo.pParser},
m_pStreamFactory{CreateInfo.pStreamFactory}
{
VERIFY_EXPR(CreateInfo.pDevice != nullptr && CreateInfo.pParser != nullptr);
}
void RenderStateNotationLoaderImpl::LoadPipelineState(const LoadPipelineStateInfo& LoadInfo, IPipelineState** ppPSO)
{
DEV_CHECK_ERR(LoadInfo.Name != nullptr, "LoadInfo.Name must not be null");
DEV_CHECK_ERR(ppPSO != nullptr, "ppPSO must not be null");
DEV_CHECK_ERR(*ppPSO == nullptr, "*ppPSO is not null. Make sure you are not overwriting reference to an existing object as this may result in memory leaks.");
try
{
RefCntAutoPtr<IPipelineState> pPipeline;
if (LoadInfo.LookupInCache)
{
auto FindPipeline = [this](const Char* Name, PIPELINE_TYPE PipelineType) -> RefCntAutoPtr<IPipelineState> //
{
const auto Iter = m_PipelineStateCache.find(std::make_pair(HashMapStringKey{Name, true}, PipelineType));
if (Iter != m_PipelineStateCache.end())
return Iter->second;
return {};
};
if (LoadInfo.PipelineType != PIPELINE_TYPE_INVALID)
{
pPipeline = FindPipeline(LoadInfo.Name, LoadInfo.PipelineType);
}
else
{
PIPELINE_TYPE PipelineTypes[] = {
PIPELINE_TYPE_GRAPHICS,
PIPELINE_TYPE_MESH,
PIPELINE_TYPE_COMPUTE,
PIPELINE_TYPE_RAY_TRACING,
PIPELINE_TYPE_TILE};
for (Uint32 i = 0; i < _countof(PipelineTypes) && pPipeline == nullptr; i++)
pPipeline = FindPipeline(LoadInfo.Name, PipelineTypes[i]);
}
}
if (pPipeline == nullptr)
{
DynamicLinearAllocator Allocator{DefaultRawMemoryAllocator::GetAllocator()};
std::vector<RefCntAutoPtr<IShader>> PipelineShaders;
std::vector<RefCntAutoPtr<IPipelineResourceSignature>> PipelineSignatures;
RefCntAutoPtr<IRenderPass> pRenderPass;
auto FindShader = [&](const char* Name, SHADER_TYPE ShaderType) -> IShader* //
{
if (Name == nullptr)
return nullptr;
bool AddToCache = LoadInfo.AddToCache;
auto Callback = MakeCallback([&](ShaderCreateInfo& ShaderCI) {
if (LoadInfo.ModifyShader != nullptr)
LoadInfo.ModifyShader(ShaderCI, ShaderType, AddToCache, LoadInfo.pModifyShaderData);
});
RefCntAutoPtr<IShader> pShader;
LoadShader({Name, false, LoadInfo.LookupInCache, Callback, Callback}, &pShader);
if (!pShader)
LOG_ERROR_AND_THROW("Failed to load shader '", Name, "' for pipeline '", LoadInfo.Name, "'.");
if (AddToCache)
m_ShaderCache[HashMapStringKey{pShader->GetDesc().Name, false}] = pShader;
else
PipelineShaders.push_back(pShader);
return pShader;
};
auto FindRenderPass = [&](const char* Name) -> IRenderPass* //
{
if (Name == nullptr)
return nullptr;
bool AddToCache = LoadInfo.AddToCache;
auto Callback = MakeCallback([&](RenderPassDesc& RenderPassCI) {
if (LoadInfo.ModifyRenderPass != nullptr)
LoadInfo.ModifyRenderPass(RenderPassCI, AddToCache, LoadInfo.pModifyRenderPassData);
});
VERIFY_EXPR(!pRenderPass);
LoadRenderPass({Name, false, LoadInfo.LookupInCache, Callback, Callback}, &pRenderPass);
if (!pRenderPass)
LOG_ERROR_AND_THROW("Failed to load render pass '", Name, "' for pipeline '", LoadInfo.Name, "'.");
if (AddToCache)
m_RenderPassCache.emplace(HashMapStringKey{pRenderPass->GetDesc().Name, false}, pRenderPass);
return pRenderPass;
};
auto FindResourceSignature = [&](const char* Name) -> IPipelineResourceSignature* //
{
if (Name == nullptr)
return nullptr;
bool AddToCache = LoadInfo.AddToCache;
auto Callback = MakeCallback([&](PipelineResourceSignatureDesc& ResourceSignatureCI) {
if (LoadInfo.ModifyResourceSignature != nullptr)
LoadInfo.ModifyResourceSignature(ResourceSignatureCI, AddToCache, LoadInfo.pModifyResourceSignatureData);
});
RefCntAutoPtr<IPipelineResourceSignature> pResourceSignature;
LoadResourceSignature({Name, false, LoadInfo.LookupInCache, Callback, Callback}, &pResourceSignature);
if (!pResourceSignature)
LOG_ERROR_AND_THROW("Failed to load resource signature '", Name, "' for pipeline '", LoadInfo.Name, "'.");
if (AddToCache)
m_ResourceSignatureCache.emplace(HashMapStringKey{pResourceSignature->GetDesc().Name, false}, pResourceSignature);
else
PipelineSignatures.push_back(pResourceSignature);
return pResourceSignature;
};
auto UnpackPipelineStateCreateInfo = [&](PipelineStateNotation const& DescRSN, PipelineStateCreateInfo& PipelineCI) //
{
PipelineCI.PSODesc = DescRSN.PSODesc;
PipelineCI.Flags = DescRSN.Flags;
PipelineCI.ResourceSignaturesCount = DescRSN.ResourceSignaturesNameCount;
PipelineCI.ppResourceSignatures = Allocator.ConstructArray<IPipelineResourceSignature*>(DescRSN.ResourceSignaturesNameCount);
for (Uint32 SignatureID = 0; SignatureID < PipelineCI.ResourceSignaturesCount; ++SignatureID)
PipelineCI.ppResourceSignatures[SignatureID] = FindResourceSignature(DescRSN.ppResourceSignatureNames[SignatureID]);
};
const PipelineStateNotation* pDescRSN = m_pParser->GetPipelineStateByName(LoadInfo.Name, LoadInfo.PipelineType);
if (!pDescRSN)
LOG_ERROR_AND_THROW("Failed to find pipeline '", LoadInfo.Name, "'.");
static_assert(PIPELINE_TYPE_LAST == 4, "Please handle the new pipeline type below.");
const PIPELINE_TYPE PipelineType = pDescRSN->PSODesc.PipelineType;
switch (PipelineType)
{
case PIPELINE_TYPE_GRAPHICS:
case PIPELINE_TYPE_MESH:
{
const GraphicsPipelineNotation* pPipelineDescRSN = static_cast<const GraphicsPipelineNotation*>(pDescRSN);
GraphicsPipelineStateCreateInfo PipelineCI{};
UnpackPipelineStateCreateInfo(*pPipelineDescRSN, PipelineCI);
PipelineCI.GraphicsPipeline = static_cast<const GraphicsPipelineDesc&>(pPipelineDescRSN->Desc);
PipelineCI.GraphicsPipeline.pRenderPass = FindRenderPass(pPipelineDescRSN->pRenderPassName);
PipelineCI.pVS = FindShader(pPipelineDescRSN->pVSName, SHADER_TYPE_VERTEX);
PipelineCI.pPS = FindShader(pPipelineDescRSN->pPSName, SHADER_TYPE_PIXEL);
PipelineCI.pDS = FindShader(pPipelineDescRSN->pDSName, SHADER_TYPE_DOMAIN);
PipelineCI.pHS = FindShader(pPipelineDescRSN->pHSName, SHADER_TYPE_HULL);
PipelineCI.pGS = FindShader(pPipelineDescRSN->pGSName, SHADER_TYPE_GEOMETRY);
PipelineCI.pAS = FindShader(pPipelineDescRSN->pASName, SHADER_TYPE_AMPLIFICATION);
PipelineCI.pMS = FindShader(pPipelineDescRSN->pMSName, SHADER_TYPE_MESH);
if (LoadInfo.ModifyPipeline != nullptr)
LoadInfo.ModifyPipeline(PipelineCI, LoadInfo.pModifyPipelineData);
pPipeline = m_DeviceWithCache.CreateGraphicsPipelineState(PipelineCI);
break;
}
case PIPELINE_TYPE_COMPUTE:
{
const ComputePipelineNotation* pPipelineDescRSN = static_cast<const ComputePipelineNotation*>(pDescRSN);
ComputePipelineStateCreateInfo PipelineCI{};
UnpackPipelineStateCreateInfo(*pPipelineDescRSN, PipelineCI);
PipelineCI.pCS = FindShader(pPipelineDescRSN->pCSName, SHADER_TYPE_COMPUTE);
if (LoadInfo.ModifyPipeline != nullptr)
LoadInfo.ModifyPipeline(PipelineCI, LoadInfo.pModifyPipelineData);
pPipeline = m_DeviceWithCache.CreateComputePipelineState(PipelineCI);
break;
}
case PIPELINE_TYPE_TILE:
{
const TilePipelineNotation* pPipelineDescRSN = static_cast<const TilePipelineNotation*>(pDescRSN);
TilePipelineStateCreateInfo PipelineCI{};
UnpackPipelineStateCreateInfo(*pPipelineDescRSN, PipelineCI);
PipelineCI.pTS = FindShader(pPipelineDescRSN->pTSName, SHADER_TYPE_TILE);
if (LoadInfo.ModifyPipeline != nullptr)
LoadInfo.ModifyPipeline(PipelineCI, LoadInfo.pModifyPipelineData);
pPipeline = m_DeviceWithCache.CreateTilePipelineState(PipelineCI);
break;
}
case PIPELINE_TYPE_RAY_TRACING:
{
const RayTracingPipelineNotation* pPipelineDescRSN = static_cast<const RayTracingPipelineNotation*>(pDescRSN);
RayTracingPipelineStateCreateInfo PipelineCI = {};
UnpackPipelineStateCreateInfo(*pPipelineDescRSN, PipelineCI);
PipelineCI.RayTracingPipeline = pPipelineDescRSN->RayTracingPipeline;
PipelineCI.pShaderRecordName = pPipelineDescRSN->pShaderRecordName;
PipelineCI.MaxAttributeSize = pPipelineDescRSN->MaxAttributeSize;
PipelineCI.MaxPayloadSize = pPipelineDescRSN->MaxPayloadSize;
{
RayTracingGeneralShaderGroup* pData = Allocator.ConstructArray<RayTracingGeneralShaderGroup>(pPipelineDescRSN->GeneralShaderCount);
for (Uint32 ShaderID = 0; ShaderID < pPipelineDescRSN->GeneralShaderCount; ShaderID++)
{
pData[ShaderID].Name = pPipelineDescRSN->pGeneralShaders[ShaderID].Name;
pData[ShaderID].pShader = FindShader(pPipelineDescRSN->pGeneralShaders[ShaderID].pShaderName, SHADER_TYPE_RAY_GEN);
}
PipelineCI.pGeneralShaders = pData;
PipelineCI.GeneralShaderCount = pPipelineDescRSN->GeneralShaderCount;
}
{
RayTracingTriangleHitShaderGroup* pData = Allocator.ConstructArray<RayTracingTriangleHitShaderGroup>(pPipelineDescRSN->TriangleHitShaderCount);
for (Uint32 ShaderID = 0; ShaderID < pPipelineDescRSN->TriangleHitShaderCount; ++ShaderID)
{
pData[ShaderID].Name = pPipelineDescRSN->pTriangleHitShaders[ShaderID].Name;
pData[ShaderID].pAnyHitShader = FindShader(pPipelineDescRSN->pTriangleHitShaders[ShaderID].pAnyHitShaderName, SHADER_TYPE_RAY_ANY_HIT);
pData[ShaderID].pClosestHitShader = FindShader(pPipelineDescRSN->pTriangleHitShaders[ShaderID].pClosestHitShaderName, SHADER_TYPE_RAY_CLOSEST_HIT);
}
PipelineCI.pTriangleHitShaders = pData;
PipelineCI.TriangleHitShaderCount = pPipelineDescRSN->TriangleHitShaderCount;
}
{
RayTracingProceduralHitShaderGroup* pData = Allocator.ConstructArray<RayTracingProceduralHitShaderGroup>(pPipelineDescRSN->ProceduralHitShaderCount);
for (Uint32 ShaderID = 0; ShaderID < pPipelineDescRSN->ProceduralHitShaderCount; ++ShaderID)
{
pData[ShaderID].Name = pPipelineDescRSN->pProceduralHitShaders[ShaderID].Name;
pData[ShaderID].pAnyHitShader = FindShader(pPipelineDescRSN->pProceduralHitShaders[ShaderID].pAnyHitShaderName, SHADER_TYPE_RAY_ANY_HIT);
pData[ShaderID].pIntersectionShader = FindShader(pPipelineDescRSN->pProceduralHitShaders[ShaderID].pIntersectionShaderName, SHADER_TYPE_RAY_INTERSECTION);
pData[ShaderID].pClosestHitShader = FindShader(pPipelineDescRSN->pProceduralHitShaders[ShaderID].pClosestHitShaderName, SHADER_TYPE_RAY_CLOSEST_HIT);
}
PipelineCI.pProceduralHitShaders = pData;
PipelineCI.ProceduralHitShaderCount = pPipelineDescRSN->ProceduralHitShaderCount;
}
if (LoadInfo.ModifyPipeline != nullptr)
LoadInfo.ModifyPipeline(PipelineCI, LoadInfo.pModifyPipelineData);
pPipeline = m_DeviceWithCache.CreateRayTracingPipelineState(PipelineCI);
break;
}
default:
UNEXPECTED("Unexpected pipeline type");
break;
}
if (LoadInfo.AddToCache)
m_PipelineStateCache[std::make_pair(HashMapStringKey{LoadInfo.Name, false}, LoadInfo.PipelineType)] = pPipeline;
}
*ppPSO = pPipeline.Detach();
}
catch (...)
{
LOG_ERROR_MESSAGE("Failed to load pipeline state '", LoadInfo.Name, "'.");
}
}
void RenderStateNotationLoaderImpl::LoadResourceSignature(const LoadResourceSignatureInfo& LoadInfo, IPipelineResourceSignature** ppSignature)
{
DEV_CHECK_ERR(LoadInfo.Name != nullptr, "LoadInfo.Name must not be null");
DEV_CHECK_ERR(ppSignature != nullptr, "ppSignature must not be null");
DEV_CHECK_ERR(*ppSignature == nullptr, "*ppSignature is not null. Make sure you are not overwriting reference to an existing object as this may result in memory leaks.");
try
{
auto Iter = LoadInfo.LookupInCache ?
m_ResourceSignatureCache.find(LoadInfo.Name) :
m_ResourceSignatureCache.end();
if (Iter != m_ResourceSignatureCache.end())
{
*ppSignature = Iter->second;
(*ppSignature)->AddRef();
}
else
{
const PipelineResourceSignatureDesc* pRSNDesc = m_pParser->GetResourceSignatureByName(LoadInfo.Name);
if (!pRSNDesc)
LOG_ERROR_AND_THROW("Failed to find resource signature '", LoadInfo.Name, "'.");
PipelineResourceSignatureDesc RSDesc = *pRSNDesc;
if (LoadInfo.Modify != nullptr)
LoadInfo.Modify(RSDesc, LoadInfo.pUserData);
RefCntAutoPtr<IPipelineResourceSignature> pSignature = m_DeviceWithCache.CreatePipelineResourceSignature(RSDesc);
if (LoadInfo.AddToCache)
m_ResourceSignatureCache[HashMapStringKey{RSDesc.Name, false}] = pSignature;
*ppSignature = pSignature.Detach();
}
}
catch (...)
{
LOG_ERROR_MESSAGE("Failed to load resource signature '", LoadInfo.Name, "'.");
}
}
void RenderStateNotationLoaderImpl::LoadRenderPass(const LoadRenderPassInfo& LoadInfo, IRenderPass** ppRenderPass)
{
DEV_CHECK_ERR(LoadInfo.Name != nullptr, "LoadInfo.Name must not be null");
DEV_CHECK_ERR(ppRenderPass != nullptr, "ppRenderPass must not be null");
DEV_CHECK_ERR(*ppRenderPass == nullptr, "*ppRenderPass is not null. Make sure you are not overwriting reference to an existing object as this may result in memory leaks.");
try
{
auto Iter = LoadInfo.LookupInCache ?
m_RenderPassCache.find(LoadInfo.Name) :
m_RenderPassCache.end();
if (Iter != m_RenderPassCache.end())
{
*ppRenderPass = Iter->second;
(*ppRenderPass)->AddRef();
}
else
{
const RenderPassDesc* pRSNDesc = m_pParser->GetRenderPassByName(LoadInfo.Name);
if (!pRSNDesc)
LOG_ERROR_AND_THROW("Failed to find render pass '", LoadInfo.Name, "'.");
RenderPassDesc RPDesc = *pRSNDesc;
if (LoadInfo.Modify != nullptr)
LoadInfo.Modify(RPDesc, LoadInfo.pUserData);
RefCntAutoPtr<IRenderPass> pRenderPass = m_DeviceWithCache.CreateRenderPass(RPDesc);
if (LoadInfo.AddToCache)
m_RenderPassCache[HashMapStringKey{RPDesc.Name, false}] = pRenderPass;
*ppRenderPass = pRenderPass.Detach();
}
}
catch (...)
{
LOG_ERROR_MESSAGE("Failed to load render pass '", LoadInfo.Name, "'.");
}
}
void RenderStateNotationLoaderImpl::LoadShader(const LoadShaderInfo& LoadInfo, IShader** ppShader)
{
DEV_CHECK_ERR(LoadInfo.Name != nullptr, "LoadInfo.Name must not be null");
DEV_CHECK_ERR(ppShader != nullptr, "ppShader must not be null");
DEV_CHECK_ERR(*ppShader == nullptr, "*ppShader is not null. Make sure you are not overwriting reference to an existing object as this may result in memory leaks.");
try
{
auto Iter = LoadInfo.LookupInCache ?
m_ShaderCache.find(LoadInfo.Name) :
m_ShaderCache.end();
if (Iter != m_ShaderCache.end())
{
*ppShader = Iter->second;
(*ppShader)->AddRef();
}
else
{
const ShaderCreateInfo* pRSNDesc = m_pParser->GetShaderByName(LoadInfo.Name);
if (!pRSNDesc)
LOG_ERROR_AND_THROW("Failed to find shader '", LoadInfo.Name, "'.");
ShaderCreateInfo ShaderCI = *pRSNDesc;
ShaderCI.pShaderSourceStreamFactory = m_pStreamFactory;
if (LoadInfo.Modify != nullptr)
LoadInfo.Modify(ShaderCI, LoadInfo.pUserData);
RefCntAutoPtr<IShader> pShader = m_DeviceWithCache.CreateShader(ShaderCI);
if (LoadInfo.AddToCache)
m_ShaderCache[HashMapStringKey{ShaderCI.Desc.Name, false}] = pShader;
*ppShader = pShader.Detach();
}
}
catch (...)
{
LOG_ERROR_MESSAGE("Failed to load shader '", LoadInfo.Name, "'.");
}
}
bool RenderStateNotationLoaderImpl::Reload()
{
if (!m_pParser->Reload())
return false;
if (IRenderStateCache* pCache = m_DeviceWithCache.GetCache())
{
auto Callback = MakeCallback(
[this](const char* PipelineName, GraphicsPipelineDesc& GraphicsDesc) {
const PipelineStateNotation* pPsoNotation = m_pParser->GetPipelineStateByName(PipelineName);
if (pPsoNotation == nullptr)
{
LOG_WARNING_MESSAGE("Unable to find pipeline state '", PipelineName, "' after reloading states.");
return;
}
VERIFY_EXPR(pPsoNotation->PSODesc.PipelineType == PIPELINE_TYPE_GRAPHICS || pPsoNotation->PSODesc.PipelineType == PIPELINE_TYPE_MESH);
const GraphicsPipelineNotation* pGraphicsNotation = static_cast<const GraphicsPipelineNotation*>(pPsoNotation);
GraphicsDesc = pGraphicsNotation->Desc;
});
pCache->Reload(Callback, Callback);
}
return true;
}
void CreateRenderStateNotationLoader(const RenderStateNotationLoaderCreateInfo& CreateInfo,
IRenderStateNotationLoader** ppLoader)
{
DEV_CHECK_ERR(ppLoader != nullptr, "ppLoader must not be null");
DEV_CHECK_ERR(*ppLoader == nullptr, "*ppLoader is not null. Make sure you are not overwriting reference to an existing object as this may result in memory leaks.");
try
{
RefCntAutoPtr<IRenderStateNotationLoader> pLoader{MakeNewRCObj<RenderStateNotationLoaderImpl>()(CreateInfo)};
if (pLoader)
pLoader->QueryInterface(IID_RenderStateNotationLoader, ppLoader);
}
catch (...)
{
LOG_ERROR("Failed to create render state notation loader");
}
}
} // namespace Diligent
extern "C"
{
void Diligent_CreateRenderStateNotationLoader(const Diligent::RenderStateNotationLoaderCreateInfo& CreateInfo,
Diligent::IRenderStateNotationLoader** ppLoader)
{
Diligent::CreateRenderStateNotationLoader(CreateInfo, ppLoader);
}
}