On Monday 08 August 2011 00:26:38 Ričardas Barkauskas wrote:
- hr = wined3d_device_get_texture(This->wined3d_device, stage,
&wined3d_texture); This will cause problems when the application is recording a stateblock. In this case set_texture will apply the texture in the update stateblock and get_texture will return the value from the main stateblock.
I feel kinda sorry for you, but I am afraid fixing this properly will require a lot of work, starting with testing d3d7 stateblock behavior wrt refcounting. In the worst case fixing this might require re-implementing some of the stateblock logic in ddraw.
Also make sure to test SetRenderTarget. In d3d8/9 the render target is not recorded in the stateblock, so there's no issue. d3d7 may be different. Unfortunately we have zero stateblock tests for d3d7.
There's also SetCurrentViewport that addrefs, but IDirect3DDevice3 doesn't support stateblocks, so it is not an issue.
The really crappy thing, and that's where my sorry feeling comes from, is that I haven't seen any application yet that uses d3d7's stateblocks. But I'm afraid if we want to stop the fix one app, regress another app problem we have with ddraw we'll have to do this properly and not hope no app ever runs into this.