Skip to main content
GameDev.net gamedev.net
🔒 Locked

DX12 Some structure have Int type which uses a specific enum.

Started by BornToCode Sep 12, 2015 at 7:08 PM 1 replies 2.1k views
Original Post
BornToCode
BornToCode

I do not know why microsoft would do this. I think it would have make things easier to know which parameter they took, especially when you have a enum define for something. Then in the structure instead of defining one of the attribute with that enum they pass an Int instead. A good example of that is

enum D3D12_COMMAND_QUEUE_PRIORITY
{
D3D12_COMMAND_QUEUE_PRIORITY_NORMAL = 0,
D3D12_COMMAND_QUEUE_PRIORITY_HIGH = 100
} D3D12_COMMAND_QUEUE_PRIORITY;

typedef struct D3D12_COMMAND_QUEUE_DESC
{
D3D12_COMMAND_LIST_TYPE Type;
INT Priority;
D3D12_COMMAND_QUEUE_FLAGS Flags;
UINT NodeMask;
}

The Priority flag is a D3D12_COMMAND_QUEUE_PRIOORITY why the heck would they pass an Int. I know at the end of the day an enum is just an Int, but it would have been more friendly and i would not need to look at the documentation to make sure that the correct Int values that can be passed are D3D12_COMMAND_QUEUE_PRIORITY. I am pretty sure they have similar issues throughout the API.

BornToCode
BornToCode

Looking more at the D3D12.h header it seems like this is the only place where they have that mistake. So i guess it is a typo on someones part.

21st Century Moose
21st Century Moose

I suspect that in this case the API call actually really does use an int, specified in a 0..100 range, and that the enum just exists as a helper. By this reasoning, intermediate priority values would also be valid.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.