Skip to content

Commit 1e578f5

Browse files
Graphics Utilities: added GetRenderDeviceFeaturesVk function
1 parent af39c68 commit 1e578f5

File tree

5 files changed

+48
-7
lines changed

5 files changed

+48
-7
lines changed

Graphics/GraphicsTools/interface/GraphicsUtilities.h

Lines changed: 6 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");
@@ -266,6 +266,11 @@ void DILIGENT_GLOBAL_FUNCTION(CreateGeometryPrimitiveBuffers)(IRenderDevice*
266266
IBuffer** ppIndices,
267267
GeometryPrimitiveInfo* pInfo DEFAULT_VALUE(nullptr));
268268

269+
/// Returns vulkan-specific render device features.
270+
void DILIGENT_GLOBAL_FUNCTION(GetRenderDeviceFeaturesVk)(IRenderDevice* pDevice,
271+
DeviceFeaturesVk REF FeaturesVk);
272+
273+
269274
#include "../../../Primitives/interface/UndefRefMacro.h"
270275

271276
DILIGENT_END_NAMESPACE // namespace Diligent

Graphics/GraphicsTools/src/GraphicsUtilities.cpp

Lines changed: 14 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");
@@ -59,6 +59,9 @@ TEXTURE_FORMAT GetTextureFormatFromNativeGL(int64_t NativeFormat);
5959
#if VULKAN_SUPPORTED
6060
int64_t GetNativeTextureFormatVk(TEXTURE_FORMAT TexFormat);
6161
TEXTURE_FORMAT GetTextureFormatFromNativeVk(int64_t NativeFormat);
62+
63+
void GetRenderDeviceFeaturesVk(IRenderDevice* pDevice,
64+
DeviceFeaturesVk& FeaturesVk);
6265
#endif
6366

6467
#if METAL_SUPPORTED
@@ -827,4 +830,14 @@ extern "C"
827830
{
828831
Diligent::CreateGeometryPrimitiveBuffers(pDevice, Attribs, pBufferCI, ppVertices, ppIndices, pInfo);
829832
}
833+
834+
void Diligent_GetRenderDeviceFeaturesVk(Diligent::IRenderDevice* pDevice,
835+
Diligent::DeviceFeaturesVk& FeaturesVk)
836+
{
837+
#if VULKAN_SUPPORTED
838+
Diligent::GetRenderDeviceFeaturesVk(pDevice, FeaturesVk);
839+
#else
840+
FeaturesVk = {};
841+
#endif
842+
}
830843
}

Graphics/GraphicsTools/src/GraphicsUtilitiesVk.cpp

Lines changed: 18 additions & 5 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
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,12 +27,12 @@
2727
#include "GraphicsUtilities.h"
2828
#include "DeviceContext.h"
2929

30-
#if VULKAN_SUPPORTED
31-
# include "../../GraphicsEngineVulkan/include/VulkanUtilities/VulkanHeaders.h"
32-
#endif
33-
30+
#include "../../GraphicsEngineVulkan/include/VulkanUtilities/VulkanHeaders.h"
3431
#include "../../GraphicsEngineVulkan/include/VulkanTypeConversions.hpp"
3532

33+
#include "RenderDeviceVk.h"
34+
#include "RefCntAutoPtr.hpp"
35+
3636
namespace Diligent
3737
{
3838

@@ -46,4 +46,17 @@ TEXTURE_FORMAT GetTextureFormatFromNativeVk(int64_t NativeFormat)
4646
return VkFormatToTexFormat(static_cast<VkFormat>(NativeFormat));
4747
}
4848

49+
void GetRenderDeviceFeaturesVk(IRenderDevice* pDevice,
50+
DeviceFeaturesVk& FeaturesVk)
51+
{
52+
if (RefCntAutoPtr<IRenderDeviceVk> pDeviceVk{pDevice, IID_RenderDeviceVk})
53+
{
54+
pDeviceVk->GetDeviceFeaturesVk(FeaturesVk);
55+
}
56+
else
57+
{
58+
FeaturesVk = {};
59+
}
60+
}
61+
4962
} // namespace Diligent

Tests/GPUTestFramework/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ PRIVATE
7272
Diligent-BuildSettings
7373
Diligent-Common
7474
Diligent-ShaderTools
75+
Diligent-GraphicsTools
7576
PUBLIC
7677
${ENGINE_LIBRARIES}
7778
Diligent-TestFramework

Tests/GPUTestFramework/src/GPUTestingEnvironment.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "TestingSwapChainBase.hpp"
3737
#include "StringTools.hpp"
3838
#include "GraphicsAccessories.hpp"
39+
#include "GraphicsUtilities.h"
3940

4041
#if D3D11_SUPPORTED
4142
# include "EngineFactoryD3D11.h"
@@ -594,6 +595,14 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
594595
AdapterInfoStr += " MB.";
595596
LOG_INFO_MESSAGE(AdapterInfoStr);
596597

598+
LOG_INFO_MESSAGE("Device features:\n", GetDeviceFeaturesString(m_pDevice->GetDeviceInfo().Features, 3));
599+
if (m_DeviceType == RENDER_DEVICE_TYPE_VULKAN)
600+
{
601+
DeviceFeaturesVk FeaturesVk;
602+
GetRenderDeviceFeaturesVk(m_pDevice, FeaturesVk);
603+
LOG_INFO_MESSAGE("Device features (Vulkan):\n", GetDeviceFeaturesString(FeaturesVk, 3));
604+
}
605+
597606
#if ARCHIVER_SUPPORTED
598607
// Create archiver factory
599608
{

0 commit comments

Comments
 (0)