diff options
author | Christoph Bumiller <[email protected]> | 2011-04-17 00:14:31 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-04-17 00:17:14 +0200 |
commit | a582b859f73c06e4fc7d4b17d8aaab9060fb9498 (patch) | |
tree | 5c7c3dc33939f59ddbf1278f3a4b6a6c459d3894 /src | |
parent | 97535699ee610a2f66732609f966102150847d3c (diff) |
nvc0: fix viewport rectangle calculation
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_state_validate.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c index 23a552622e1..9b2a28150b1 100644 --- a/src/gallium/drivers/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c @@ -1,6 +1,7 @@ +#include "util/u_math.h" + #include "nvc0_context.h" -#include "os/os_time.h" static void nvc0_validate_zcull(struct nvc0_context *nvc0) @@ -213,10 +214,11 @@ nvc0_validate_viewport(struct nvc0_context *nvc0) /* now set the viewport rectangle to viewport dimensions for clipping */ - x = (int)(vp->translate[0] - fabsf(vp->scale[0])); - y = (int)(vp->translate[1] - fabsf(vp->scale[1])); - w = (int)fabsf(2.0f * vp->scale[0]); - h = (int)fabsf(2.0f * vp->scale[1]); + x = util_iround(MAX2(0.0f, vp->translate[0] - fabsf(vp->scale[0]))); + y = util_iround(MAX2(0.0f, vp->translate[1] - fabsf(vp->scale[1]))); + w = util_iround(vp->translate[0] + fabsf(vp->scale[0])) - x; + h = util_iround(vp->translate[1] + fabsf(vp->scale[1])) - y; + zmin = vp->translate[2] - fabsf(vp->scale[2]); zmax = vp->translate[2] + fabsf(vp->scale[2]); |