vrend: Issue depth range together with other viewport properties

Instead of setting the depth range values directly just mark the viewport
as dirty and update the state later together with the other viewport
properties. This fixes some issues with the depth clamp emulation and
geometry shaders.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Gert Wollny 5 years ago
parent d4eda099ca
commit 96c359b542
  1. 32
      src/vrend_renderer.c

@ -2445,11 +2445,15 @@ void vrend_set_viewport_states(struct vrend_context *ctx,
ctx->sub->vps[idx].cur_y != y ||
ctx->sub->vps[idx].width != width ||
ctx->sub->vps[idx].height != height ||
ctx->sub->vps[idx].near_val != near_val ||
ctx->sub->vps[idx].far_val != far_val ||
(!(ctx->sub->viewport_state_initialized &= (1 << idx)))) {
ctx->sub->vps[idx].cur_x = x;
ctx->sub->vps[idx].cur_y = y;
ctx->sub->vps[idx].width = width;
ctx->sub->vps[idx].height = height;
ctx->sub->vps[idx].near_val = near_val;
ctx->sub->vps[idx].far_val = far_val;
ctx->sub->viewport_state_dirty |= (1 << idx);
}
@ -2457,23 +2461,6 @@ void vrend_set_viewport_states(struct vrend_context *ctx,
if (ctx->sub->viewport_is_negative != viewport_is_negative)
ctx->sub->viewport_is_negative = viewport_is_negative;
}
if (ctx->sub->vps[idx].near_val != near_val ||
ctx->sub->vps[idx].far_val != far_val) {
ctx->sub->vps[idx].near_val = near_val;
ctx->sub->vps[idx].far_val = far_val;
if (idx && has_feature(feat_viewport_array))
if (vrend_state.use_gles) {
glDepthRangeIndexedfOES(idx, ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val);
} else
glDepthRangeIndexed(idx, ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val);
else
if (vrend_state.use_gles)
glDepthRangefOES(ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val);
else
glDepthRange(ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val);
}
}
}
@ -3658,6 +3645,17 @@ static void vrend_update_viewport_state(struct vrend_context *ctx)
glViewportIndexedf(idx, ctx->sub->vps[idx].cur_x, cy, ctx->sub->vps[idx].width, ctx->sub->vps[idx].height);
else
glViewport(ctx->sub->vps[idx].cur_x, cy, ctx->sub->vps[idx].width, ctx->sub->vps[idx].height);
if (idx && has_feature(feat_viewport_array))
if (vrend_state.use_gles) {
glDepthRangeIndexedfOES(idx, ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val);
} else
glDepthRangeIndexed(idx, ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val);
else
if (vrend_state.use_gles)
glDepthRangefOES(ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val);
else
glDepthRange(ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val);
}
ctx->sub->viewport_state_dirty = 0;

Loading…
Cancel
Save