[PATCH 2/5] wined3d: Introduce wined3d_rendertarget_view_get_drawable_size() as replacement for surface_get_drawable_size().
Józef Kucia
jkucia at codeweavers.com
Fri Nov 4 07:43:44 CDT 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/device.c | 5 +++--
dlls/wined3d/state.c | 6 +++---
dlls/wined3d/view.c | 17 ++++++++++++++---
dlls/wined3d/wined3d_private.h | 5 +++--
4 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a611531..d7349fcf 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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
{
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 9e36bcd..cd3763c 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -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");
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 1f819e6..a67c506 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -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
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 19b650e..503f7f2 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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;
--
2.7.3
More information about the wine-patches
mailing list