[Mesa-dev] [PATCH 1/6] anv: Set viewport extents correctly when height is negative
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Tue Jan 24 18:30:47 UTC 2017
On 24/01/17 17:40, Jason Ekstrand wrote:
> On Tue, Jan 24, 2017 at 12:49 AM, Iago Toral <itoral at igalia.com
> <mailto:itoral at igalia.com>> wrote:
>
> On Mon, 2017-01-23 at 14:12 -0800, Jason Ekstrand wrote:
> > As per VK_KHR_maintenance1, setting a negative height in the
> viewport
> > can be used to get flipped coordinates. This is, aparently, very
> > useful
> > when porting D3D apps to Vulkan. All we need to do to support this
> > is
> > to make sure we actually set the min and max correctly.
> > ---
> > src/intel/vulkan/gen8_cmd_buffer.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/intel/vulkan/gen8_cmd_buffer.c
> > b/src/intel/vulkan/gen8_cmd_buffer.c
> > index f22037b..ab68872 100644
> > --- a/src/intel/vulkan/gen8_cmd_buffer.c
> > +++ b/src/intel/vulkan/gen8_cmd_buffer.c
> > @@ -59,8 +59,8 @@ gen8_cmd_buffer_emit_viewport(struct
> anv_cmd_buffer
> > *cmd_buffer)
> > .YMaxClipGuardband = 1.0f,
> > .XMinViewPort = vp->x,
> > .XMaxViewPort = vp->x + vp->width - 1,
> > - .YMinViewPort = vp->y,
> > - .YMaxViewPort = vp->y + vp->height - 1,
> > + .YMinViewPort = MIN2(vp->y, vp->y + vp->height),
> > + .YMaxViewPort = MAX2(vp->y, vp->y + vp->height) - 1,
> > };
>
> If we have y = 0 and height = -100, shouldn't we use YMinVP = -99 and
> YMaxVP = 0 instead of (-100, -1)?
>
>
> No, I think we still want -100, -1. In the case mentioned, the Y
> region, in floating-point, is [-100, 0]. However, it appears that,
> even though it's float, we're expected to provide max-1 in the max fields.
Thanks for the explanation!
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> > GENX(SF_CLIP_VIEWPORT_pack)(NULL, sf_clip_state.map + i * 64,
>
>
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170124/4202fb91/attachment.html>
More information about the mesa-dev
mailing list