wined3d: Always pass a non-NULL box to context->ops->map().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e275504859
commit
236afee0da
|
@ -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",
|
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);
|
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;
|
offset = box->left;
|
||||||
size = box->right - box->left;
|
size = box->right - box->left;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
offset = size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
map_desc->row_pitch = map_desc->slice_pitch = resource->size;
|
map_desc->row_pitch = map_desc->slice_pitch = resource->size;
|
||||||
|
|
||||||
|
|
|
@ -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_resource *resource, unsigned int sub_resource_idx,
|
||||||
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags)
|
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",
|
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);
|
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);
|
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);
|
return context->ops->map(context, resource, sub_resource_idx, map_desc, box, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
resource, sub_resource_idx, map_desc, debug_box(box), flags);
|
||||||
|
|
||||||
texture = texture_from_resource(resource);
|
texture = texture_from_resource(resource);
|
||||||
if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx)))
|
sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
texture_level = sub_resource_idx % texture->level_count;
|
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");
|
WARN("Map box is invalid.\n");
|
||||||
if (((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && !(resource->access & WINED3D_RESOURCE_ACCESS_CPU))
|
if (((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && !(resource->access & WINED3D_RESOURCE_ACCESS_CPU))
|
||||||
|
@ -3605,12 +3604,6 @@ 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);
|
wined3d_texture_get_pitch(texture, texture_level, &map_desc->row_pitch, &map_desc->slice_pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!box)
|
|
||||||
{
|
|
||||||
map_desc->data = base_memory;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((fmt_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS)
|
if ((fmt_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS)
|
||||||
{
|
{
|
||||||
/* Compressed textures are block based, so calculate the offset of
|
/* Compressed textures are block based, so calculate the offset of
|
||||||
|
@ -3627,15 +3620,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
||||||
+ (box->top * map_desc->row_pitch)
|
+ (box->top * map_desc->row_pitch)
|
||||||
+ (box->left * format->byte_count);
|
+ (box->left * format->byte_count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (texture->swapchain && texture->swapchain->front_buffer == texture)
|
if (texture->swapchain && texture->swapchain->front_buffer == texture)
|
||||||
{
|
{
|
||||||
RECT *r = &texture->swapchain->front_buffer_update;
|
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));
|
TRACE("Mapped front buffer %s.\n", wine_dbgstr_rect(r));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue