| 47 | } |
| 48 | |
| 49 | void RenderState::bindPass(Pass* pass, MeshCommand* command) |
| 50 | { |
| 51 | AX_ASSERT(pass); |
| 52 | assert(pass->_technique && pass->_technique->_material); |
| 53 | auto* technique = pass->_technique; |
| 54 | auto* material = technique->_material; |
| 55 | auto& pipelineDescriptor = command->getPipelineDescriptor(); |
| 56 | |
| 57 | // need reset all state |
| 58 | // pipelineDescriptor.blendDescriptor.blendEnabled = true; |
| 59 | |
| 60 | // Get the combined modified state bits for our RenderState hierarchy. |
| 61 | int32_t overrideBits = _state._modifiedBits; |
| 62 | overrideBits |= technique->getStateBlock()._modifiedBits; |
| 63 | overrideBits |= material->getStateBlock()._modifiedBits; |
| 64 | |
| 65 | // Restore renderer state to its default, except for explicitly specified states |
| 66 | RenderState::StateBlock::restoreUnmodifiedStates(overrideBits, &pipelineDescriptor); |
| 67 | |
| 68 | material->getStateBlock().apply(&pipelineDescriptor); |
| 69 | technique->getStateBlock().apply(&pipelineDescriptor); |
| 70 | _state.apply(&pipelineDescriptor); |
| 71 | } |
| 72 | |
| 73 | RenderState::StateBlock& RenderState::getStateBlock() const |
| 74 | { |