tags:

views:

292

answers:

2

State should include at least the following:

  • All settings set via SetStreamResource()
  • Indices

I have a class whose Draw() function will call SetStreamResource, set Indices and eventually call DrawIndexedPrimitive(). I would like to restore the device state before Draw() returns.

I am looking for something along the lines of GDI's SaveDC()/RestoreDC().

+1  A: 

Looks like these will do it:

Microsoft::DirectX::Direct3D::Device::BeginStateBlock
Microsoft::DirectX::Direct3D::Device::EndStateBlock
Vulcan Eager
+1  A: 

State blocks are the mechanism provided by the API to save and restore chunks of device state. I cover the details of state blocks in Chapter 3. Direct3D Devices from my book The Direct3D Graphics Pipeline. You can download the PDF for that chapter from the link above.

legalize