Original Post
I'm making a shader rendering routine. and I'm wondering what is the best way for performance. first, I did like this... shader for_each( BeginPass(i) ) DrawPrimitive(); EndPass(i); looks fine but I read that calling "BeginPass/EndPass" in a same shader is redundant and makes app's slow if pass has not been changed. So if rendering object such like mesh has more than two passes, I put the same entity as many as passes in rendering queue and render. So routine looks like below. for( pass ) rederqueue.push_back(entry);//push back same entry. ... shader if( CurrPass != PrevPass ) { // call beginPass() when technique pass is changed. // so it won't be called in same shader and same pass. BeginPass(CurrPass) } DrawPrimitive(); this is what I did until now. I'm not expert about shader thing and this is my first project using shader. so please give me advise. Anything will be fine.^^ thanks.