Updating Render Targets

If I have several render target textures which need to be updated every frame before the main update, which method is preferred:

first method (one BeginScene/EndScene pair for entire scene):
BeginScene

for each render target
  SetRenderTarget
  Update(target)

SetRenderTarget
Update(main)

EndScene

second method (one BeginScene/EndScene pair per render target):
for each render target
  SetRenderTarget
  BeginScene
  Update(target)
  EndScene

SetRenderTarget
BeginScene
Update(main)
EndScene

perhaps it
makes no real difference thanks for any help.



Answer this question

Updating Render Targets

  • Zachary

    The whole BeginScene/EndScene thing is very confusing, and the advice has changed over the years. In practice, most graphics cards totally ignore them! You should probably use as few BS/ES calls as possible, i.e. your first option.

  • browerjs

    I'm a little confused, but I'll offer general guidance, then you can follow up with more questions if necessary:

    1) Time-based updating and rendering should be done separately, with rendering being the last thing you do in any kind of frame loop
    2) BeginScene/Endscene pairs should be kept to an absolute minimum, preferably just one (there's some situations where you might want two).

  • Gerdes

    Thanks Tom.  Exactly the reason i posted - the whole issue seems quite muddled, and one can never get a definitive answer as to exactly what these two calls do.  I've read recently that EndScene tells the hw that i'm finished updating the current render target - hence my second proposed method.  In practice, i have noticed that too many BS/ES pairs can impact performance, so i'm sticking with my first method.

  • Updating Render Targets