Makes sense - reapplying the stateblock causes the states to be written back to the same stateblock *and* GL state to be applied. What we want is the states to be applied without being written back to the same stateblock.

You can add if(capturing) write_to_update_stateblock(); else apply_states(); in device.c code to patch up the problem - it's done in some places, but not everywhere. However, what this is really showing is that the design doesn't make sense. Stateblock management should never have been mixed with applying GL states - all the GL code needs to be moved out of device.c and somewhere else. Hopefully Stefan D.'s work is heading in that direction.

Ivan
message for the wined3d folks...
running the d3d tests under valgrind gives this list of calls of memcpy with overlapping buffers, which could give bad results (depending how the buffers overlap) is this a side effect of the tests, a harmless warning or something to be fixed ?

A+
==10159== Source and destination overlap in memcpy(0x1BD2F0, 0x1BD2F0, 16)
==10159==    at 0x401C663: memcpy (mc_replace_strmem.c:116)
==10159== by 0x692FA93: IWineD3DDeviceImpl_SetVertexShaderConstantF (device.c:4856) ==10159== by 0x695A76D: IWineD3DStateBlockImpl_Apply (stateblock.c:645)
==10159==    by 0x6939655: device_reapply_stateblock (device.c:7184)
==10159== by 0x6939E62: IWineD3DDeviceImpl_ActiveRender (device.c:7399) ==10159== by 0x6939075: IWineD3DDeviceImpl_SetRenderTarget (device.c:7034) ==10159== by 0x68DECFD: IDirect3DDevice9Impl_SetRenderTarget (device.c:391)
==10159==    by 0x45A275E: switch_render_target (stateblock.c:291)
==10159==    by 0x45A1EA8: execute_test_chain (stateblock.c:180)
==10159==    by 0x45A2F3D: execute_test_chain_all (stateblock.c:467)
==10159==    by 0x45A5BEE: test_state_management (stateblock.c:1446)
==10159==    by 0x45A5C97: func_stateblock (stateblock.c:1466)
==10159==
==10159== Source and destination overlap in memcpy(0x1B22F8, 0x1B22F8, 16)
==10159==    at 0x401C663: memcpy (mc_replace_strmem.c:116)
==10159== by 0x692F7E0: IWineD3DDeviceImpl_SetVertexShaderConstantI (device.c:4809) ==10159== by 0x695A7C5: IWineD3DStateBlockImpl_Apply (stateblock.c:650)
==10159==    by 0x6939655: device_reapply_stateblock (device.c:7184)
==10159== by 0x6939E62: IWineD3DDeviceImpl_ActiveRender (device.c:7399) ==10159== by 0x6939075: IWineD3DDeviceImpl_SetRenderTarget (device.c:7034) ==10159== by 0x68DECFD: IDirect3DDevice9Impl_SetRenderTarget (device.c:391)
==10159==    by 0x45A275E: switch_render_target (stateblock.c:291)
==10159==    by 0x45A1EA8: execute_test_chain (stateblock.c:180)
==10159==    by 0x45A2F3D: execute_test_chain_all (stateblock.c:467)
==10159==    by 0x45A5BEE: test_state_management (stateblock.c:1446)
==10159==    by 0x45A5C97: func_stateblock (stateblock.c:1466)
==10159==
==10159== Source and destination overlap in memcpy(0x1B22B8, 0x1B22B8, 4)
==10159==    at 0x401C663: memcpy (mc_replace_strmem.c:116)
==10159== by 0x692F55E: IWineD3DDeviceImpl_SetVertexShaderConstantB (device.c:4763) ==10159== by 0x695A81D: IWineD3DStateBlockImpl_Apply (stateblock.c:655)
==10159==    by 0x6939655: device_reapply_stateblock (device.c:7184)
==10159== by 0x6939E62: IWineD3DDeviceImpl_ActiveRender (device.c:7399) ==10159== by 0x6939075: IWineD3DDeviceImpl_SetRenderTarget (device.c:7034) ==10159== by 0x68DECFD: IDirect3DDevice9Impl_SetRenderTarget (device.c:391)
==10159==    by 0x45A275E: switch_render_target (stateblock.c:291)
==10159==    by 0x45A1EA8: execute_test_chain (stateblock.c:180)
==10159==    by 0x45A2F3D: execute_test_chain_all (stateblock.c:467)
==10159==    by 0x45A5BEE: test_state_management (stateblock.c:1446)
==10159==    by 0x45A5C97: func_stateblock (stateblock.c:1466)
...
==10159== Source and destination overlap in memcpy(0x1AF808, 0x1AF808, 64)
==10159==    at 0x401C663: memcpy (mc_replace_strmem.c:116)
==10159==    by 0x69580DB: stateblock_savedstates_copy (stateblock.c:83)
==10159== by 0x695B2D5: IWineD3DStateBlockImpl_Apply (stateblock.c:805)
==10159==    by 0x6939655: device_reapply_stateblock (device.c:7184)
==10159== by 0x6939E62: IWineD3DDeviceImpl_ActiveRender (device.c:7399) ==10159== by 0x6939075: IWineD3DDeviceImpl_SetRenderTarget (device.c:7034) ==10159== by 0x68DECFD: IDirect3DDevice9Impl_SetRenderTarget (device.c:391)
==10159==    by 0x45A275E: switch_render_target (stateblock.c:291)
==10159==    by 0x45A1EA8: execute_test_chain (stateblock.c:180)
==10159==    by 0x45A2F3D: execute_test_chain_all (stateblock.c:467)
==10159==    by 0x45A5BEE: test_state_management (stateblock.c:1446)
==10159==    by 0x45A5C97: func_stateblock (stateblock.c:1466)
(similar traceback several times)
...
==10159== Source and destination overlap in memcpy(0x1BA994, 0x1BA994, 24)
==10159==    at 0x401C663: memcpy (mc_replace_strmem.c:116)
==10159==    by 0x6924FD7: IWineD3DDeviceImpl_SetViewport (device.c:3264)
==10159== by 0x695AB20: IWineD3DStateBlockImpl_Apply (stateblock.c:705)
==10159==    by 0x6939655: device_reapply_stateblock (device.c:7184)
==10159== by 0x6939E62: IWineD3DDeviceImpl_ActiveRender (device.c:7399) ==10159== by 0x6939075: IWineD3DDeviceImpl_SetRenderTarget (device.c:7034) ==10159== by 0x68DECFD: IDirect3DDevice9Impl_SetRenderTarget (device.c:391)
==10159==    by 0x45A2849: revert_render_target (stateblock.c:313)
==10159==    by 0x45A1EA8: execute_test_chain (stateblock.c:180)
==10159==    by 0x45A2F3D: execute_test_chain_all (stateblock.c:467)
==10159==    by 0x45A5BEE: test_state_management (stateblock.c:1446)
==10159==    by 0x45A5C97: func_stateblock (stateblock.c:1466)







  • wined3d Eric Pouech
    • Re: wined3d Ivan Gyurdiev

Reply via email to