Signed-off-by: Zebediah Figura z.figura12@gmail.com --- Potentially we could obviate even this, by storing the level and layer count inside the wined3d_resource structure. However, it's not immediately clear to me what's worth taking up memory for.
dlls/wined3d/buffer.c | 23 +++++++++++++++++++ dlls/wined3d/device.c | 40 ++++++---------------------------- dlls/wined3d/texture.c | 9 ++++++++ dlls/wined3d/wined3d_private.h | 8 +++++++ 4 files changed, 47 insertions(+), 33 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 7b8c8904961..142cce0299f 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -840,6 +840,28 @@ struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffe return &buffer->resource; }
+static HRESULT buffer_resource_sub_resource_get_desc(struct wined3d_resource *resource, + unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc) +{ + if (sub_resource_idx) + { + WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); + return E_INVALIDARG; + } + + desc->format = WINED3DFMT_UNKNOWN; + desc->multisample_type = WINED3D_MULTISAMPLE_NONE; + desc->multisample_quality = 0; + desc->usage = resource->usage; + desc->bind_flags = resource->bind_flags; + desc->access = resource->access; + desc->width = resource->size; + desc->height = 1; + desc->depth = 1; + desc->size = resource->size; + return S_OK; +} + static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags) { @@ -1105,6 +1127,7 @@ static const struct wined3d_resource_ops buffer_resource_ops = buffer_resource_decref, buffer_resource_preload, buffer_resource_unload, + buffer_resource_sub_resource_get_desc, buffer_resource_sub_resource_map, buffer_resource_sub_resource_unmap, }; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index a11f137729f..6d749269c18 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4649,7 +4649,7 @@ void CDECL wined3d_device_context_update_sub_resource(struct wined3d_device_cont struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int depth_pitch, unsigned int flags) { - unsigned int width, height, depth; + struct wined3d_sub_resource_desc desc; struct wined3d_box b;
TRACE("context %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u, flags %#x.\n", @@ -4664,43 +4664,17 @@ void CDECL wined3d_device_context_update_sub_resource(struct wined3d_device_cont return; }
- if (resource->type == WINED3D_RTYPE_BUFFER) - { - if (sub_resource_idx > 0) - { - WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); - return; - } - - width = resource->size; - height = 1; - depth = 1; - } - else - { - struct wined3d_texture *texture = texture_from_resource(resource); - unsigned int level; - - if (sub_resource_idx >= texture->level_count * texture->layer_count) - { - WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); - return; - } - - level = sub_resource_idx % texture->level_count; - width = wined3d_texture_get_level_width(texture, level); - height = wined3d_texture_get_level_height(texture, level); - depth = wined3d_texture_get_level_depth(texture, level); - } + if (FAILED(wined3d_resource_get_sub_resource_desc(resource, sub_resource_idx, &desc))) + return;
if (!box) { - wined3d_box_set(&b, 0, 0, width, height, 0, depth); + wined3d_box_set(&b, 0, 0, desc.width, desc.height, 0, desc.depth); box = &b; } - else if (box->left >= box->right || box->right > width - || box->top >= box->bottom || box->bottom > height - || box->front >= box->back || box->back > depth) + else if (box->left >= box->right || box->right > desc.width + || box->top >= box->bottom || box->bottom > desc.height + || box->front >= box->back || box->back > desc.depth) { WARN("Invalid box %s specified.\n", debug_box(box)); return; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 165d83eb035..5f02bcfed8f 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3506,6 +3506,14 @@ static void texture_resource_unload(struct wined3d_resource *resource) resource_unload(&texture->resource); }
+static HRESULT texture_resource_sub_resource_get_desc(struct wined3d_resource *resource, + unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc) +{ + const struct wined3d_texture *texture = texture_from_resource(resource); + + return wined3d_texture_get_sub_resource_desc(texture, sub_resource_idx, desc); +} + static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags) { @@ -3692,6 +3700,7 @@ static const struct wined3d_resource_ops texture_resource_ops = texture_resource_decref, texture_resource_preload, texture_resource_unload, + texture_resource_sub_resource_get_desc, texture_resource_sub_resource_map, texture_resource_sub_resource_unmap, }; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index da1cf638606..15b028a00f0 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4050,6 +4050,8 @@ struct wined3d_resource_ops ULONG (*resource_decref)(struct wined3d_resource *resource); void (*resource_preload)(struct wined3d_resource *resource); void (*resource_unload)(struct wined3d_resource *resource); + HRESULT (*resource_sub_resource_get_desc)(struct wined3d_resource *resource, + unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc); HRESULT (*resource_sub_resource_map)(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); HRESULT (*resource_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx); @@ -4110,6 +4112,12 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource) InterlockedDecrement(&resource->access_count); }
+static inline HRESULT wined3d_resource_get_sub_resource_desc(struct wined3d_resource *resource, + unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc) +{ + return resource->resource_ops->resource_sub_resource_get_desc(resource, sub_resource_idx, desc); +} + void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format,
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/buffer.c | 17 ++--------------- dlls/wined3d/device.c | 12 ++++++++++++ dlls/wined3d/texture.c | 39 ++++++++++++++------------------------- 3 files changed, 28 insertions(+), 40 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 142cce0299f..20057b4127f 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -875,21 +875,8 @@ static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resourc TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n", resource, sub_resource_idx, map_desc, debug_box(box), flags);
- if (sub_resource_idx) - { - WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); - return E_INVALIDARG; - } - - if (box) - { - offset = box->left; - size = box->right - box->left; - } - else - { - offset = size = 0; - } + offset = box->left; + size = box->right - box->left;
map_desc->row_pitch = map_desc->slice_pitch = resource->size;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 6d749269c18..55407516446 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4834,6 +4834,9 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) { + struct wined3d_sub_resource_desc desc; + struct wined3d_box b; + TRACE("context %p, resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n", context, resource, sub_resource_idx, map_desc, debug_box(box), flags);
@@ -4857,6 +4860,15 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context,
flags = sanitise_map_flags(resource, flags);
+ if (FAILED(wined3d_resource_get_sub_resource_desc(resource, sub_resource_idx, &desc))) + return E_INVALIDARG; + + if (!box) + { + wined3d_box_set(&b, 0, 0, desc.width, desc.height, 0, desc.depth); + box = &b; + } + return context->ops->map(context, resource, sub_resource_idx, map_desc, box, flags); }
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 5f02bcfed8f..c09a9f619ac 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3532,11 +3532,10 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour resource, sub_resource_idx, map_desc, debug_box(box), flags);
texture = texture_from_resource(resource); - if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx))) - return E_INVALIDARG; + sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx);
texture_level = sub_resource_idx % texture->level_count; - if (box && FAILED(wined3d_texture_check_box_dimensions(texture, texture_level, box))) + if (FAILED(wined3d_texture_check_box_dimensions(texture, texture_level, box))) { WARN("Map box is invalid.\n"); if (((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && !(resource->access & WINED3D_RESOURCE_ACCESS_CPU)) @@ -3605,38 +3604,28 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour wined3d_texture_get_pitch(texture, texture_level, &map_desc->row_pitch, &map_desc->slice_pitch); }
- if (!box) + if ((fmt_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS) { - map_desc->data = base_memory; + /* Compressed textures are block based, so calculate the offset of + * the block that contains the top-left pixel of the mapped box. */ + map_desc->data = base_memory + + (box->front * map_desc->slice_pitch) + + ((box->top / format->block_height) * map_desc->row_pitch) + + ((box->left / format->block_width) * format->block_byte_count); } else { - if ((fmt_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS) - { - /* Compressed textures are block based, so calculate the offset of - * the block that contains the top-left pixel of the mapped box. */ - map_desc->data = base_memory - + (box->front * map_desc->slice_pitch) - + ((box->top / format->block_height) * map_desc->row_pitch) - + ((box->left / format->block_width) * format->block_byte_count); - } - else - { - map_desc->data = base_memory - + (box->front * map_desc->slice_pitch) - + (box->top * map_desc->row_pitch) - + (box->left * format->byte_count); - } + map_desc->data = base_memory + + (box->front * map_desc->slice_pitch) + + (box->top * map_desc->row_pitch) + + (box->left * format->byte_count); }
if (texture->swapchain && texture->swapchain->front_buffer == texture) { RECT *r = &texture->swapchain->front_buffer_update;
- if (!box) - SetRect(r, 0, 0, resource->width, resource->height); - else - SetRect(r, box->left, box->top, box->right, box->bottom); + SetRect(r, box->left, box->top, box->right, box->bottom); TRACE("Mapped front buffer %s.\n", wine_dbgstr_rect(r)); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/buffer.c | 19 ++++++++----- dlls/wined3d/cs.c | 18 ++++++------ dlls/wined3d/device.c | 6 +++- dlls/wined3d/texture.c | 50 ++++++++++++++++++++-------------- dlls/wined3d/wined3d_private.h | 13 +++++++-- 5 files changed, 65 insertions(+), 41 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 20057b4127f..00d219a49f2 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -862,8 +862,14 @@ static HRESULT buffer_resource_sub_resource_get_desc(struct wined3d_resource *re return S_OK; }
+static void buffer_resource_sub_resource_get_map_pitch(struct wined3d_resource *resource, + unsigned int sub_resource_idx, unsigned int *row_pitch, unsigned int *slice_pitch) +{ + *row_pitch = *slice_pitch = resource->size; +} + static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, - struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags) + void **map_ptr, const struct wined3d_box *box, uint32_t flags) { struct wined3d_buffer *buffer = buffer_from_resource(resource); struct wined3d_device *device = resource->device; @@ -872,14 +878,12 @@ static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resourc uint8_t *base; LONG count;
- TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n", - resource, sub_resource_idx, map_desc, debug_box(box), flags); + TRACE("resource %p, sub_resource_idx %u, map_ptr %p, box %s, flags %#x.\n", + resource, sub_resource_idx, map_ptr, debug_box(box), flags);
offset = box->left; size = box->right - box->left;
- map_desc->row_pitch = map_desc->slice_pitch = resource->size; - count = ++resource->map_count;
if (buffer->buffer_object) @@ -965,9 +969,9 @@ static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resourc }
base = buffer->map_ptr ? buffer->map_ptr : resource->heap_memory; - map_desc->data = base + offset; + *map_ptr = base + offset;
- TRACE("Returning memory at %p (base %p, offset %u).\n", map_desc->data, base, offset); + TRACE("Returning memory at %p (base %p, offset %u).\n", *map_ptr, base, offset);
return WINED3D_OK; } @@ -1115,6 +1119,7 @@ static const struct wined3d_resource_ops buffer_resource_ops = buffer_resource_preload, buffer_resource_unload, buffer_resource_sub_resource_get_desc, + buffer_resource_sub_resource_get_map_pitch, buffer_resource_sub_resource_map, buffer_resource_sub_resource_unmap, }; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 544b76534d0..ad393c203c4 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -455,7 +455,7 @@ struct wined3d_cs_map enum wined3d_cs_op opcode; struct wined3d_resource *resource; unsigned int sub_resource_idx; - struct wined3d_map_desc *map_desc; + void **map_ptr; const struct wined3d_box *box; DWORD flags; HRESULT *hr; @@ -2402,12 +2402,11 @@ static void wined3d_cs_exec_map(struct wined3d_cs *cs, const void *data) struct wined3d_resource *resource = op->resource;
*op->hr = resource->resource_ops->resource_sub_resource_map(resource, - op->sub_resource_idx, op->map_desc, op->box, op->flags); + op->sub_resource_idx, op->map_ptr, op->box, op->flags); }
static HRESULT wined3d_cs_map(struct wined3d_device_context *context, struct wined3d_resource *resource, - unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, - unsigned int flags) + unsigned int sub_resource_idx, void **map_ptr, const struct wined3d_box *box, unsigned int flags) { struct wined3d_cs *cs = wined3d_cs_from_context(context); struct wined3d_cs_map *op; @@ -2423,7 +2422,7 @@ static HRESULT wined3d_cs_map(struct wined3d_device_context *context, struct win op->opcode = WINED3D_CS_OP_MAP; op->resource = resource; op->sub_resource_idx = sub_resource_idx; - op->map_desc = map_desc; + op->map_ptr = map_ptr; op->box = box; op->flags = flags; op->hr = &hr; @@ -3357,12 +3356,11 @@ static void wined3d_deferred_context_push_constants(struct wined3d_device_contex FIXME("context %p, p %#x, start_idx %u, count %u, constants %p, stub!\n", context, p, start_idx, count, constants); }
-static HRESULT wined3d_deferred_context_map(struct wined3d_device_context *context, - struct wined3d_resource *resource, unsigned int sub_resource_idx, - struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) +static HRESULT wined3d_deferred_context_map(struct wined3d_device_context *context, struct wined3d_resource *resource, + unsigned int sub_resource_idx, void **map_ptr, const struct wined3d_box *box, unsigned int flags) { - FIXME("context %p, resource %p, sub_resource_idx %u, map_desc %p, box %p, flags %#x, stub!\n", - context, resource, sub_resource_idx, map_desc, box, flags); + FIXME("context %p, resource %p, sub_resource_idx %u, map_ptr %p, box %p, flags %#x, stub!\n", + context, resource, sub_resource_idx, map_ptr, box, flags); return E_NOTIMPL; }
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 55407516446..2af705b10e3 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4836,6 +4836,7 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context, { struct wined3d_sub_resource_desc desc; struct wined3d_box b; + HRESULT hr;
TRACE("context %p, resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n", context, resource, sub_resource_idx, map_desc, debug_box(box), flags); @@ -4869,7 +4870,10 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context, box = &b; }
- return context->ops->map(context, resource, sub_resource_idx, map_desc, box, flags); + if (SUCCEEDED(hr = context->ops->map(context, resource, sub_resource_idx, &map_desc->data, box, flags))) + wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, + &map_desc->row_pitch, &map_desc->slice_pitch); + return hr; }
HRESULT CDECL wined3d_device_context_unmap(struct wined3d_device_context *context, diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index c09a9f619ac..5876f580e0d 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3514,13 +3514,31 @@ static HRESULT texture_resource_sub_resource_get_desc(struct wined3d_resource *r return wined3d_texture_get_sub_resource_desc(texture, sub_resource_idx, desc); }
+static void texture_resource_sub_resource_get_map_pitch(struct wined3d_resource *resource, + unsigned int sub_resource_idx, unsigned int *row_pitch, unsigned int *slice_pitch) +{ + const struct wined3d_texture *texture = texture_from_resource(resource); + unsigned int level = sub_resource_idx % texture->level_count; + + if (resource->format_flags & WINED3DFMT_FLAG_BROKEN_PITCH) + { + *row_pitch = wined3d_texture_get_level_width(texture, level) * resource->format->byte_count; + *slice_pitch = wined3d_texture_get_level_height(texture, level) * (*row_pitch); + } + else + { + wined3d_texture_get_pitch(texture, level, row_pitch, slice_pitch); + } +} + static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, - struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags) + void **map_ptr, const struct wined3d_box *box, DWORD flags) { const struct wined3d_format *format = resource->format; struct wined3d_texture_sub_resource *sub_resource; struct wined3d_device *device = resource->device; unsigned int fmt_flags = resource->format_flags; + unsigned int row_pitch, slice_pitch; struct wined3d_context *context; struct wined3d_texture *texture; struct wined3d_bo_address data; @@ -3528,8 +3546,8 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour BYTE *base_memory; BOOL ret;
- TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n", - resource, sub_resource_idx, map_desc, debug_box(box), flags); + TRACE("resource %p, sub_resource_idx %u, map_ptr %p, box %s, flags %#x.\n", + resource, sub_resource_idx, map_ptr, debug_box(box), flags);
texture = texture_from_resource(resource); sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx); @@ -3594,30 +3612,22 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
context_release(context);
- if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH) - { - map_desc->row_pitch = wined3d_texture_get_level_width(texture, texture_level) * format->byte_count; - map_desc->slice_pitch = wined3d_texture_get_level_height(texture, texture_level) * map_desc->row_pitch; - } - else - { - wined3d_texture_get_pitch(texture, texture_level, &map_desc->row_pitch, &map_desc->slice_pitch); - } + texture_resource_sub_resource_get_map_pitch(resource, sub_resource_idx, &row_pitch, &slice_pitch);
if ((fmt_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS) { /* Compressed textures are block based, so calculate the offset of * the block that contains the top-left pixel of the mapped box. */ - map_desc->data = base_memory - + (box->front * map_desc->slice_pitch) - + ((box->top / format->block_height) * map_desc->row_pitch) + *map_ptr = base_memory + + (box->front * slice_pitch) + + ((box->top / format->block_height) * row_pitch) + ((box->left / format->block_width) * format->block_byte_count); } else { - map_desc->data = base_memory - + (box->front * map_desc->slice_pitch) - + (box->top * map_desc->row_pitch) + *map_ptr = base_memory + + (box->front * slice_pitch) + + (box->top * row_pitch) + (box->left * format->byte_count); }
@@ -3632,8 +3642,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour ++resource->map_count; ++sub_resource->map_count;
- TRACE("Returning memory %p, row pitch %u, slice pitch %u.\n", - map_desc->data, map_desc->row_pitch, map_desc->slice_pitch); + TRACE("Returning memory %p.\n", *map_ptr);
return WINED3D_OK; } @@ -3690,6 +3699,7 @@ static const struct wined3d_resource_ops texture_resource_ops = texture_resource_preload, texture_resource_unload, texture_resource_sub_resource_get_desc, + texture_resource_sub_resource_get_map_pitch, texture_resource_sub_resource_map, texture_resource_sub_resource_unmap, }; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 15b028a00f0..84dad38f0c9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4052,8 +4052,10 @@ struct wined3d_resource_ops void (*resource_unload)(struct wined3d_resource *resource); HRESULT (*resource_sub_resource_get_desc)(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc); + void (*resource_sub_resource_get_map_pitch)(struct wined3d_resource *resource, + unsigned int sub_resource_idx, unsigned int *row_pitch, unsigned int *slice_pitch); HRESULT (*resource_sub_resource_map)(struct wined3d_resource *resource, unsigned int sub_resource_idx, - struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); + void **map_ptr, const struct wined3d_box *box, DWORD flags); HRESULT (*resource_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx); };
@@ -4118,6 +4120,12 @@ static inline HRESULT wined3d_resource_get_sub_resource_desc(struct wined3d_reso return resource->resource_ops->resource_sub_resource_get_desc(resource, sub_resource_idx, desc); }
+static inline void wined3d_resource_get_sub_resource_map_pitch(struct wined3d_resource *resource, + unsigned int sub_resource_idx, unsigned int *row_pitch, unsigned int *slice_pitch) +{ + resource->resource_ops->resource_sub_resource_get_map_pitch(resource, sub_resource_idx, row_pitch, slice_pitch); +} + void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format, @@ -4693,8 +4701,7 @@ struct wined3d_device_context_ops void (*push_constants)(struct wined3d_device_context *context, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants); HRESULT (*map)(struct wined3d_device_context *context, struct wined3d_resource *resource, - unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, - unsigned int flags); + unsigned int sub_resource_idx, void **map_ptr, const struct wined3d_box *box, unsigned int flags); HRESULT (*unmap)(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx); void (*update_sub_resource)(struct wined3d_device_context *context, struct wined3d_resource *resource,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com