The scene is a box draw with a simple shader.
In a demo the drawIndexed cost 0.000160 ms, but in my engine cost 0.1 ms.
They use same mesh, same input layout, same shader, same renderstate .
Why drawIndexed cost so much? I 'm not sure the if drawIndexed return immediate or not ?
I 'm suspect that the quicker one use a defered context and the slower one use async context, they are in c++ project.
However they use the same code to create context :
UINT createDeviceFlags = 0;
#if defined(DEBUG) || defined(_DEBUG)
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
D3D_FEATURE_LEVEL featureLevel;
HRESULT hr = D3D11CreateDevice(
0, // default adapter
_driverType,
0, // no software device
createDeviceFlags,
0, 0, // default feature level array
D3D11_SDK_VERSION,
&_device,
&featureLevel,
&_context);
Have you ever meet this situation ? one draw call cost a great num of time.
Would wrong state will cause drawIndexed slower?