Skip to content

Commit 3dd1c9f

Browse files
Fixed D3D12 warnings in unit tests (fix #669)
1 parent 258a2ea commit 3dd1c9f

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@
260260
// [V] modf( {float, float2, float3, float4} )
261261
// (-) modf( {int, int2, int3, int4, matrix types} )
262262
// [V] mul - defined as a*b
263-
// [V] noise( {float, float2, float3, float4} )
264263
// [V] normalize( {float, float2, float3, float4} )
265264
// [V] pow( {float, float2, float3, float4} )
266265
// (-) pow( {matrix types} )

Tests/DiligentCoreAPITest/src/ArchiveTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,6 +2697,8 @@ TEST(ArchiveTest, MergeArchives)
26972697
GraphicsPipeline.InputLayout.LayoutElements = Elems;
26982698
GraphicsPipeline.InputLayout.NumElements = _countof(Elems);
26992699

2700+
GraphicsPipeline.DepthStencilDesc.DepthEnable = False;
2701+
27002702
PipelineStateArchiveInfo ArchiveInfo;
27012703
ArchiveInfo.DeviceFlags = GetDeviceBits();
27022704

Tests/DiligentCoreAPITest/src/AsyncShaderCompilationTest.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Diligent Graphics LLC
2+
* Copyright 2024-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.
@@ -52,8 +52,8 @@ RefCntAutoPtr<IShader> CreateShader(const char* Path,
5252
std::unique_ptr<ShaderCreateInfo> pShaderCI = std::make_unique<ShaderCreateInfo>();
5353
ShaderCreateInfo& ShaderCI = *pShaderCI;
5454

55-
auto* pEnv = GPUTestingEnvironment::GetInstance();
56-
auto* pDevice = pEnv->GetDevice();
55+
GPUTestingEnvironment* pEnv = GPUTestingEnvironment::GetInstance();
56+
IRenderDevice* pDevice = pEnv->GetDevice();
5757

5858
RefCntAutoPtr<IShaderSourceInputStreamFactory> pShaderSourceFactory;
5959
pDevice->GetEngineFactory()->CreateDefaultShaderSourceStreamFactory("shaders", &pShaderSourceFactory);
@@ -92,7 +92,7 @@ TEST(Shader, AsyncCompilation)
9292
{
9393
GPUTestingEnvironment::ScopedReset EnvironmentAutoReset;
9494

95-
const auto& DeviceInfo = GPUTestingEnvironment::GetInstance()->GetDevice()->GetDeviceInfo();
95+
const RenderDeviceInfo& DeviceInfo = GPUTestingEnvironment::GetInstance()->GetDevice()->GetDeviceInfo();
9696
if (!DeviceInfo.Features.AsyncShaderCompilation)
9797
{
9898
GTEST_SKIP() << "Async shader compilation is not supported by this device";
@@ -101,18 +101,18 @@ TEST(Shader, AsyncCompilation)
101101
std::vector<RefCntAutoPtr<IShader>> Shaders;
102102
for (Uint32 i = 0; i < 10; ++i)
103103
{
104-
auto pShader = CreateShader("AsyncShaderCompilationTest.psh", "Async compilation test", SHADER_TYPE_PIXEL, SHADER_COMPILE_FLAG_ASYNCHRONOUS);
104+
RefCntAutoPtr<IShader> pShader = CreateShader("AsyncShaderCompilationTest.psh", "Async compilation test", SHADER_TYPE_PIXEL, SHADER_COMPILE_FLAG_ASYNCHRONOUS);
105105
ASSERT_NE(pShader, nullptr);
106106
Shaders.emplace_back(std::move(pShader));
107107
}
108108

109109
Timer T;
110-
auto StartTime = T.GetElapsedTime();
110+
double StartTime = T.GetElapsedTime();
111111
Uint32 Iter = 0;
112112
while (true)
113113
{
114114
Uint32 NumShadersReady = 0;
115-
for (auto& pShader : Shaders)
115+
for (RefCntAutoPtr<IShader>& pShader : Shaders)
116116
{
117117
if (pShader->GetStatus() == SHADER_STATUS_READY)
118118
++NumShadersReady;
@@ -130,13 +130,13 @@ TEST(Shader, ReleaseWhileCompiling)
130130
{
131131
GPUTestingEnvironment::ScopedReset EnvironmentAutoReset;
132132

133-
const auto& DeviceInfo = GPUTestingEnvironment::GetInstance()->GetDevice()->GetDeviceInfo();
133+
const RenderDeviceInfo& DeviceInfo = GPUTestingEnvironment::GetInstance()->GetDevice()->GetDeviceInfo();
134134
if (!DeviceInfo.Features.AsyncShaderCompilation)
135135
{
136136
GTEST_SKIP() << "Async shader compilation is not supported by this device";
137137
}
138138

139-
auto pShader = CreateShader("AsyncShaderCompilationTest.psh", "Async pipeline test PS", SHADER_TYPE_PIXEL, SHADER_COMPILE_FLAG_ASYNCHRONOUS);
139+
RefCntAutoPtr<IShader> pShader = CreateShader("AsyncShaderCompilationTest.psh", "Async pipeline test PS", SHADER_TYPE_PIXEL, SHADER_COMPILE_FLAG_ASYNCHRONOUS);
140140
ASSERT_NE(pShader, nullptr);
141141

142142
// Release the shader while it is still compiling
@@ -147,8 +147,8 @@ void TestAsyncPipeline(SHADER_COMPILE_FLAGS ShaderFlags, PSO_CREATE_FLAGS PSOFla
147147
{
148148
GPUTestingEnvironment::ScopedReset EnvironmentAutoReset;
149149

150-
IRenderDevice* pDevice = GPUTestingEnvironment::GetInstance()->GetDevice();
151-
const auto& DeviceInfo = pDevice->GetDeviceInfo();
150+
IRenderDevice* pDevice = GPUTestingEnvironment::GetInstance()->GetDevice();
151+
const RenderDeviceInfo& DeviceInfo = pDevice->GetDeviceInfo();
152152
if (!DeviceInfo.Features.AsyncShaderCompilation)
153153
{
154154
GTEST_SKIP() << "Async shader compilation is not supported by this device";
@@ -158,12 +158,12 @@ void TestAsyncPipeline(SHADER_COMPILE_FLAGS ShaderFlags, PSO_CREATE_FLAGS PSOFla
158158
{
159159
constexpr bool SimplifiedShader = true;
160160

161-
auto pVS = CreateShader("AsyncShaderCompilationTest.vsh", "Async pipeline test VS", SHADER_TYPE_VERTEX, ShaderFlags, SimplifiedShader);
161+
RefCntAutoPtr<IShader> pVS = CreateShader("AsyncShaderCompilationTest.vsh", "Async pipeline test VS", SHADER_TYPE_VERTEX, ShaderFlags, SimplifiedShader);
162162
ASSERT_NE(pVS, nullptr);
163163

164164
for (size_t i = 0; i < 16; ++i)
165165
{
166-
auto pPS = CreateShader("AsyncShaderCompilationTest.psh", "Async pipeline test PS", SHADER_TYPE_PIXEL, ShaderFlags, SimplifiedShader);
166+
RefCntAutoPtr<IShader> pPS = CreateShader("AsyncShaderCompilationTest.psh", "Async pipeline test PS", SHADER_TYPE_PIXEL, ShaderFlags, SimplifiedShader);
167167
ASSERT_NE(pPS, nullptr);
168168

169169
// Allocate pipeline CI on the heap to check that all data is copied correctly
@@ -181,6 +181,7 @@ void TestAsyncPipeline(SHADER_COMPILE_FLAGS ShaderFlags, PSO_CREATE_FLAGS PSOFla
181181
.AddShader(pVS)
182182
.AddShader(pPS)
183183
.AddRenderTarget(TEX_FORMAT_RGBA8_UNORM)
184+
.SetDepthFormat(TEX_FORMAT_D32_FLOAT)
184185
.SetInputLayout(InputLayout)
185186
.SetResourceLayout(ResourceLayout)
186187
.SetFlags(PSOFlags);
@@ -198,12 +199,12 @@ void TestAsyncPipeline(SHADER_COMPILE_FLAGS ShaderFlags, PSO_CREATE_FLAGS PSOFla
198199
}
199200

200201
Timer T;
201-
auto StartTime = T.GetElapsedTime();
202+
double StartTime = T.GetElapsedTime();
202203
Uint32 Iter = 0;
203204
while (true)
204205
{
205206
Uint32 NumPSOsReady = 0;
206-
for (auto& pPSO : pPSOs)
207+
for (RefCntAutoPtr<IPipelineState>& pPSO : pPSOs)
207208
{
208209
if (pPSO->GetStatus() == PIPELINE_STATE_STATUS_READY)
209210
++NumPSOsReady;

Tests/DiligentCoreAPITest/src/RenderStateCacheTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@ void CreateGraphicsPSO(IRenderStateCache* pCache, bool PresentInCache, IShader*
534534
PsoCI.GraphicsPipeline.RTVFormats[0] = ColorBufferFormat;
535535
}
536536

537+
PsoCI.GraphicsPipeline.DepthStencilDesc.DepthEnable = False;
538+
537539
PsoCI.PSODesc.ResourceLayout = GetGraphicsPSOLayout();
538540

539541
if (pCache != nullptr)

Tests/DiligentCoreAPITest/src/ShaderVariableAccessTest.cpp

Lines changed: 3 additions & 1 deletion
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");
@@ -1319,6 +1319,8 @@ float4 main() : SV_Target
13191319
GraphicsPipeline.NumRenderTargets = 1;
13201320
GraphicsPipeline.RTVFormats[0] = TEX_FORMAT_RGBA8_UNORM;
13211321

1322+
GraphicsPipeline.DepthStencilDesc.DepthEnable = False;
1323+
13221324
PSOCreateInfo.pVS = pVS;
13231325
PSOCreateInfo.pPS = pPS;
13241326

0 commit comments

Comments
 (0)