[PATCH v2 2/5] d3d11: Add initial implementation of SwapDeviceContextState.
Rémi Bernon
rbernon at codeweavers.com
Tue Jan 26 10:52:42 CST 2021
On 1/26/21 5:46 PM, Henri Verbeet wrote:
> 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.
>
True, I wrote some tests previously and I think they showed that it's
supposed to be new objects each time, hence the logic. I'll add them in
next patches.
--
Rémi Bernon <rbernon at codeweavers.com>
More information about the wine-devel
mailing list