| 29 | const MatStateHint MatStateHint::Default( "Default" ); |
| 30 | |
| 31 | void MatStateHint::init( const ProcessedMaterial *mat ) |
| 32 | { |
| 33 | PROFILE_SCOPE( MatStateHint_init ); |
| 34 | |
| 35 | mState.clear(); |
| 36 | |
| 37 | // Write the material identifier so that we batch by material |
| 38 | // specific data like diffuse color and parallax scale. |
| 39 | // |
| 40 | // NOTE: This doesn't actually cause more draw calls, but it |
| 41 | // can cause some extra unnessasary material setup when materials |
| 42 | // are different by their properties are the same. |
| 43 | // |
| 44 | const Material *material = mat->getMaterial(); |
| 45 | mState += String::ToString( "Material: '%s', %d\n", material->getName(), material->getId() ); |
| 46 | |
| 47 | // Go thru each pass and write its state into |
| 48 | // the string in the most compact but uniquely |
| 49 | // identifiable way. |
| 50 | U32 passes = mat->getNumPasses(); |
| 51 | for ( U32 i=0; i < passes; i++ ) |
| 52 | mState += mat->getPass( i )->describeSelf(); |
| 53 | |
| 54 | // Finally intern the state string for |
| 55 | // fast pointer comparisions. |
| 56 | mState = mState.intern(); |
| 57 | } |
| 58 | |
| 59 | |
| 60 |
nothing calls this directly
no test coverage detected