Józef pointed out a couple of issues in the other patches that also apply here. I won't repeat those.
On 18 November 2016 at 04:45, Andrew Wesie awesie@gmail.com wrote:
- static const struct vec2 vertices[] =
- {
{ -1.0f, -1.0f },
{ -1.0f, 1.0f },
{ 1.0f, -1.0f },
{ 1.0f, 1.0f },
{ -1.0f, -1.0f },
{ -1.0f, 1.0f },
{ 1.0f, -1.0f },
{ 1.0f, 1.0f },
- };
This works, but for primitive restart in particular it may be more useful to not draw these overlapping and instead use e.g. {-1.0f, -0.25f, 0.25f, 1.0f} for the x-coordinates.
- static const unsigned int indices[] =
- {
0, 1, 2, 3, 0xFFFFFFFF, 4, 5, 6, 7
- };
We use lowercase hexadecimal constants.
- hr = ID3D11Device_CreateInputLayout(device, layout_desc,
sizeof(layout_desc) / sizeof(*layout_desc),
vs_code, sizeof(vs_code), &test_context.input_layout);
I realise test_cb_relative_addressing() in particular uses test_context's input_layout field in a similar way, but it doesn't strike me as something we'd want to encourage. Likewise for the "vs" and "vb" fields. We use double indentation for line continuations.
- expected_color = 0xff0000ff;
- ID3D11DeviceContext_IASetIndexBuffer(test_context.immediate_context, ib, DXGI_FORMAT_R32_UINT, 0);
- ID3D11DeviceContext_DrawIndexed(test_context.immediate_context, 9, 0, 0);
- check_texture_color(test_context.backbuffer, expected_color, 0);
- ID3D11DeviceContext_IASetIndexBuffer(test_context.immediate_context, ib16, DXGI_FORMAT_R16_UINT, 0);
- ID3D11DeviceContext_DrawIndexed(test_context.immediate_context, 9, 0, 0);
- check_texture_color(test_context.backbuffer, expected_color, 0);
The "expected_color" variable seems unnecessary here.