summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-07-15 14:44:48 +0200
committerErik Faye-Lund <[email protected]>2019-10-17 09:26:25 +0200
commit26c6640835936a77d87030ce8e90f9b9f5be783e (patch)
treeadeab5e561f40a869c11090d1e786c05a79638e1 /src
parent4857d695f5827cbdfb406a55c2d5d75f7fd8cee9 (diff)
gallium/u_blitter: set a more sane viewport-state
This actually corresponds to legal GL depth-ranges, because depth-clear values are always in the 0..1 range in OpenGL. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 5976d72937b..5400e0a4b67 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -334,8 +334,10 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT);
/* set invariant vertex coordinates */
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
+ ctx->vertices[i][0][2] = 0; /*v.z*/
ctx->vertices[i][0][3] = 1; /*v.w*/
+ }
return &ctx->base;
}
@@ -806,17 +808,14 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx,
ctx->vertices[3][0][0] = (float)x1 / ctx->dst_width * 2.0f - 1.0f; /*v3.x*/
ctx->vertices[3][0][1] = (float)y2 / ctx->dst_height * 2.0f - 1.0f; /*v3.y*/
- for (i = 0; i < 4; i++)
- ctx->vertices[i][0][2] = depth; /*z*/
-
/* viewport */
struct pipe_viewport_state viewport;
viewport.scale[0] = 0.5f * ctx->dst_width;
viewport.scale[1] = 0.5f * ctx->dst_height;
- viewport.scale[2] = 1.0f;
+ viewport.scale[2] = 0.0f;
viewport.translate[0] = 0.5f * ctx->dst_width;
viewport.translate[1] = 0.5f * ctx->dst_height;
- viewport.translate[2] = 0.0f;
+ viewport.translate[2] = depth;
ctx->base.pipe->set_viewport_states(ctx->base.pipe, 0, 1, &viewport);
}