   Setting a technique
  Hello,one short question: Lets say I want to render many objects (~100) and all objects use the same technique.My current engine design would set the technique again and again for every object. So the render loop would look like this:for all obj in objects   obj.technique->GetPassByIndex(0)->Apply(0);   // set VB, IB etc   device->DrawIndexed(obj.numIndices, 0, 0);My question: Is this ok or is this inefficient? Is it significantly faster if I set the technique once for all objects?   
  I'm in no ways a professional concerning D3D, but I would guess your way of doing this is efficient enough. As long as you just set the technique and don't create any new stuff with D3DXCreate or device->CreateXYZ.I had the same question with Vertex layouts which also have to be specific for every technique(-pass) that use different vertex-packings.Also: If you ever want to have different shaders for meshes in your engine there is no way of doing it differently than you do afaik.   ;  Actually, you can save a lot of CPU time by not Apply():ing redundantly.You could apply the technique once:objects[0].technique->GetPassByIndex(0)->Apply(0);for all obj in objects   // set VB, IB etc   device->DrawIndexed(obj.numIndices, 0, 0);...In addition, if the objects are effectively using the same mesh, you can draw them using instancing to save even more CPU time.The system works optimally when you draw as much as possible with as few device calls as possible. EffectPass::Apply (not the actual name of interface) makes a few of said calls every time you call it.   ;  PIX would let you confirm the number of D3D API calls that are being made by effects when calling Apply() redundantly.  Even if there are no extra D3D calls (seems unlikely) - Effects would have to figure out this redundancy.  For the curious, the Effects11 source code is available  with the latest version of the SDK.  You could have a look at what is being done and determine if that suits you.Changing the vertex layout is a moderately expensive thing for the driver to have to do.  Batching calls to reduce ping ponging the pipeline state is always preferable - but can take a lot of dev effort.   ;  I just noticed another thing. I am working with D3D10 and effect files and before I render an object with a technique I set some shader global variables. For example I set the camera:camPos->SetFloatVector( (float*)&vecCamPosition );Is it true that these changes are only applied when I call Apply() for the technique?   