wined3d: Introduce wined3d_rendertarget_view_get_drawable_size() as replacement for surface_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 2016-11-04 13:43:44 +01:00 committed by Alexandre Julliard
parent 4beb9e5922
commit 5cdb8f2486
4 changed files with 23 additions and 10 deletions

View File

@ -291,7 +291,8 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
UINT rect_count, const RECT *clear_rect, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color,
float depth, DWORD stencil)
{
struct wined3d_surface *target = rt_count ? wined3d_rendertarget_view_get_surface(fb->render_targets[0]) : NULL;
struct wined3d_rendertarget_view *rtv = rt_count ? fb->render_targets[0] : NULL;
struct wined3d_surface *target = rtv ? wined3d_rendertarget_view_get_surface(rtv) : NULL;
struct wined3d_rendertarget_view *dsv = fb->depth_stencil;
struct wined3d_surface *depth_stencil = dsv ? wined3d_rendertarget_view_get_surface(dsv) : NULL;
const struct wined3d_state *state = &device->state;
@ -339,7 +340,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
if (target)
{
render_offscreen = context->render_offscreen;
surface_get_drawable_size(target, context, &drawable_width, &drawable_height);
wined3d_rendertarget_view_get_drawable_size(rtv, context, &drawable_width, &drawable_height);
}
else
{

View File

@ -4624,7 +4624,7 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
if (vp.height > target->height)
vp.height = target->height;
surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height);
wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height);
}
else if (depth_stencil)
{
@ -4668,7 +4668,7 @@ static void viewport_miscpart_cc(struct wined3d_context *context,
if (vp.height > target->height)
vp.height = target->height;
surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height);
wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height);
}
else if (depth_stencil)
{
@ -4853,7 +4853,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st
UINT height;
UINT width;
surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height);
wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height);
gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top);
}
checkGLcall("glScissor");

View File

@ -94,10 +94,21 @@ struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const str
return view->resource;
}
void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
unsigned int *width, unsigned int *height)
void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view *view,
const struct wined3d_context *context, unsigned int *width, unsigned int *height)
{
if (surface->container->swapchain)
const struct wined3d_texture *texture;
if (view->resource->type != WINED3D_RTYPE_TEXTURE_2D)
{
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(view->resource->type));
*width = 0;
*height = 0;
return;
}
texture = texture_from_resource(view->resource);
if (texture->swapchain)
{
/* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window

View File

@ -2908,8 +2908,6 @@ HRESULT surface_color_fill(struct wined3d_surface *s,
const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
HRESULT wined3d_surface_create_dc(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void wined3d_surface_destroy_dc(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
struct wined3d_context *context) DECLSPEC_HIDDEN;
HRESULT surface_load_location(struct wined3d_surface *surface,
@ -3226,6 +3224,9 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface(
return texture->sub_resources[view->sub_resource_idx].u.surface;
}
void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view *view,
const struct wined3d_context *context, unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
struct wined3d_shader_resource_view
{
LONG refcount;