diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 35bf5218412..4001e6ca2fc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4282,6 +4282,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined3d_device *device, struct wined3d_texture *cursor_image, unsigned int sub_resource_idx) { + unsigned int texture_level = sub_resource_idx % cursor_image->level_count; struct wined3d_sub_resource_data data; struct wined3d_resource_desc desc; struct wined3d_map_desc map_desc; @@ -4304,8 +4305,8 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined desc.multisample_quality = 0; desc.usage = WINED3DUSAGE_DYNAMIC; desc.pool = WINED3D_POOL_DEFAULT; - desc.width = cursor_image->sub_resources[sub_resource_idx].resource->width; - desc.height = cursor_image->sub_resources[sub_resource_idx].resource->height; + desc.width = wined3d_texture_get_level_width(cursor_image, texture_level); + desc.height = wined3d_texture_get_level_height(cursor_image, texture_level); desc.depth = 1; desc.size = 0;