[08/23] wined3d: Allow viewport to be out-of-bounds if using offscreen target.

Matteo Bruni matteo.mystral at gmail.com
Sun Nov 13 16:40:49 CST 2016


2016-11-13 12:35 GMT-06:00 Andrew Wesie <awesie at gmail.com>:
> Signed-off-by: Andrew Wesie <awesie at gmail.com>
> ---
>  dlls/wined3d/state.c | 42 ++++++++++++++++++++++--------------------
>  1 file changed, 22 insertions(+), 20 deletions(-)
>
> diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
> index cd3763c..ed20e325 100644
> --- a/dlls/wined3d/state.c
> +++ b/dlls/wined3d/state.c
> @@ -4617,26 +4617,6 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
>      struct wined3d_viewport vp = state->viewport;
>      unsigned int width, height;
>
> -    if (target)
> -    {
> -        if (vp.width > target->width)
> -            vp.width = target->width;
> -        if (vp.height > target->height)
> -            vp.height = target->height;
> -
> -        wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height);
> -    }
> -    else if (depth_stencil)
> -    {
> -        width = depth_stencil->width;
> -        height = depth_stencil->height;
> -    }
> -    else
> -    {
> -        FIXME("No attachments draw calls not supported.\n");
> -        return;
> -    }
> -
>      gl_info->gl_ops.gl.p_glDepthRange(vp.min_z, vp.max_z);
>      checkGLcall("glDepthRange");
>      /* Note: GL requires lower left, DirectX supplies upper left. This is
> @@ -4644,7 +4624,29 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
>      if (context->render_offscreen)
>          gl_info->gl_ops.gl.p_glViewport(vp.x, vp.y, vp.width, vp.height);
>      else
> +    {
> +        if (target)
> +        {
> +            if (vp.width > target->width)
> +                vp.width = target->width;
> +            if (vp.height > target->height)
> +                vp.height = target->height;
> +
> +            wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height);
> +        }
> +        else if (depth_stencil)
> +        {
> +            width = depth_stencil->width;
> +            height = depth_stencil->height;
> +        }
> +        else
> +        {
> +            FIXME("No attachments draw calls not supported.\n");
> +            return;
> +        }
> +
>          gl_info->gl_ops.gl.p_glViewport(vp.x, (height - (vp.y + vp.height)), vp.width, vp.height);
> +    }
>      checkGLcall("glViewport");
>  }

You need to make the same change to viewport_miscpart_cc() (you can
blame me for that).

Again, it would be very nice to have a testcase for this. Extending
viewport_test() in d3d9/tests/visual.c and adding similar tests to the
other d3d versions shouldn't be too hard.



More information about the wine-devel mailing list