Allow things like wined3d_format_copy_data() to work on them.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 00d219a49f2..0511f278144 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -849,7 +849,7 @@ static HRESULT buffer_resource_sub_resource_get_desc(struct wined3d_resource *re return E_INVALIDARG; }
- desc->format = WINED3DFMT_UNKNOWN; + desc->format = WINED3DFMT_R8_UNORM; desc->multisample_type = WINED3D_MULTISAMPLE_NONE; desc->multisample_quality = 0; desc->usage = resource->usage; @@ -1156,7 +1156,7 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_buffer_ops *buffer_ops) { - const struct wined3d_format *format = wined3d_get_format(device->adapter, WINED3DFMT_UNKNOWN, desc->bind_flags); + const struct wined3d_format *format = wined3d_get_format(device->adapter, WINED3DFMT_R8_UNORM, desc->bind_flags); struct wined3d_resource *resource = &buffer->resource; HRESULT hr;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/buffer.c | 19 ------------------- dlls/wined3d/cs.c | 15 ++++----------- dlls/wined3d/wined3d_private.h | 2 -- 3 files changed, 4 insertions(+), 32 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 0511f278144..9d22a909fb6 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1054,25 +1054,6 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off context_release(context); }
-void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context, - const struct wined3d_box *box, const void *data) -{ - struct wined3d_range range; - - if (box) - { - range.offset = box->left; - range.size = box->right - box->left; - } - else - { - range.offset = 0; - range.size = buffer->resource.size; - } - - buffer->buffer_ops->buffer_upload_ranges(buffer, context, data, range.offset, 1, &range); -} - static void wined3d_buffer_init_data(struct wined3d_buffer *buffer, struct wined3d_device *device, const struct wined3d_sub_resource_data *data) { diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 4adfa18f5f7..022c0acbd0a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2613,18 +2613,14 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
context = context_acquire(cs->c.device, NULL, 0);
+ addr.buffer_object = 0; + addr.addr = op->data.data; + if (resource->type == WINED3D_RTYPE_BUFFER) { struct wined3d_buffer *buffer = buffer_from_resource(resource);
- if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER)) - { - ERR("Failed to load buffer location.\n"); - goto done; - } - - wined3d_buffer_upload_data(buffer, context, box, op->data.data); - wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER); + wined3d_buffer_copy_bo_address(buffer, context, box->left, &addr, box->right - box->left); goto done; }
@@ -2635,9 +2631,6 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi height = wined3d_texture_get_level_height(texture, level); depth = wined3d_texture_get_level_depth(texture, level);
- addr.buffer_object = 0; - addr.addr = op->data.data; - /* Only load the sub-resource for partial updates. */ if (!box->left && !box->top && !box->front && box->right == width && box->bottom == height && box->back == depth) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 6700302b481..0dba25477cf 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4926,8 +4926,6 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer, struct wined3d_context *context, unsigned int location) DECLSPEC_HIDDEN; -void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context, - const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
HRESULT wined3d_buffer_no3d_init(struct wined3d_buffer *buffer_no3d, struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/cs.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 022c0acbd0a..47bc36d4cc0 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -489,7 +489,8 @@ struct wined3d_cs_update_sub_resource struct wined3d_resource *resource; unsigned int sub_resource_idx; struct wined3d_box box; - struct wined3d_sub_resource_data data; + struct wined3d_const_bo_address addr; + unsigned int row_pitch, slice_pitch; };
struct wined3d_cs_add_dirty_texture_region @@ -2606,21 +2607,17 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi struct wined3d_resource *resource = op->resource; const struct wined3d_box *box = &op->box; unsigned int width, height, depth, level; - struct wined3d_const_bo_address addr; struct wined3d_context *context; struct wined3d_texture *texture; struct wined3d_box src_box;
context = context_acquire(cs->c.device, NULL, 0);
- addr.buffer_object = 0; - addr.addr = op->data.data; - if (resource->type == WINED3D_RTYPE_BUFFER) { struct wined3d_buffer *buffer = buffer_from_resource(resource);
- wined3d_buffer_copy_bo_address(buffer, context, box->left, &addr, box->right - box->left); + wined3d_buffer_copy_bo_address(buffer, context, box->left, &op->addr, box->right - box->left); goto done; }
@@ -2639,8 +2636,8 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi wined3d_texture_load_location(texture, op->sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_box_set(&src_box, 0, 0, box->right - box->left, box->bottom - box->top, 0, box->back - box->front); - texture->texture_ops->texture_upload_data(context, &addr, texture->resource.format, &src_box, - op->data.row_pitch, op->data.slice_pitch, texture, op->sub_resource_idx, + texture->texture_ops->texture_upload_data(context, &op->addr, texture->resource.format, &src_box, + op->row_pitch, op->slice_pitch, texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, box->left, box->top, box->front);
wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); @@ -2665,9 +2662,10 @@ static void wined3d_cs_update_sub_resource(struct wined3d_device_context *contex op->resource = resource; op->sub_resource_idx = sub_resource_idx; op->box = *box; - op->data.row_pitch = row_pitch; - op->data.slice_pitch = slice_pitch; - op->data.data = data; + op->addr.buffer_object = 0; + op->addr.addr = data; + op->row_pitch = row_pitch; + op->slice_pitch = slice_pitch;
wined3d_device_context_acquire_resource(context, resource);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com