Skip to content

Commit ff7f929

Browse files
committed
Made D3D11 implementation work when using NK_UINT_DRAW_INDEX
1 parent daecaaa commit ff7f929

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

demo/d3d11/nuklear_d3d11.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,15 @@ nk_d3d11_render(ID3D11DeviceContext *context, enum nk_anti_aliasing AA)
8585
const float blend_factor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
8686
const UINT stride = sizeof(struct nk_d3d11_vertex);
8787
const UINT offset = 0;
88+
#ifdef NK_UINT_DRAW_INDEX
89+
DXGI_FORMAT index_buffer_format = DXGI_FORMAT_R32_UINT;
90+
#else
91+
DXGI_FORMAT index_buffer_format = DXGI_FORMAT_R16_UINT;
92+
#endif
8893

8994
ID3D11DeviceContext_IASetInputLayout(context, d3d11.input_layout);
9095
ID3D11DeviceContext_IASetVertexBuffers(context, 0, 1, &d3d11.vertex_buffer, &stride, &offset);
91-
ID3D11DeviceContext_IASetIndexBuffer(context, d3d11.index_buffer, DXGI_FORMAT_R16_UINT, 0);
96+
ID3D11DeviceContext_IASetIndexBuffer(context, d3d11.index_buffer, index_buffer_format, 0);
9297
ID3D11DeviceContext_IASetPrimitiveTopology(context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
9398

9499
ID3D11DeviceContext_VSSetShader(context, d3d11.vertex_shader, NULL, 0);

0 commit comments

Comments
 (0)