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;
0 commit comments