|
@@ -11,6 +11,7 @@
|
|
|
|
|
|
// CHANGELOG
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
+// 2019-07-21: DirectX11: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData. Clearing Hull/Domain/Compute shaders without backup/restore.
|
|
|
// 2019-05-29: DirectX11: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
|
|
// 2019-04-30: DirectX11: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
|
|
// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
|
|
@@ -81,6 +82,10 @@ static void ImGui_ImplDX11_SetupRenderState(ImDrawData* draw_data, ID3D11DeviceC
|
|
|
ctx->VSSetConstantBuffers(0, 1, &g_pVertexConstantBuffer);
|
|
|
ctx->PSSetShader(g_pPixelShader, NULL, 0);
|
|
|
ctx->PSSetSamplers(0, 1, &g_pFontSampler);
|
|
|
+ ctx->GSSetShader(NULL, NULL, 0);
|
|
|
+ ctx->HSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
|
|
|
+ ctx->DSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
|
|
|
+ ctx->CSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
|
|
|
|
|
|
// Setup blend state
|
|
|
const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
|
|
@@ -185,8 +190,9 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
|
|
ID3D11SamplerState* PSSampler;
|
|
|
ID3D11PixelShader* PS;
|
|
|
ID3D11VertexShader* VS;
|
|
|
- UINT PSInstancesCount, VSInstancesCount;
|
|
|
- ID3D11ClassInstance* PSInstances[256], *VSInstances[256]; // 256 is max according to PSSetShader documentation
|
|
|
+ ID3D11GeometryShader* GS;
|
|
|
+ UINT PSInstancesCount, VSInstancesCount, GSInstancesCount;
|
|
|
+ ID3D11ClassInstance *PSInstances[256], *VSInstances[256], *GSInstances[256]; // 256 is max according to PSSetShader documentation
|
|
|
D3D11_PRIMITIVE_TOPOLOGY PrimitiveTopology;
|
|
|
ID3D11Buffer* IndexBuffer, *VertexBuffer, *VSConstantBuffer;
|
|
|
UINT IndexBufferOffset, VertexBufferStride, VertexBufferOffset;
|
|
@@ -206,6 +212,8 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
|
|
ctx->PSGetShader(&old.PS, old.PSInstances, &old.PSInstancesCount);
|
|
|
ctx->VSGetShader(&old.VS, old.VSInstances, &old.VSInstancesCount);
|
|
|
ctx->VSGetConstantBuffers(0, 1, &old.VSConstantBuffer);
|
|
|
+ ctx->GSGetShader(&old.GS, old.GSInstances, &old.GSInstancesCount);
|
|
|
+
|
|
|
ctx->IAGetPrimitiveTopology(&old.PrimitiveTopology);
|
|
|
ctx->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);
|
|
|
ctx->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);
|
|
@@ -262,6 +270,7 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
|
|
for (UINT i = 0; i < old.PSInstancesCount; i++) if (old.PSInstances[i]) old.PSInstances[i]->Release();
|
|
|
ctx->VSSetShader(old.VS, old.VSInstances, old.VSInstancesCount); if (old.VS) old.VS->Release();
|
|
|
ctx->VSSetConstantBuffers(0, 1, &old.VSConstantBuffer); if (old.VSConstantBuffer) old.VSConstantBuffer->Release();
|
|
|
+ ctx->GSSetShader(old.GS, old.GSInstances, old.GSInstancesCount); if (old.GS) old.GS->Release();
|
|
|
for (UINT i = 0; i < old.VSInstancesCount; i++) if (old.VSInstances[i]) old.VSInstances[i]->Release();
|
|
|
ctx->IASetPrimitiveTopology(old.PrimitiveTopology);
|
|
|
ctx->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();
|