Functions
| 79 | |
| 80 | // Functions |
| 81 | static void ImGui_ImplDX11_SetupRenderState(ImDrawData* draw_data, ID3D11DeviceContext* ctx) |
| 82 | { |
| 83 | ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData(); |
| 84 | |
| 85 | // Setup viewport |
| 86 | D3D11_VIEWPORT vp; |
| 87 | memset(&vp, 0, sizeof(D3D11_VIEWPORT)); |
| 88 | vp.Width = draw_data->DisplaySize.x; |
| 89 | vp.Height = draw_data->DisplaySize.y; |
| 90 | vp.MinDepth = 0.0f; |
| 91 | vp.MaxDepth = 1.0f; |
| 92 | vp.TopLeftX = vp.TopLeftY = 0; |
| 93 | ctx->RSSetViewports(1, &vp); |
| 94 | |
| 95 | // Setup shader and vertex buffers |
| 96 | unsigned int stride = sizeof(ImDrawVert); |
| 97 | unsigned int offset = 0; |
| 98 | ctx->IASetInputLayout(bd->pInputLayout); |
| 99 | ctx->IASetVertexBuffers(0, 1, &bd->pVB, &stride, &offset); |
| 100 | ctx->IASetIndexBuffer(bd->pIB, sizeof(ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0); |
| 101 | ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); |
| 102 | ctx->VSSetShader(bd->pVertexShader, nullptr, 0); |
| 103 | ctx->VSSetConstantBuffers(0, 1, &bd->pVertexConstantBuffer); |
| 104 | ctx->PSSetShader(bd->pPixelShader, nullptr, 0); |
| 105 | ctx->PSSetSamplers(0, 1, &bd->pFontSampler); |
| 106 | ctx->GSSetShader(nullptr, nullptr, 0); |
| 107 | ctx->HSSetShader(nullptr, nullptr, 0); // In theory we should backup and restore this as well.. very infrequently used.. |
| 108 | ctx->DSSetShader(nullptr, nullptr, 0); // In theory we should backup and restore this as well.. very infrequently used.. |
| 109 | ctx->CSSetShader(nullptr, nullptr, 0); // In theory we should backup and restore this as well.. very infrequently used.. |
| 110 | |
| 111 | // Setup blend state |
| 112 | const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f }; |
| 113 | ctx->OMSetBlendState(bd->pBlendState, blend_factor, 0xffffffff); |
| 114 | ctx->OMSetDepthStencilState(bd->pDepthStencilState, 0); |
| 115 | ctx->RSSetState(bd->pRasterizerState); |
| 116 | } |
| 117 | |
| 118 | // Render function |
| 119 | void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data) |
no test coverage detected