diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 14a68b4f3b1..d8073ef52f0 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2257,6 +2257,33 @@ void CDECL wined3d_device_context_set_sampler(struct wined3d_device_context *con wined3d_sampler_decref(prev); } +void CDECL wined3d_device_context_set_unordered_access_view(struct wined3d_device_context *context, + enum wined3d_pipeline pipeline, unsigned int idx, struct wined3d_unordered_access_view *uav, + unsigned int initial_count) +{ + struct wined3d_state *state = context->state; + struct wined3d_unordered_access_view *prev; + + TRACE("context %p, pipeline %#x, idx %u, uav %p, initial_count %u.\n", context, pipeline, idx, uav, initial_count); + + if (idx >= MAX_UNORDERED_ACCESS_VIEWS) + { + WARN("Invalid UAV index %u.\n", idx); + return; + } + + prev = state->unordered_access_view[pipeline][idx]; + if (uav == prev && initial_count == ~0u) + return; + + if (uav) + wined3d_unordered_access_view_incref(uav); + state->unordered_access_view[pipeline][idx] = uav; + wined3d_device_context_emit_set_unordered_access_view(context, pipeline, idx, uav, initial_count); + if (prev) + wined3d_unordered_access_view_decref(prev); +} + void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) { TRACE("device %p, shader %p.\n", device, shader); @@ -2678,31 +2705,6 @@ struct wined3d_sampler * CDECL wined3d_device_get_cs_sampler(const struct wined3 return wined3d_device_get_sampler(device, WINED3D_SHADER_TYPE_COMPUTE, idx); } -static void wined3d_device_set_pipeline_unordered_access_view(struct wined3d_device *device, - enum wined3d_pipeline pipeline, unsigned int idx, struct wined3d_unordered_access_view *uav, - unsigned int initial_count) -{ - struct wined3d_state *state = device->cs->c.state; - struct wined3d_unordered_access_view *prev; - - if (idx >= MAX_UNORDERED_ACCESS_VIEWS) - { - WARN("Invalid UAV index %u.\n", idx); - return; - } - - prev = state->unordered_access_view[pipeline][idx]; - if (uav == prev && initial_count == ~0u) - return; - - if (uav) - wined3d_unordered_access_view_incref(uav); - state->unordered_access_view[pipeline][idx] = uav; - wined3d_device_context_emit_set_unordered_access_view(&device->cs->c, pipeline, idx, uav, initial_count); - if (prev) - wined3d_unordered_access_view_decref(prev); -} - static struct wined3d_unordered_access_view *wined3d_device_get_pipeline_unordered_access_view( const struct wined3d_device *device, enum wined3d_pipeline pipeline, unsigned int idx) { @@ -2720,7 +2722,7 @@ void CDECL wined3d_device_set_cs_uav(struct wined3d_device *device, unsigned int { TRACE("device %p, idx %u, uav %p, initial_count %#x.\n", device, idx, uav, initial_count); - wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_COMPUTE, idx, uav, initial_count); + wined3d_device_context_set_unordered_access_view(&device->cs->c, WINED3D_PIPELINE_COMPUTE, idx, uav, initial_count); } struct wined3d_unordered_access_view * CDECL wined3d_device_get_cs_uav(const struct wined3d_device *device, @@ -2736,7 +2738,7 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic { TRACE("device %p, idx %u, uav %p, initial_count %#x.\n", device, idx, uav, initial_count); - wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_GRAPHICS, idx, uav, initial_count); + wined3d_device_context_set_unordered_access_view(&device->cs->c, WINED3D_PIPELINE_GRAPHICS, idx, uav, initial_count); } struct wined3d_unordered_access_view * CDECL wined3d_device_get_unordered_access_view( diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 7c39295c256..9655c1a65f2 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -174,6 +174,7 @@ @ cdecl wined3d_device_context_set_scissor_rects(ptr long ptr) @ cdecl wined3d_device_context_set_shader(ptr long ptr) @ cdecl wined3d_device_context_set_shader_resource_view(ptr long long ptr) +@ cdecl wined3d_device_context_set_unordered_access_view(ptr long long ptr long) @ cdecl wined3d_device_context_set_viewports(ptr long ptr) @ cdecl wined3d_output_find_closest_matching_mode(ptr ptr) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0b71da8982c..d797b53a5ac 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1730,13 +1730,6 @@ void dispatch_compute(struct wined3d_device *device, const struct wined3d_state #define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \ (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1) -enum wined3d_pipeline -{ - WINED3D_PIPELINE_GRAPHICS, - WINED3D_PIPELINE_COMPUTE, - WINED3D_PIPELINE_COUNT, -}; - /* Routines and structures related to state management */ #define STATE_RENDER(a) (a) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 760e1ebcc80..38b4d8d792d 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -868,6 +868,13 @@ enum wined3d_shader_type WINED3D_SHADER_TYPE_INVALID = WINED3D_SHADER_TYPE_COUNT, }; +enum wined3d_pipeline +{ + WINED3D_PIPELINE_GRAPHICS, + WINED3D_PIPELINE_COMPUTE, + WINED3D_PIPELINE_COUNT, +}; + #define WINED3DCOLORWRITEENABLE_RED (1u << 0) #define WINED3DCOLORWRITEENABLE_GREEN (1u << 1) #define WINED3DCOLORWRITEENABLE_BLUE (1u << 2) @@ -2564,6 +2571,9 @@ void __cdecl wined3d_device_context_set_shader(struct wined3d_device_context *co enum wined3d_shader_type type, struct wined3d_shader *shader); void __cdecl wined3d_device_context_set_shader_resource_view(struct wined3d_device_context *context, enum wined3d_shader_type type, unsigned int idx, struct wined3d_shader_resource_view *view); +void __cdecl wined3d_device_context_set_unordered_access_view(struct wined3d_device_context *context, + enum wined3d_pipeline pipeline, unsigned int idx, struct wined3d_unordered_access_view *uav, + unsigned int initial_count); void __cdecl wined3d_device_context_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count, const struct wined3d_viewport *viewports);