[PATCH 1/2] wined3d: Store stencil reference value in wined3d_state.

Jan Sikorski jsikorski at codeweavers.com
Wed Feb 3 06:00:30 CST 2021


> On 3 Feb 2021, at 12:14, Henri Verbeet <hverbeet at gmail.com> wrote:
> 
> On Wed, 3 Feb 2021 at 11:00, Jan Sikorski <jsikorski at codeweavers.com> wrote:
>>     wined3d_mutex_lock();
>> -    device->stencil_ref = stencil_ref;
>>     if (!(state_impl = unsafe_impl_from_ID3D11DepthStencilState(depth_stencil_state)))
>>     {
>> -        wined3d_device_set_depth_stencil_state(device->wined3d_device, NULL);
>> +        wined3d_device_set_depth_stencil_state(device->wined3d_device, NULL, 0);
>>         wined3d_mutex_unlock();
>>         return;
>>     }
> This changes behaviour, although only slightly. Should we pass
> "stencil_ref" to wined3d_device_set_depth_stencil_state() above?

I can’t tell from the spec, but possibly yes. Since the stencil test is disabled in this case I think it only changes what is returned by OMGetDepthStencilState. I’ll change it so that it stays as is.

>> static void wined3d_cs_exec_set_depth_stencil_state(struct wined3d_cs *cs, const void *data)
>> {
>>     const struct wined3d_cs_set_depth_stencil_state *op = data;
>> +    struct wined3d_state *state = &cs->state;
>> 
>> -    cs->state.depth_stencil_state = op->state;
>> -    device_invalidate_state(cs->device, STATE_DEPTH_STENCIL);
>> +    if (state->depth_stencil_state != op->state) {
> The brace should go on its own line.
> 
>> -#define STATE_COMPUTE_OFFSET (STATE_DEPTH_STENCIL + 1)
>> +#define STATE_STENCIL_REF (STATE_DEPTH_STENCIL + 1)
>> +#define STATE_IS_SAMPLE_REF(a) ((a) == STATE_STENCIL_REF)
>> +
> I think you meant "STATE_IS_STENCIL_REF" here. Note that the
> STATE_IS_* macros are supposed to be used by debug_d3dstate(). It
> looks like STATE_SAMPLE_MASK and STATE_DEPTH_STENCIL handling is also
> missing there.

Thanks for catching.

- Janek


More information about the wine-devel mailing list