void Composite::End(Renderer *renderer) { Pipeline *pipeline = renderer->immediate_pipeline(); // Unbind the input channels for (InputEntry entry : inputs_) { entry.second->Unbind(pipeline); } // Unbind the output channels for (OutputEntry entry : outputs_) { // We don't want to rebind an input_output since we've already done it in the input entry loop if (entry.second->type() != OutputChannel::TYPE_INPUT_OUTPUT) { entry.second->Unbind(pipeline); } } // Apply this clear any output targets pipeline->ApplyRenderTargets(); }
void Composite::Begin( Renderer *renderer ) { Pipeline *pipeline = renderer->immediate_pipeline(); // TODO Need to look at this more carefully since we need to integrate deferred contexts. Will the deferred context remove all the binded stuff or will it not? //std::cout << "Executing composite: " << *this << std::endl; // For now, all composite are done on the immediate context. // TODO Look into how this will work across different deferred context // Grab inputs and bind them for (InputEntry entry : inputs_) { entry.second->Bind(pipeline); } // Are there any outputs? if (outputs_.size()) { // Grab output targets and bind them for (OutputEntry entry : outputs_) { // We don't want to rebind an input_output since we've already done it in the input entry loop if (entry.second->type() != OutputChannel::TYPE_INPUT_OUTPUT) { entry.second->Bind(pipeline); } } } else { // Set the default output targets pipeline->output_merger_stage()->desired().set_render_target_view(0, renderer->render_target_view()); pipeline->output_merger_stage()->desired().set_depth_stencil_view(&renderer->depth_stencil_view()); } // TODO figure out how to cleanly handle the render targets between composites!! if (!pipeline->output_merger_stage()->desired().render_target_view(0)) { pipeline->output_merger_stage()->desired().set_render_target_view(0, renderer->render_target_view()); } // Apply the new pipeline states pipeline->ApplyPipelineResources(); pipeline->ApplyRenderTargets(); }