[PATCH v2 3/3] wined3d: Set the entire stream output state as a single CS operation.

Henri Verbeet hverbeet at gmail.com
Wed Jul 7 10:59:26 CDT 2021


On Wed, 7 Jul 2021 at 03:44, Zebediah Figura <zfigura at codeweavers.com> wrote:
> @@ -1181,24 +1181,22 @@ static void STDMETHODCALLTYPE d3d11_device_context_OMSetDepthStencilState(ID3D11
>  static void STDMETHODCALLTYPE d3d11_device_context_SOSetTargets(ID3D11DeviceContext1 *iface, UINT buffer_count,
>          ID3D11Buffer *const *buffers, const UINT *offsets)
>  {
> +    struct wined3d_stream_output outputs[WINED3D_MAX_STREAM_OUTPUT_BUFFERS] = {0};
>      struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface);
> -    unsigned int count, i;
> +    unsigned int i;
>
>      TRACE("iface %p, buffer_count %u, buffers %p, offsets %p.\n", iface, buffer_count, buffers, offsets);
>
> -    count = min(buffer_count, D3D11_SO_BUFFER_SLOT_COUNT);
> -    wined3d_mutex_lock();
> -    for (i = 0; i < count; ++i)
> +    for (i = 0; i < buffer_count; ++i)
>      {
>          struct d3d_buffer *buffer = unsafe_impl_from_ID3D11Buffer(buffers[i]);
>
> -        wined3d_device_context_set_stream_output(context->wined3d_context, i,
> -                buffer ? buffer->wined3d_buffer : NULL, offsets ? offsets[i] : 0);
> -    }
> -    for (; i < D3D11_SO_BUFFER_SLOT_COUNT; ++i)
> -    {
> -        wined3d_device_context_set_stream_output(context->wined3d_context, i, NULL, 0);
> +        outputs[i].buffer = buffer ? buffer->wined3d_buffer : NULL;
> +        outputs[i].offset = offsets ? offsets[i] : 0;
>      }
> +
> +    wined3d_mutex_lock();
> +    wined3d_device_context_set_stream_outputs(context->wined3d_context, outputs);
>      wined3d_mutex_unlock();
>  }
>
Getting rid of the "count = min(buffer_count,
D3D11_SO_BUFFER_SLOT_COUNT);" is a change in behaviour. It may be
correct, but it doesn't belong in this patch.



More information about the wine-devel mailing list