[PATCH v2 2/5] d3d11: Add initial implementation of SwapDeviceContextState.
Henri Verbeet
hverbeet at gmail.com
Tue Jan 26 10:46:06 CST 2021
On Tue, 26 Jan 2021 at 12:15, Rémi Bernon <rbernon at codeweavers.com> wrote:
> @@ -2672,7 +2678,29 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSGetConstantBuffers1(ID3D
> static void STDMETHODCALLTYPE d3d11_immediate_context_SwapDeviceContextState(ID3D11DeviceContext1 *iface,
> ID3DDeviceContextState *state, ID3DDeviceContextState **prev_state)
> {
> - FIXME("iface %p, state %p, prev_state %p stub!\n", iface, state, prev_state);
> + struct d3d_device_context_state *state_impl;
> + struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface);
> +
> + FIXME("iface %p, state %p, prev_state %p semi-stub!\n", iface, state, prev_state);
> +
> + wined3d_mutex_lock();
> + if (prev_state)
> + {
> + *prev_state = NULL;
> + if ((state_impl = heap_alloc(sizeof(*state_impl))))
> + {
> + d3d_device_context_state_init(state_impl, device, &device->emulated_interface);
> + *prev_state = &state_impl->ID3DDeviceContextState_iface;
> + }
> + }
> +
> + if ((state_impl = impl_from_ID3DDeviceContextState(state)))
> + {
> + device->emulated_interface = state_impl->emulated_interface;
> + if (d3d_device_is_d3d10_active(device))
> + FIXME("D3D10 interface emulation not fully implemented yet!\n");
> + }
> + wined3d_mutex_unlock();
> }
>
I don't think it's worth holding the series for, but shouldn't we
store the device context state object here, instead of creating a new
context state object each time? I.e., suppose you do the following:
ID3DDeviceContextState *a, *b, *prev;
...
SwapDeviceContextState(..., a, &prev);
SwapDeviceContextState(..., b, &prev);
Is "prev" suppose to be equal to "a" at that point? I don't think the
existing tests cover that.
More information about the wine-devel
mailing list