Commit 639dd9b9 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Return a wined3d_texture_sub_resource structure from wined3d_texture_get_sub_resource().

parent 4f364870
......@@ -4036,9 +4036,10 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch,
unsigned int depth_pitch)
{
struct wined3d_resource *sub_resource;
struct wined3d_texture_sub_resource *sub_resource;
const struct wined3d_gl_info *gl_info;
struct wined3d_const_bo_address addr;
unsigned int width, height, level;
struct wined3d_context *context;
struct wined3d_texture *texture;
struct wined3d_surface *surface;
......@@ -4077,14 +4078,18 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
return;
}
surface = surface_from_resource(sub_resource);
surface = sub_resource->u.surface;
level = sub_resource_idx % texture->level_count;
width = wined3d_texture_get_level_width(texture, level);
height = wined3d_texture_get_level_height(texture, level);
src_rect.left = 0;
src_rect.top = 0;
if (box)
{
if (box->left >= box->right || box->right > sub_resource->width
|| box->top >= box->bottom || box->bottom > sub_resource->height
if (box->left >= box->right || box->right > width
|| box->top >= box->bottom || box->bottom > height
|| box->front >= box->back)
{
WARN("Invalid box %s specified.\n", debug_box(box));
......@@ -4098,8 +4103,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
}
else
{
src_rect.right = sub_resource->width;
src_rect.bottom = sub_resource->height;
src_rect.right = width;
src_rect.bottom = height;
dst_point.x = 0;
dst_point.y = 0;
}
......@@ -4111,8 +4116,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
gl_info = context->gl_info;
/* Only load the surface for partial updates. */
if (!dst_point.x && !dst_point.y && src_rect.right == sub_resource->width
&& src_rect.bottom == sub_resource->height)
if (!dst_point.x && !dst_point.y && src_rect.right == width && src_rect.bottom == height)
wined3d_texture_prepare_texture(texture, context, FALSE);
else
surface_load_location(surface, context, WINED3D_LOCATION_TEXTURE_RGB);
......
......@@ -2528,8 +2528,8 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_texture_get_sub_resource(const struct wined3d_texture *texture,
UINT sub_resource_idx) DECLSPEC_HIDDEN;
struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;
void wined3d_texture_load(struct wined3d_texture *texture,
......
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