[PATCH 4/6] wined3d: Implement compute pipeline UAV binding.
Henri Verbeet
hverbeet at gmail.com
Wed Feb 8 09:05:40 CST 2017
On 8 February 2017 at 11:54, Józef Kucia <jkucia at codeweavers.com> wrote:
> diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
> index 422f3f1..f2e10a8 100644
> --- a/dlls/wined3d/cs.c
> +++ b/dlls/wined3d/cs.c
> @@ -44,6 +44,7 @@ enum wined3d_cs_op
> WINED3D_CS_OP_SET_TEXTURE,
> WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW,
> WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEW,
> + WINED3D_CS_OP_SET_COMPUTE_UAV,
It's a little undesirable to introduce multiple operations that are
largely the same, although I don't necessarily see a good way to avoid
it either right now.
> @@ -1053,6 +1054,35 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con
> device_invalidate_state(cs->device, STATE_UNORDERED_ACCESS_VIEW_BINDING);
> }
>
> +void wined3d_cs_emit_set_compute_unordered_access_view(struct wined3d_cs *cs, unsigned int view_idx,
> + struct wined3d_unordered_access_view *view)
> +{
> + struct wined3d_cs_set_unordered_access_view *op;
> +
> + op = cs->ops->require_space(cs, sizeof(*op));
> + op->opcode = WINED3D_CS_OP_SET_COMPUTE_UAV;
> + op->view_idx = view_idx;
> + op->view = view;
> +
> + cs->ops->submit(cs);
> +}
> +
> +static void wined3d_cs_exec_set_compute_unordered_access_view(struct wined3d_cs *cs, const void *data)
> +{
> + const struct wined3d_cs_set_unordered_access_view *op = data;
> + struct wined3d_unordered_access_view *prev;
> +
> + prev = cs->state.compute_unordered_access_view[op->view_idx];
> + cs->state.compute_unordered_access_view[op->view_idx] = op->view;
> +
> + if (op->view)
> + InterlockedIncrement(&op->view->resource->bind_count);
> + if (prev)
> + InterlockedDecrement(&prev->resource->bind_count);
> +
> + device_invalidate_state(cs->device, STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING);
> +}
I should have noticed this when
WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEW was introduced, but these are
between wined3d_cs_exec_set_shader_resource_view() and
wined3d_cs_emit_set_shader_resource_view(), please don't do that. More
generally, all the other handlers have execution above emission, I
think it's best to stick with that.
More information about the wine-devel
mailing list