wined3d: Avoid accessing "context->current_rt" in wined3d_rendertarget_view_get_drawable_size().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-04-05 15:38:04 +02:00 committed by Alexandre Julliard
parent 44fd37a323
commit c6168a526e
1 changed files with 5 additions and 6 deletions

View File

@ -359,8 +359,8 @@ void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarg
/* The drawable size of an onscreen drawable is the surface size. /* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window * (Actually: The window size, but the surface is created in window
* size.) */ * size.) */
*width = context->current_rt.texture->resource.width; *width = texture->resource.width;
*height = context->current_rt.texture->resource.height; *height = texture->resource.height;
} }
else if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) else if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
{ {
@ -374,13 +374,12 @@ void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarg
} }
else else
{ {
struct wined3d_surface *rt; unsigned int level_idx = view->sub_resource_idx % texture->level_count;
/* The drawable size of an FBO target is the OpenGL texture size, /* The drawable size of an FBO target is the OpenGL texture size,
* which is the power of two size. */ * which is the power of two size. */
rt = context->current_rt.texture->sub_resources[context->current_rt.sub_resource_idx].u.surface; *width = wined3d_texture_get_level_pow2_width(texture, level_idx);
*width = wined3d_texture_get_level_pow2_width(rt->container, rt->texture_level); *height = wined3d_texture_get_level_pow2_height(texture, level_idx);
*height = wined3d_texture_get_level_pow2_height(rt->container, rt->texture_level);
} }
} }