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");
@@ -146,7 +146,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
146146 pFactory->EnumerateAdapters (MinVersion, NumAdapters, Adapters.data ());
147147
148148 // Validate adapter info
149- for (auto & Adapter : Adapters)
149+ for (GraphicsAdapterInfo & Adapter : Adapters)
150150 {
151151 VERIFY_EXPR (Adapter.NumQueues >= 1 );
152152 }
@@ -155,8 +155,8 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
155155 LOG_INFO_MESSAGE (" Found " , Adapters.size (), " compatible " , (Adapters.size () == 1 ? " adapter" : " adapters" ));
156156 for (Uint32 i = 0 ; i < Adapters.size (); ++i)
157157 {
158- const auto & AdapterInfo = Adapters[i];
159- const auto DisplayModes = EnumerateDisplayModes (AdapterInfo, i);
158+ const GraphicsAdapterInfo& AdapterInfo = Adapters[i];
159+ const std::vector<DisplayModeAttribs> DisplayModes = EnumerateDisplayModes (AdapterInfo, i);
160160
161161 const char * AdapterTypeStr = nullptr ;
162162 switch (AdapterInfo.Type )
@@ -185,11 +185,11 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
185185 if (AdapterId >= Adapters.size ())
186186 AdapterId = 0 ;
187187
188- constexpr auto QueueMask = COMMAND_QUEUE_TYPE_PRIMARY_MASK;
189- auto * Queues = Adapters[AdapterId].Queues ;
188+ constexpr COMMAND_QUEUE_TYPE QueueMask = COMMAND_QUEUE_TYPE_PRIMARY_MASK;
189+ CommandQueueInfo* Queues = Adapters[AdapterId].Queues ;
190190 for (Uint32 q = 0 , Count = Adapters[AdapterId].NumQueues ; q < Count; ++q)
191191 {
192- auto & CurQueue = Queues[q];
192+ CommandQueueInfo & CurQueue = Queues[q];
193193 if (CurQueue.MaxDeviceContexts == 0 )
194194 continue ;
195195
@@ -231,14 +231,14 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
231231 {
232232# if ENGINE_DLL
233233 // Load the dll and import GetEngineFactoryD3D11() function
234- auto GetEngineFactoryD3D11 = LoadGraphicsEngineD3D11 ();
234+ GetEngineFactoryD3D11Type GetEngineFactoryD3D11 = LoadGraphicsEngineD3D11 ();
235235 if (GetEngineFactoryD3D11 == nullptr )
236236 {
237237 LOG_ERROR_AND_THROW (" Failed to load the engine" );
238238 }
239239# endif
240240
241- auto * pFactoryD3D11 = GetEngineFactoryD3D11 ();
241+ IEngineFactoryD3D11 * pFactoryD3D11 = GetEngineFactoryD3D11 ();
242242 pFactoryD3D11->SetMessageCallback (EnvCI.MessageCallback );
243243 pFactoryD3D11->SetBreakOnError (false );
244244
@@ -275,13 +275,13 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
275275 {
276276# if ENGINE_DLL
277277 // Load the dll and import GetEngineFactoryD3D12() function
278- auto GetEngineFactoryD3D12 = LoadGraphicsEngineD3D12 ();
278+ GetEngineFactoryD3D12Type GetEngineFactoryD3D12 = LoadGraphicsEngineD3D12 ();
279279 if (GetEngineFactoryD3D12 == nullptr )
280280 {
281281 LOG_ERROR_AND_THROW (" Failed to load the engine" );
282282 }
283283# endif
284- auto * pFactoryD3D12 = GetEngineFactoryD3D12 ();
284+ IEngineFactoryD3D12 * pFactoryD3D12 = GetEngineFactoryD3D12 ();
285285 pFactoryD3D12->SetMessageCallback (EnvCI.MessageCallback );
286286 pFactoryD3D12->SetBreakOnError (false );
287287
@@ -341,21 +341,21 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
341341# if EXPLICITLY_LOAD_ENGINE_GL_DLL
342342 // Declare function pointer
343343 // Load the dll and import GetEngineFactoryOpenGL() function
344- auto GetEngineFactoryOpenGL = LoadGraphicsEngineOpenGL ();
344+ GetEngineFactoryOpenGLType GetEngineFactoryOpenGL = LoadGraphicsEngineOpenGL ();
345345 if (GetEngineFactoryOpenGL == nullptr )
346346 {
347347 LOG_ERROR_AND_THROW (" Failed to load the engine" );
348348 }
349349# endif
350- auto * pFactoryOpenGL = GetEngineFactoryOpenGL ();
350+ IEngineFactoryOpenGL * pFactoryOpenGL = GetEngineFactoryOpenGL ();
351351 pFactoryOpenGL->SetMessageCallback (EnvCI.MessageCallback );
352352 pFactoryOpenGL->SetBreakOnError (false );
353353
354354 EnumerateAdapters (pFactoryOpenGL, Version{},
355355 [](const GraphicsAdapterInfo& AdapterInfo, Uint32 AdapterId) {
356356 return std::vector<DisplayModeAttribs>{};
357357 });
358- auto Window = CreateNativeWindow ();
358+ NativeWindow Window = CreateNativeWindow ();
359359
360360 EngineGLCreateInfo EngineCI;
361361
@@ -378,14 +378,14 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
378378 {
379379# if EXPLICITLY_LOAD_ENGINE_VK_DLL
380380 // Load the dll and import GetEngineFactoryVk() function
381- auto GetEngineFactoryVk = LoadGraphicsEngineVk ();
381+ GetEngineFactoryVkType GetEngineFactoryVk = LoadGraphicsEngineVk ();
382382 if (GetEngineFactoryVk == nullptr )
383383 {
384384 LOG_ERROR_AND_THROW (" Failed to load the engine" );
385385 }
386386# endif
387387
388- auto * pFactoryVk = GetEngineFactoryVk ();
388+ IEngineFactoryVk * pFactoryVk = GetEngineFactoryVk ();
389389 pFactoryVk->SetMessageCallback (EnvCI.MessageCallback );
390390 pFactoryVk->SetBreakOnError (false );
391391
@@ -422,6 +422,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
422422 // EngineCI.DeviceLocalMemoryReserveSize = 32 << 20;
423423 // EngineCI.HostVisibleMemoryReserveSize = 48 << 20;
424424 EngineCI.Features = EnvCI.Features ;
425+ EngineCI.FeaturesVk = EnvCI.FeaturesVk ;
425426 EngineCI.IgnoreDebugMessageCount = static_cast <Uint32>(IgnoreDebugMessages.size ());
426427 EngineCI.ppIgnoreDebugMessageNames = IgnoreDebugMessages.data ();
427428
@@ -470,13 +471,13 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
470471 case RENDER_DEVICE_TYPE_WEBGPU:
471472 {
472473# if EXPLICITLY_LOAD_ENGINE_WEBGPU_DLL
473- auto GetEngineFactoryWebGPU = LoadGraphicsEngineWebGPU ();
474+ GetEngineFactoryWebGPUType GetEngineFactoryWebGPU = LoadGraphicsEngineWebGPU ();
474475 if (GetEngineFactoryWebGPU == nullptr )
475476 {
476477 LOG_ERROR_AND_THROW (" Failed to load the engine" );
477478 }
478479# endif
479- auto * pFactoryWGPU = GetEngineFactoryWebGPU ();
480+ IEngineFactoryWebGPU * pFactoryWGPU = GetEngineFactoryWebGPU ();
480481 pFactoryWGPU->SetMessageCallback (MessageCallback);
481482 pFactoryWGPU->SetBreakOnError (false );
482483
@@ -493,7 +494,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
493494 }
494495
495496 {
496- const auto & ActualFeats = m_pDevice->GetDeviceInfo ().Features ;
497+ const DeviceFeatures & ActualFeats = m_pDevice->GetDeviceInfo ().Features ;
497498#define CHECK_FEATURE_STATE (Feature ) \
498499 if (EnvCI.Features .Feature != DEVICE_FEATURE_STATE_OPTIONAL && EnvCI.Features .Feature != ActualFeats.Feature ) \
499500 { \
@@ -515,7 +516,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
515516 if (ppContexts[i] == nullptr )
516517 LOG_ERROR_AND_THROW (" Context must not be null" );
517518
518- const auto CtxDesc = ppContexts[i]->GetDesc ();
519+ const DeviceContextDesc CtxDesc = ppContexts[i]->GetDesc ();
519520 VERIFY (CtxDesc.ContextId == static_cast <Uint8>(i), " Invalid context index" );
520521 if (i < m_NumImmediateContexts)
521522 {
@@ -531,16 +532,16 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
531532
532533 for (size_t i = 0 ; i < ContextCI.size (); ++i)
533534 {
534- const auto & CtxCI = ContextCI[i];
535- const auto CtxDesc = m_pDeviceContexts[i]->GetDesc ();
535+ const ImmediateContextCreateInfo & CtxCI = ContextCI[i];
536+ const DeviceContextDesc CtxDesc = m_pDeviceContexts[i]->GetDesc ();
536537 if (CtxCI.QueueId != CtxDesc.QueueId )
537538 LOG_ERROR_MESSAGE (" QueueId mismatch" );
538539 if (i != CtxDesc.ContextId )
539540 LOG_ERROR_MESSAGE (" CommandQueueId mismatch" );
540541 }
541542
542- const auto & AdapterInfo = m_pDevice->GetAdapterInfo ();
543- std::string AdapterInfoStr;
543+ const GraphicsAdapterInfo & AdapterInfo = m_pDevice->GetAdapterInfo ();
544+ std::string AdapterInfoStr;
544545 AdapterInfoStr = " Adapter description: " ;
545546 AdapterInfoStr += AdapterInfo.Description ;
546547 AdapterInfoStr += " . Vendor: " ;
@@ -593,7 +594,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
593594 // Create archiver factory
594595 {
595596# if EXPLICITLY_LOAD_ARCHIVER_FACTORY_DLL
596- auto GetArchiverFactory = LoadArchiverFactory ();
597+ GetArchiverFactoryType GetArchiverFactory = LoadArchiverFactory ();
597598 if (GetArchiverFactory != nullptr )
598599 {
599600 m_ArchiverFactory = GetArchiverFactory ();
@@ -611,14 +612,14 @@ GPUTestingEnvironment::~GPUTestingEnvironment()
611612{
612613 for (Uint32 i = 0 ; i < GetNumImmediateContexts (); ++i)
613614 {
614- auto * pCtx = GetDeviceContext (i);
615+ IDeviceContext * pCtx = GetDeviceContext (i);
615616 pCtx->Flush ();
616617 pCtx->FinishFrame ();
617618
618619 if (i == 0 )
619620 {
620- const auto & Stats = pCtx->GetStats ();
621- const auto & CmdCounters = Stats.CommandCounters ;
621+ const DeviceContextStats& Stats = pCtx->GetStats ();
622+ const DeviceContextCommandCounters & CmdCounters = Stats.CommandCounters ;
622623 LOG_INFO_MESSAGE (
623624 " Device context stats"
624625 " \n Command counters" ,
@@ -691,7 +692,7 @@ void GPUTestingEnvironment::ReleaseResources()
691692 // later causing out-of-memory error.
692693 for (Uint32 i = 0 ; i < GetNumImmediateContexts (); ++i)
693694 {
694- auto * pCtx = GetDeviceContext (i);
695+ IDeviceContext * pCtx = GetDeviceContext (i);
695696 pCtx->Flush ();
696697 pCtx->FinishFrame ();
697698 pCtx->WaitForIdle ();
@@ -703,7 +704,7 @@ void GPUTestingEnvironment::Reset()
703704{
704705 for (Uint32 i = 0 ; i < GetNumImmediateContexts (); ++i)
705706 {
706- auto * pCtx = GetDeviceContext (i);
707+ IDeviceContext * pCtx = GetDeviceContext (i);
707708 pCtx->Flush ();
708709 pCtx->FinishFrame ();
709710 pCtx->InvalidateState ();
@@ -724,9 +725,9 @@ RefCntAutoPtr<ITexture> GPUTestingEnvironment::CreateTexture(const char* Name, T
724725 TexDesc.Width = Width;
725726 TexDesc.Height = Height;
726727
727- const auto FmtAttribs = GetTextureFormatAttribs (Fmt);
728- TextureSubResData Mip0Data{pInitData, FmtAttribs.ComponentSize * FmtAttribs.NumComponents * Width};
729- TextureData TexData{&Mip0Data, 1 };
728+ const TextureFormatAttribs& FmtAttribs = GetTextureFormatAttribs (Fmt);
729+ TextureSubResData Mip0Data{pInitData, FmtAttribs.ComponentSize * FmtAttribs.NumComponents * Width};
730+ TextureData TexData{&Mip0Data, 1 };
730731
731732 RefCntAutoPtr<ITexture> pTexture;
732733 m_pDevice->CreateTexture (TexDesc, pInitData ? &TexData : nullptr , &pTexture);
@@ -868,14 +869,14 @@ static bool ParseFeatureState(const char* Arg, DeviceFeatures& Features)
868869 DeviceFeatures::Enumerate (Features,
869870 [Arg](const char * FeatName, DEVICE_FEATURE_STATE& State) //
870871 {
871- const auto NameLen = strlen (FeatName);
872+ const size_t NameLen = strlen (FeatName);
872873 if (strncmp (FeatName, Arg, NameLen) != 0 )
873874 return true ;
874875
875876 if (Arg[NameLen] != ' =' )
876877 return true ; // Continue processing
877878
878- const auto Value = Arg + NameLen + 1 ;
879+ const char * Value = Arg + NameLen + 1 ;
879880
880881 static const std::string Off = " Off" ;
881882 static const std::string On = " On" ;
@@ -907,7 +908,7 @@ GPUTestingEnvironment* GPUTestingEnvironment::Initialize(int argc, char** argv)
907908 {
908909 const std::string AdapterArgName = " --adapter=" ;
909910
910- const auto * arg = argv[i];
911+ const char * arg = argv[i];
911912 if (strcmp (arg, " --mode=d3d11" ) == 0 )
912913 {
913914 TestEnvCI.deviceType = RENDER_DEVICE_TYPE_D3D11;
@@ -953,7 +954,7 @@ GPUTestingEnvironment* GPUTestingEnvironment::Initialize(int argc, char** argv)
953954 }
954955 else if (AdapterArgName.compare (0 , AdapterArgName.length (), arg, AdapterArgName.length ()) == 0 )
955956 {
956- const auto * AdapterStr = arg + AdapterArgName.length ();
957+ const char * AdapterStr = arg + AdapterArgName.length ();
957958 if (strcmp (AdapterStr, " sw" ) == 0 )
958959 TestEnvCI.AdapterType = ADAPTER_TYPE_SOFTWARE;
959960 else
@@ -971,6 +972,10 @@ GPUTestingEnvironment* GPUTestingEnvironment::Initialize(int argc, char** argv)
971972 {
972973 TestEnvCI.EnableDeviceSimulation = true ;
973974 }
975+ else if (strcmp (arg, " --vk_compatibility" ) == 0 )
976+ {
977+ TestEnvCI.FeaturesVk = DeviceFeaturesVk{DEVICE_FEATURE_STATE_DISABLED};
978+ }
974979 else if (ParseFeatureState (arg, TestEnvCI.Features ))
975980 {
976981 // Feature state has been updated by ParseFeatureState
@@ -1041,15 +1046,15 @@ GPUTestingEnvironment* GPUTestingEnvironment::Initialize(int argc, char** argv)
10411046 LOG_ERROR_AND_THROW (" Unsupported device type" );
10421047 }
10431048
1044- const auto DeviceType = pEnv->GetDevice ()->GetDeviceInfo ().Type ;
1049+ const RENDER_DEVICE_TYPE DeviceType = pEnv->GetDevice ()->GetDeviceInfo ().Type ;
10451050 if (DeviceType != TestEnvCI.deviceType )
10461051 {
10471052 delete pEnv;
10481053 LOG_ERROR_AND_THROW (" Requested device type (" , GetRenderDeviceTypeString (TestEnvCI.deviceType ),
10491054 " ) does not match the type of the device that was created (" , GetRenderDeviceTypeString (DeviceType), " )." );
10501055 }
10511056
1052- const auto AdapterType = pEnv->GetDevice ()->GetAdapterInfo ().Type ;
1057+ const ADAPTER_TYPE AdapterType = pEnv->GetDevice ()->GetAdapterInfo ().Type ;
10531058 if (TestEnvCI.AdapterType != ADAPTER_TYPE_UNKNOWN && TestEnvCI.AdapterType != AdapterType)
10541059 {
10551060 delete pEnv;
0 commit comments