Skip to content

Commit bf3d2c5

Browse files
Added TextureSubresourceViews device feature (API254003)
1 parent f57b131 commit bf3d2c5

10 files changed

Lines changed: 32 additions & 16 deletions

File tree

Graphics/GraphicsEngine/interface/APIInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/// \file
3131
/// Diligent API information
3232

33-
#define DILIGENT_API_VERSION 254002
33+
#define DILIGENT_API_VERSION 254003
3434

3535
#include "../../../Primitives/interface/BasicTypes.h"
3636

Graphics/GraphicsEngine/interface/GraphicsTypes.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,15 @@ struct DeviceFeatures
17881788
/// Indicates if device supports texture component swizzle.
17891789
DEVICE_FEATURE_STATE TextureComponentSwizzle DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED);
17901790

1791+
/// Indicates if device supports texture subresource views.
1792+
///
1793+
/// \remarks This feature is always enabled in all backends except for GLES, WebGL and older
1794+
/// OpenGL versions.
1795+
///
1796+
/// When this feature is disabled, only texture views that reference the entire
1797+
/// texture can be created.
1798+
DEVICE_FEATURE_STATE TextureSubresourceViews DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED);
1799+
17911800
#if DILIGENT_CPP_INTERFACE
17921801
constexpr DeviceFeatures() noexcept {}
17931802

@@ -1832,11 +1841,12 @@ struct DeviceFeatures
18321841
Handler(VariableRateShading) \
18331842
Handler(SparseResources) \
18341843
Handler(SubpassFramebufferFetch) \
1835-
Handler(TextureComponentSwizzle)
1844+
Handler(TextureComponentSwizzle) \
1845+
Handler(TextureSubresourceViews)
18361846

