Skip to content

Commit 25296ce

Browse files
MikhailGorobetsTheMostDiligent
authored andcommitted
Added DRAW_COMMAND_CAP_FLAG_BASE_VERTEX flag
1 parent 431dcb9 commit 25296ce

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

Graphics/GraphicsEngine/interface/GraphicsTypes.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2537,21 +2537,24 @@ DILIGENT_TYPED_ENUM(DRAW_COMMAND_CAP_FLAGS, Uint16)
25372537
/// No draw command capabilities.
25382538
DRAW_COMMAND_CAP_FLAG_NONE = 0,
25392539

2540+
/// Indicates that device supports non-zero base vertex for IDeviceContext::DrawIndexed().
2541+
DRAW_COMMAND_CAP_FLAG_BASE_VERTEX = 1u << 0,
2542+
25402543
/// Indicates that device supports indirect draw/dispatch commands.
2541-
DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT = 1u << 0,
2544+
DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT = 1u << 1,
25422545

25432546
/// Indicates that FirstInstanceLocation of the indirect draw command can be greater than zero.
2544-
DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT_FIRST_INSTANCE = 1u << 1,
2547+
DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT_FIRST_INSTANCE = 1u << 2,
25452548

25462549
/// Indicates that device natively supports indirect draw commands with DrawCount > 1.
25472550
/// When this flag is not set, the commands will be emulated on the host, which will
25482551
/// produce correct results, but will be slower.
2549-
DRAW_COMMAND_CAP_FLAG_NATIVE_MULTI_DRAW_INDIRECT = 1u << 2,
2552+
DRAW_COMMAND_CAP_FLAG_NATIVE_MULTI_DRAW_INDIRECT = 1u << 3,
25502553

25512554
/// Indicates that IDeviceContext::DrawIndirect() and IDeviceContext::DrawIndexedIndirect()
25522555
/// commands may take non-null counter buffer. If this flag is not set, the number
25532556
/// of draw commands must be specified through the command attributes.
2554-
DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT_COUNTER_BUFFER = 1u << 3
2557+
DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT_COUNTER_BUFFER = 1u << 4
25552558
};
25562559
DEFINE_FLAG_ENUM_OPERATORS(DRAW_COMMAND_CAP_FLAGS);
25572560

Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ GraphicsAdapterInfo EngineFactoryD3D11Impl::GetGraphicsAdapterInfo(void*
505505
// Draw command properties
506506
{
507507
auto& DrawCommandProps{AdapterInfo.DrawCommand};
508+
DrawCommandProps.CapFlags |= DRAW_COMMAND_CAP_FLAG_BASE_VERTEX;
508509
#if D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP >= 32
509510
DrawCommandProps.MaxIndexValue = ~0u;
510511
#else

Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ GraphicsAdapterInfo EngineFactoryD3D12Impl::GetGraphicsAdapterInfo(void*
10651065
DrawCommandProps.MaxIndexValue = 1u << D3D12_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP;
10661066
#endif
10671067
DrawCommandProps.CapFlags |=
1068+
DRAW_COMMAND_CAP_FLAG_BASE_VERTEX |
10681069
DRAW_COMMAND_CAP_FLAG_NATIVE_MULTI_DRAW_INDIRECT |
10691070
DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT_COUNTER_BUFFER;
10701071
#if defined(_MSC_VER) && defined(_WIN64)

Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ void RenderDeviceGLImpl::InitAdapterInfo()
938938
DrawCommandProps.CapFlags = DRAW_COMMAND_CAP_FLAG_NONE;
939939
if (m_DeviceInfo.Type == RENDER_DEVICE_TYPE_GL)
940940
{
941-
DrawCommandProps.CapFlags |= DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT;
941+
DrawCommandProps.CapFlags |= DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT | DRAW_COMMAND_CAP_FLAG_BASE_VERTEX;
942942

943943
// The baseInstance member of the DrawElementsIndirectCommand structure is defined only if the GL version is 4.2 or greater.
944944
if (GLVersion >= Version{4, 2})
@@ -956,6 +956,9 @@ void RenderDeviceGLImpl::InitAdapterInfo()
956956
if (GLVersion >= Version{3, 1} || strstr(Extensions, "draw_indirect"))
957957
DrawCommandProps.CapFlags |= DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT;
958958

959+
if (GLVersion >= Version{3, 2} || strstr(Extensions, "draw_elements_base_vertex"))
960+
DrawCommandProps.CapFlags |= DRAW_COMMAND_CAP_FLAG_BASE_VERTEX;
961+
959962
if (strstr(Extensions, "base_instance"))
960963
DrawCommandProps.CapFlags |= DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT_FIRST_INSTANCE;
961964

Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ GraphicsAdapterInfo GetPhysicalDeviceGraphicsAdapterInfo(const VulkanUtilities::
399399
auto& DrawCommandProps{AdapterInfo.DrawCommand};
400400
DrawCommandProps.MaxIndexValue = vkDeviceProps.limits.maxDrawIndexedIndexValue;
401401
DrawCommandProps.MaxDrawIndirectCount = vkDeviceProps.limits.maxDrawIndirectCount;
402-
DrawCommandProps.CapFlags = DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT;
402+
DrawCommandProps.CapFlags = DRAW_COMMAND_CAP_FLAG_DRAW_INDIRECT | DRAW_COMMAND_CAP_FLAG_BASE_VERTEX;
403403
if (vkFeatures.multiDrawIndirect != VK_FALSE || vkExtFeatures.DrawIndirectCount)
404404
DrawCommandProps.CapFlags |= DRAW_COMMAND_CAP_FLAG_NATIVE_MULTI_DRAW_INDIRECT;
405405
if (vkFeatures.drawIndirectFirstInstance != VK_FALSE)

0 commit comments

Comments
 (0)