MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / BACKUP_DX11_STATE

Class BACKUP_DX11_STATE

KBotExt/imgui/imgui_impl_dx11.cpp:199–222  ·  view source on GitHub ↗

Backup DX state that will be modified to restore it afterwards (unfortunately this is very ugly looking and verbose. Close your eyes!)

Source from the content-addressed store, hash-verified

197
198 // Backup DX state that will be modified to restore it afterwards (unfortunately this is very ugly looking and verbose. Close your eyes!)
199 struct BACKUP_DX11_STATE
200 {
201 UINT ScissorRectsCount, ViewportsCount;
202 D3D11_RECT ScissorRects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
203 D3D11_VIEWPORT Viewports[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
204 ID3D11RasterizerState* RS;
205 ID3D11BlendState* BlendState;
206 FLOAT BlendFactor[4];
207 UINT SampleMask;
208 UINT StencilRef;
209 ID3D11DepthStencilState* DepthStencilState;
210 ID3D11ShaderResourceView* PSShaderResource;
211 ID3D11SamplerState* PSSampler;
212 ID3D11PixelShader* PS;
213 ID3D11VertexShader* VS;
214 ID3D11GeometryShader* GS;
215 UINT PSInstancesCount, VSInstancesCount, GSInstancesCount;
216 ID3D11ClassInstance* PSInstances[256], * VSInstances[256], * GSInstances[256]; // 256 is max according to PSSetShader documentation
217 D3D11_PRIMITIVE_TOPOLOGY PrimitiveTopology;
218 ID3D11Buffer* IndexBuffer, * VertexBuffer, * VSConstantBuffer;
219 UINT IndexBufferOffset, VertexBufferStride, VertexBufferOffset;
220 DXGI_FORMAT IndexBufferFormat;
221 ID3D11InputLayout* InputLayout;
222 };
223 BACKUP_DX11_STATE old = {};
224 old.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
225 ctx->RSGetScissorRects(&old.ScissorRectsCount, old.ScissorRects);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected