@@ -116,6 +116,9 @@ namespace vrperfkit {
116116 context->RSGetViewports ( &state.numViewports , state.viewports );
117117 context->VSGetConstantBuffers ( 0 , 1 , state.vsConstantBuffer .GetAddressOf () );
118118 context->PSGetConstantBuffers ( 0 , 1 , state.psConstantBuffer .GetAddressOf () );
119+ context->CSGetConstantBuffers (0 , 1 , state.csConstantBuffer .GetAddressOf ());
120+ context->CSGetShaderResources (0 , D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, state.csShaderResources );
121+ context->CSGetUnorderedAccessViews (0 , D3D11_1_UAV_SLOT_COUNT, state.csUavs );
119122 }
120123
121124 void RestoreD3D11State (ID3D11DeviceContext *context, const D3D11State &state) {
@@ -141,6 +144,18 @@ namespace vrperfkit {
141144 context->RSSetViewports ( state.numViewports , state.viewports );
142145 context->VSSetConstantBuffers ( 0 , 1 , state.vsConstantBuffer .GetAddressOf () );
143146 context->PSSetConstantBuffers ( 0 , 1 , state.psConstantBuffer .GetAddressOf () );
147+ context->CSSetConstantBuffers (0 , 1 , state.csConstantBuffer .GetAddressOf ());
148+ context->CSSetShaderResources (0 , D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, state.csShaderResources );
149+ for (int i = 0 ; i < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) {
150+ if (state.csShaderResources [i])
151+ state.csShaderResources [i]->Release ();
152+ }
153+ UINT initial = 0 ;
154+ context->CSSetUnorderedAccessViews (0 , D3D11_1_UAV_SLOT_COUNT, state.csUavs , &initial);
155+ for (int i = 0 ; i < D3D11_1_UAV_SLOT_COUNT; ++i) {
156+ if (state.csUavs [i])
157+ state.csUavs [i]->Release ();
158+ }
144159 }
145160
146161 ComPtr<ID3D11ShaderResourceView> CreateShaderResourceView (ID3D11Device *device, ID3D11Texture2D *texture, int arrayIndex) {
0 commit comments