Jump to content

  • Log In with Google      Sign In   
  • Create Account


dreijer

Member Since 25 Nov 2009
Offline Last Active Apr 22 2013 07:23 AM
-----

Posts I've Made

In Topic: Deferred contexts and inheriting state from the immediate context

25 October 2012 - 06:45 PM

Haha, I've been reading the docs up and down -- even sideways -- and I still missed this. I'm glad somebody else knows how to read. Posted Image I guess what threw me off is that the paragraph you linked is missing from ExecuteCommandList(), which is where it's most relevant, in my opinion.

In Topic: State blocks in DX10

24 February 2012 - 11:55 PM

In case others are interested, I stumbled upon an interface called ID3D10StateBlock, which presumably does exactly what I want.

In Topic: State blocks in DX10

24 February 2012 - 03:47 PM

I haven't benchmarked the use of such a Get call, but I would expect that all you're doing is getting a handle to the object from the runtime (rather than reading back data from the GPU) so it should be OK.


Right, I haven't benchmarked them either so they might just be really simple wrappers and pretty cheap to call each frame. I just didn't think of going down that road since I know OpenGL's GetXX() functions are really slow and not recommended to call on a per-frame basis (although I know the DIrectX API is fundamentally different :),

With D3D11 I'd create a deferred context, record my stuff in a command list, then play it back and destroy the context. FinishCommandList can be told to save and restore the previous states for you, so you won't need to worry about any of that.


That's really cool. That's exactly what I was looking for. I need to read up on deferred contexts, but ideally I'd be able to create the context once and reuse each frame.

In Topic: State blocks in DX10

24 February 2012 - 12:20 PM

to set the state back to the default, you can just pass NULL as the parameter. the application should set the state to whatever it needs before it draws it's stuff though. it's possible it set the state during initialization time, so that when you change the state, it never goes back to the state that was set in the initialization of the scene.


That's pretty much the core problem. Having done this for quite a bunch of Direct3D 9 games, I know for a fact that some games only set their state initially rather than on a per-frame basis, and thus modifying the state so that I can render my stuff will mess up the game itself. One thing I've learned when interacting with games is that you can never expect game developers to Do The Right Thing ™ in code and you always have to consider the worst case scenario.

It's therefore really important that I'm able to set back the game's render state after I'm done rendering my things. So, there's no way to do this automatically for DX10 like I can do in DX9 with state blocks?

The only solution, then, would be to hook all the state functions that I change, such that I know what value to set back once I'm done rendering. That's a bunch of work though...

In Topic: State blocks in DX10

24 February 2012 - 11:28 AM

Well, so the problem here is that I don't actually set the initial render state myself. I'm essentially doing an overlay over the Direct3D application, which means I'm piggy backing off of the application's existing render state (i.e. whatever the application had already set) and I want to make sure that when I'm done rendering, the state is set back to what it was before I did my thing,

PARTNERS