18371847
explicit constexpr DeviceFeatures(DEVICE_FEATURE_STATE State) noexcept
18381848
{
1839-
static_assert(sizeof(*this) == 41, "Did you add a new feature to DeviceFeatures? Please add it to ENUMERATE_DEVICE_FEATURES.");
1849+
static_assert(sizeof(*this) == 42, "Did you add a new feature to DeviceFeatures? Please add it to ENUMERATE_DEVICE_FEATURES.");
18401850
#define INIT_FEATURE(Feature) Feature = State;
18411851
ENUMERATE_DEVICE_FEATURES(INIT_FEATURE)
18421852
#undef INIT_FEATURE

Graphics/GraphicsEngine/src/RenderDeviceBase.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2024 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.
@@ -113,10 +113,11 @@ DeviceFeatures EnableDeviceFeatures(const DeviceFeatures& SupportedFeatures,
113113
ENABLE_FEATURE(SparseResources, "Sparse resources are");
114114
ENABLE_FEATURE(SubpassFramebufferFetch, "Subpass framebuffer fetch is");
115115
ENABLE_FEATURE(TextureComponentSwizzle, "Texture component swizzle is");
116+
ENABLE_FEATURE(TextureSubresourceViews, "Texture subresource views are");
116117
// clang-format on
117118
#undef ENABLE_FEATURE
118119

119-
ASSERT_SIZEOF(Diligent::DeviceFeatures, 41, "Did you add a new feature to DeviceFeatures? Please handle its status here (if necessary).");
120+
ASSERT_SIZEOF(Diligent::DeviceFeatures, 42, "Did you add a new feature to DeviceFeatures? Please handle its status here (if necessary).");
120121

121122
return EnabledFeatures;
122123
}

Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2024 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -455,7 +455,7 @@ GraphicsAdapterInfo EngineFactoryD3D11Impl::GetGraphicsAdapterInfo(void*
455455
}
456456
Features.ShaderFloat16 = ShaderFloat16Supported ? DEVICE_FEATURE_STATE_ENABLED : DEVICE_FEATURE_STATE_DISABLED;
457457
}
458-
ASSERT_SIZEOF(Features, 41, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
458+
ASSERT_SIZEOF(Features, 42, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
459459

460460
// Texture properties
461461
{

Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2024 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -1067,7 +1067,7 @@ GraphicsAdapterInfo EngineFactoryD3D12Impl::GetGraphicsAdapterInfo(void*
10671067
ASSERT_SIZEOF(DrawCommandProps, 12, "Did you add a new member to DrawCommandProperties? Please initialize it here.");
10681068
}
10691069

1070-
ASSERT_SIZEOF(DeviceFeatures, 41, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
1070+
ASSERT_SIZEOF(DeviceFeatures, 42, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
10711071

10721072
return AdapterInfo;
10731073
}

Graphics/GraphicsEngineD3DBase/include/EngineFactoryD3DBase.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2024 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -219,6 +219,7 @@ class EngineFactoryD3DBase : public EngineFactoryBase<BaseInterface>
219219
Features.TileShaders = DEVICE_FEATURE_STATE_DISABLED;
220220
Features.SubpassFramebufferFetch = DEVICE_FEATURE_STATE_DISABLED;
221221
Features.TextureComponentSwizzle = DEVICE_FEATURE_STATE_DISABLED;
222+
Features.TextureSubresourceViews = DEVICE_FEATURE_STATE_ENABLED;
222223
}
223224

224225
// Set memory properties

Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2024 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -838,6 +838,7 @@ void RenderDeviceGLImpl::InitAdapterInfo()
838838
ENABLE_FEATURE(ResourceBuffer8BitAccess, CheckExtension("GL_EXT_shader_8bit_storage"));
839839
ENABLE_FEATURE(UniformBuffer8BitAccess, CheckExtension("GL_EXT_shader_8bit_storage"));
840840
ENABLE_FEATURE(TextureComponentSwizzle, IsGL46OrAbove || CheckExtension("GL_ARB_texture_swizzle"));
841+
ENABLE_FEATURE(TextureSubresourceViews, IsGL43OrAbove || CheckExtension("GL_ARB_texture_view"));
841842
// clang-format on
842843

843844
TexProps.MaxTexture1DDimension = MaxTextureSize;
@@ -908,6 +909,7 @@ void RenderDeviceGLImpl::InitAdapterInfo()
908909
ENABLE_FEATURE(ResourceBuffer8BitAccess, strstr(Extensions, "shader_8bit_storage"));
909910
ENABLE_FEATURE(UniformBuffer8BitAccess, strstr(Extensions, "shader_8bit_storage"));
910911
ENABLE_FEATURE(TextureComponentSwizzle, true);
912+
ENABLE_FEATURE(TextureSubresourceViews, strstr(Extensions, "texture_view"));
911913
// clang-format on
912914

913915
TexProps.MaxTexture1DDimension = 0; // Not supported in GLES 3.2
@@ -1070,7 +1072,7 @@ void RenderDeviceGLImpl::InitAdapterInfo()
10701072
m_AdapterInfo.Queues[0].TextureCopyGranularity[2] = 1;
10711073
}
10721074

1073-
ASSERT_SIZEOF(DeviceFeatures, 41, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
1075+
ASSERT_SIZEOF(DeviceFeatures, 42, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
10741076
}
10751077

10761078
void RenderDeviceGLImpl::FlagSupportedTexFormats()

Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2024 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -1153,7 +1153,7 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& En
11531153
LOG_ERROR_MESSAGE("Can not enable extended device features when VK_KHR_get_physical_device_properties2 extension is not supported by device");
11541154
}
11551155

1156-
ASSERT_SIZEOF(Diligent::DeviceFeatures, 41, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
1156+
ASSERT_SIZEOF(Diligent::DeviceFeatures, 42, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
11571157

11581158
for (Uint32 i = 0; i < EngineCI.DeviceExtensionCount; ++i)
11591159
{

Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2024 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -1941,6 +1941,7 @@ DeviceFeatures VkFeaturesToDeviceFeatures(uint32_t
19411941
Features.BinaryOcclusionQueries = DEVICE_FEATURE_STATE_ENABLED;
19421942
Features.SubpassFramebufferFetch = DEVICE_FEATURE_STATE_ENABLED;
19431943
Features.TextureComponentSwizzle = DEVICE_FEATURE_STATE_ENABLED;
1944+
Features.TextureSubresourceViews = DEVICE_FEATURE_STATE_ENABLED;
19441945

19451946
// Timestamps are not a feature and can't be disabled. They are either supported by the device, or not.
19461947
Features.TimestampQueries = vkDeviceProps.limits.timestampComputeAndGraphics ? DEVICE_FEATURE_STATE_ENABLED : DEVICE_FEATURE_STATE_DISABLED;
@@ -2037,7 +2038,7 @@ DeviceFeatures VkFeaturesToDeviceFeatures(uint32_t
20372038
Features.DurationQueries = DEVICE_FEATURE_STATE_DISABLED;
20382039
#endif
20392040

2040-
ASSERT_SIZEOF(DeviceFeatures, 41, "Did you add a new feature to DeviceFeatures? Please handle its status here (if necessary).");
2041+
ASSERT_SIZEOF(DeviceFeatures, 42, "Did you add a new feature to DeviceFeatures? Please handle its status here (if necessary).");
20412042

20422043
return Features;
20432044
}

ReleaseHistory.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Current progress
22

3+
* Added `TextureSubresourceViews` device feature (API254003)
34
* Added device context rendering statistics (API254002)
45
* Added `DeviceContextStats` struct
56
* Added `IDeviceContext::ClearStats` and `IDeviceContext::GetStats` methods

0 commit comments

Comments
 (0)