Commit f2c668e7 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Make the adapter responsible for clearing UAVs.

parent c0143369
......@@ -5073,6 +5073,15 @@ static void adapter_gl_flush_context(struct wined3d_context *context)
context_gl->gl_info->gl_ops.gl.p_glFlush();
}
void adapter_gl_clear_uav(struct wined3d_context *context,
struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value)
{
TRACE("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value));
wined3d_unordered_access_view_gl_clear_uint(wined3d_unordered_access_view_gl(view),
clear_value, wined3d_context_gl(context));
}
static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
{
adapter_gl_destroy,
......@@ -5103,6 +5112,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
adapter_gl_create_query,
adapter_gl_destroy_query,
adapter_gl_flush_context,
adapter_gl_clear_uav,
};
static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_gl, uint32_t wined3d_creation_flags)
......
......@@ -802,6 +802,12 @@ static void adapter_vk_flush_context(struct wined3d_context *context)
TRACE("context %p.\n", context);
}
void adapter_vk_clear_uav(struct wined3d_context *context,
struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value)
{
FIXME("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value));
}
static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
{
adapter_vk_destroy,
......@@ -832,6 +838,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
adapter_vk_create_query,
adapter_vk_destroy_query,
adapter_vk_flush_context,
adapter_vk_clear_uav,
};
static unsigned int wined3d_get_wine_vk_version(void)
......
......@@ -2424,7 +2424,7 @@ static void wined3d_cs_exec_clear_unordered_access_view(struct wined3d_cs *cs, c
struct wined3d_context *context;
context = context_acquire(cs->device, NULL, 0);
wined3d_unordered_access_view_clear_uint(view, &op->clear_value, context);
cs->device->adapter->adapter_ops->adapter_clear_uav(context, view, &op->clear_value);
context_release(context);
wined3d_resource_release(view->resource);
......
......@@ -2607,6 +2607,12 @@ static void adapter_no3d_flush_context(struct wined3d_context *context)
TRACE("context %p.\n", context);
}
void adapter_no3d_clear_uav(struct wined3d_context *context,
struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value)
{
ERR("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value));
}
static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
{
adapter_no3d_destroy,
......@@ -2637,6 +2643,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
adapter_no3d_create_query,
adapter_no3d_destroy_query,
adapter_no3d_flush_context,
adapter_no3d_clear_uav,
};
static void wined3d_adapter_no3d_init_d3d_info(struct wined3d_adapter *adapter, unsigned int wined3d_creation_flags)
......
......@@ -995,17 +995,16 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_
wined3d_view_invalidate_location(view->resource, &view->desc, location);
}
void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_view *view,
const struct wined3d_uvec4 *clear_value, struct wined3d_context *context)
void wined3d_unordered_access_view_gl_clear_uint(struct wined3d_unordered_access_view_gl *view_gl,
const struct wined3d_uvec4 *clear_value, struct wined3d_context_gl *context_gl)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
const struct wined3d_format_gl *format;
struct wined3d_buffer_gl *buffer_gl;
struct wined3d_resource *resource;
unsigned int offset, size;
resource = view->resource;
resource = view_gl->v.resource;
if (resource->type != WINED3D_RTYPE_BUFFER)
{
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
......@@ -1018,7 +1017,7 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi
return;
}
format = wined3d_format_gl(view->format);
format = wined3d_format_gl(view_gl->v.format);
if (format->f.id != WINED3DFMT_R32_UINT && format->f.id != WINED3DFMT_R32_SINT
&& format->f.id != WINED3DFMT_R32G32B32A32_UINT
&& format->f.id != WINED3DFMT_R32G32B32A32_SINT)
......@@ -1028,10 +1027,10 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi
}
buffer_gl = wined3d_buffer_gl(buffer_from_resource(resource));
wined3d_buffer_load_location(&buffer_gl->b, context, WINED3D_LOCATION_BUFFER);
wined3d_unordered_access_view_invalidate_location(view, ~WINED3D_LOCATION_BUFFER);
wined3d_buffer_load_location(&buffer_gl->b, &context_gl->c, WINED3D_LOCATION_BUFFER);
wined3d_unordered_access_view_invalidate_location(&view_gl->v, ~WINED3D_LOCATION_BUFFER);
get_buffer_view_range(&buffer_gl->b, &view->desc, &format->f, &offset, &size);
get_buffer_view_range(&buffer_gl->b, &view_gl->v.desc, &format->f, &offset, &size);
wined3d_context_gl_bind_bo(context_gl, buffer_gl->buffer_type_hint, buffer_gl->b.buffer_object);
GL_EXTCALL(glClearBufferSubData(buffer_gl->buffer_type_hint, format->internal,
offset, size, format->format, format->type, clear_value));
......
......@@ -2851,6 +2851,8 @@ struct wined3d_adapter_ops
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query);
void (*adapter_destroy_query)(struct wined3d_query *query);
void (*adapter_flush_context)(struct wined3d_context *context);
void (*adapter_clear_uav)(struct wined3d_context *context,
struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value);
};
/* The adapter structure */
......@@ -4377,8 +4379,6 @@ struct wined3d_unordered_access_view
};
void wined3d_unordered_access_view_cleanup(struct wined3d_unordered_access_view *view) DECLSPEC_HIDDEN;
void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_view *view,
const struct wined3d_uvec4 *clear_value, struct wined3d_context *context) DECLSPEC_HIDDEN;
void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_view *view,
struct wined3d_buffer *buffer, unsigned int offset, struct wined3d_context *context) DECLSPEC_HIDDEN;
void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_access_view *view,
......@@ -4399,6 +4399,8 @@ static inline struct wined3d_unordered_access_view_gl *wined3d_unordered_access_
return CONTAINING_RECORD(view, struct wined3d_unordered_access_view_gl, v);
}
void wined3d_unordered_access_view_gl_clear_uint(struct wined3d_unordered_access_view_gl *view_gl,
const struct wined3d_uvec4 *clear_value, struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
HRESULT wined3d_unordered_access_view_gl_init(struct wined3d_unordered_access_view_gl *view_gl,
const struct wined3d_view_desc *desc, struct wined3d_resource *resource,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment