Skip to content

Commit 4883f60

Browse files
Updated render state cache initialization
1 parent 281f778 commit 4883f60

File tree

2 files changed

+21
-27
lines changed

2 files changed

+21
-27
lines changed

HLSL2GLSLConverter/src/HLSL2GLSLConverterApp.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,9 +30,7 @@
3030
#include "Errors.hpp"
3131
#include "HLSL2GLSLConverter.h"
3232
#include "RefCntAutoPtr.hpp"
33-
#include "Errors.hpp"
3433
#include "EngineFactoryOpenGL.h"
35-
#include "RefCntAutoPtr.hpp"
3634
#include "DataBlobImpl.hpp"
3735
#include "FileWrapper.hpp"
3836
#include "args.hxx"
@@ -42,16 +40,11 @@ namespace Diligent
4240

4341
HLSL2GLSLConverterApp::HLSL2GLSLConverterApp()
4442
{
45-
#if EXPLICITLY_LOAD_ENGINE_GL_DLL
46-
// Declare function pointer
47-
auto GetEngineFactoryOpenGL = LoadGraphicsEngineOpenGL();
48-
if (GetEngineFactoryOpenGL == nullptr)
43+
m_pFactoryGL = LoadAndGetEngineFactoryOpenGL();
44+
if (m_pFactoryGL == nullptr)
4945
{
5046
LOG_ERROR_MESSAGE("Failed to load OpenGL engine implementation");
51-
return -1;
5247
}
53-
#endif
54-
m_pFactoryGL = GetEngineFactoryOpenGL();
5548
}
5649

5750
int HLSL2GLSLConverterApp::ParseCmdLine(int argc, char** argv)

Tests/DiligentToolsGPUTest/src/RenderStateNotationLoaderTest.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -83,12 +83,12 @@ GraphicsPipelineDesc GetGraphicsPipelineRefDesc()
8383

8484
TEST(Tools_RenderStateNotationLoader, BasicTest)
8585
{
86-
auto* pEnvironment = GPUTestingEnvironment::GetInstance();
86+
GPUTestingEnvironment* pEnvironment = GPUTestingEnvironment::GetInstance();
8787
ASSERT_NE(pEnvironment, nullptr);
8888

89-
auto* pDevice = pEnvironment->GetDevice();
90-
auto pParser = CreateParser("PSO.json");
91-
auto pStreamFactory = CreateShaderFactory();
89+
IRenderDevice* pDevice = pEnvironment->GetDevice();
90+
auto pParser = CreateParser("PSO.json");
91+
auto pStreamFactory = CreateShaderFactory();
9292

9393
RenderStateNotationLoaderCreateInfo LoaderCI{};
9494
LoaderCI.pDevice = pDevice;
@@ -113,19 +113,19 @@ TEST(Tools_RenderStateNotationLoader, BasicTest)
113113
PipelineStateDescReference.PipelineType = PIPELINE_TYPE_GRAPHICS;
114114
EXPECT_EQ(PipelineStateDescReference, pPSO->GetDesc());
115115

116-
const auto GraphicsDescReference = GetGraphicsPipelineRefDesc();
116+
const GraphicsPipelineDesc GraphicsDescReference = GetGraphicsPipelineRefDesc();
117117
EXPECT_EQ(GraphicsDescReference, pPSO->GetGraphicsPipelineDesc());
118118
}
119119

120120

121121
TEST(Tools_RenderStateNotationLoader, ResourceSignature)
122122
{
123-
auto* pEnvironment = GPUTestingEnvironment::GetInstance();
123+
GPUTestingEnvironment* pEnvironment = GPUTestingEnvironment::GetInstance();
124124
ASSERT_NE(pEnvironment, nullptr);
125125

126-
auto* pDevice = pEnvironment->GetDevice();
127-
auto pParser = CreateParser("PSO_Sign.json");
128-
auto pStreamFactory = CreateShaderFactory();
126+
IRenderDevice* pDevice = pEnvironment->GetDevice();
127+
auto pParser = CreateParser("PSO_Sign.json");
128+
auto pStreamFactory = CreateShaderFactory();
129129

130130
RenderStateNotationLoaderCreateInfo LoaderCI;
131131
LoaderCI.pDevice = pDevice;
@@ -157,7 +157,7 @@ TEST(Tools_RenderStateNotationLoader, ResourceSignature)
157157
RefCntAutoPtr<IShader> pPS;
158158
pLoader->LoadShader(ShaderLI, &pPS);
159159
ASSERT_NE(pPS, nullptr);
160-
const auto& Desc = pPS->GetDesc();
160+
const ShaderDesc& Desc = pPS->GetDesc();
161161
EXPECT_STREQ(Desc.Name, ShaderLI.Name);
162162
EXPECT_EQ(Desc.ShaderType, SHADER_TYPE_PIXEL);
163163
}
@@ -218,7 +218,7 @@ TEST(Tools_RenderStateNotationLoader, ResourceSignature)
218218

219219
TEST(Tools_RenderStateNotationLoader, Reload)
220220
{
221-
auto* pEnvironment = GPUTestingEnvironment::GetInstance();
221+
GPUTestingEnvironment* pEnvironment = GPUTestingEnvironment::GetInstance();
222222
ASSERT_NE(pEnvironment, nullptr);
223223

224224
auto* pDevice = pEnvironment->GetDevice();
@@ -239,10 +239,11 @@ TEST(Tools_RenderStateNotationLoader, Reload)
239239
pParser->ParseFile("PSO.json", pStatesFactory, pStateReloadFactory);
240240

241241
RenderStateCacheCreateInfo CacheCI;
242-
CacheCI.pDevice = pDevice;
243-
CacheCI.LogLevel = RENDER_STATE_CACHE_LOG_LEVEL_VERBOSE;
244-
CacheCI.EnableHotReload = true;
245-
CacheCI.pReloadSource = pShaderReloadFactory;
242+
CacheCI.pDevice = pDevice;
243+
CacheCI.pArchiverFactory = pEnvironment->GetArchiverFactory();
244+
CacheCI.LogLevel = RENDER_STATE_CACHE_LOG_LEVEL_VERBOSE;
245+
CacheCI.EnableHotReload = true;
246+
CacheCI.pReloadSource = pShaderReloadFactory;
246247
RefCntAutoPtr<IRenderStateCache> pStateCache;
247248
CreateRenderStateCache(CacheCI, &pStateCache);
248249
ASSERT_TRUE(pStateCache);
@@ -272,7 +273,7 @@ TEST(Tools_RenderStateNotationLoader, Reload)
272273
PipelineStateDescReference.PipelineType = PIPELINE_TYPE_GRAPHICS;
273274
EXPECT_EQ(PipelineStateDescReference, pPSO->GetDesc());
274275

275-
const auto GraphicsDescReference = GetGraphicsPipelineRefDesc();
276+
const GraphicsPipelineDesc GraphicsDescReference = GetGraphicsPipelineRefDesc();
276277
EXPECT_EQ(GraphicsDescReference, pPSO->GetGraphicsPipelineDesc());
277278
}
278279

0 commit comments

Comments
 (0)