MCPcopy Create free account
hub / github.com/crosire/reshade / ClearState

Method ClearState

source/d3d12/d3d12_command_list.cpp:192–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void STDMETHODCALLTYPE D3D12GraphicsCommandList::ClearState(ID3D12PipelineState *pPipelineState)
193{
194 _orig->ClearState(pPipelineState);
195
196 _current_root_signature[0] = nullptr;
197 _current_root_signature[1] = nullptr;
198 _current_descriptor_heaps[0] = nullptr;
199 _current_descriptor_heaps[1] = nullptr;
200#if RESHADE_ADDON >= 2
201 _previous_descriptor_heaps[0] = nullptr;
202 _previous_descriptor_heaps[1] = nullptr;
203
204 reshade::invoke_addon_event<reshade::addon_event::bind_pipeline>(this, reshade::api::pipeline_stage::all, to_handle(pPipelineState));
205
206 // When 'ClearState' is called, all currently bound resources are unbound.
207 // The primitive topology is set to D3D_PRIMITIVE_TOPOLOGY_UNDEFINED. Viewports, scissor rectangles, stencil reference value, and the blend factor are set to empty values (all zeros).
208 const reshade::api::dynamic_state states[4] = { reshade::api::dynamic_state::primitive_topology, reshade::api::dynamic_state::blend_constant, reshade::api::dynamic_state::front_stencil_reference_value, reshade::api::dynamic_state::back_stencil_reference_value };
209 const uint32_t values[4] = { static_cast<uint32_t>(reshade::api::primitive_topology::undefined), 0, 0, 0 };
210 reshade::invoke_addon_event<reshade::addon_event::bind_pipeline_states>(this, static_cast<uint32_t>(std::size(states)), states, values);
211
212 constexpr size_t max_null_objects = D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT * 2;
213 void *const null_objects[max_null_objects] = {};
214
215 reshade::invoke_addon_event<reshade::addon_event::bind_descriptor_tables>(this, reshade::api::shader_stage::all, reshade::api::pipeline_layout {}, 0, 0, nullptr);
216
217 reshade::invoke_addon_event<reshade::addon_event::bind_index_buffer>(this, reshade::api::resource {}, 0, 0);
218 reshade::invoke_addon_event<reshade::addon_event::bind_vertex_buffers>(this, 0, D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, reinterpret_cast<const reshade::api::resource *>(null_objects), reinterpret_cast<const uint64_t *>(null_objects), reinterpret_cast<const uint32_t *>(null_objects));
219
220 reshade::invoke_addon_event<reshade::addon_event::bind_render_targets_and_depth_stencil>(this, D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT, reinterpret_cast<const reshade::api::resource_view *>(null_objects), reshade::api::resource_view {});
221
222 reshade::invoke_addon_event<reshade::addon_event::bind_viewports>(this, 0, 0, nullptr);
223 reshade::invoke_addon_event<reshade::addon_event::bind_scissor_rects>(this, 0, 0, nullptr);
224#endif
225}
226void STDMETHODCALLTYPE D3D12GraphicsCommandList::DrawInstanced(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation)
227{
228#if RESHADE_ADDON

Callers

nothing calls this directly

Calls 1

to_handleFunction · 0.70

Tested by

no test coverage detected