From 0cca6d6b48262d665064ebc22a69fa37b8abee9e Mon Sep 17 00:00:00 2001 From: Elie Tournier Date: Tue, 5 Jun 2018 17:54:21 +0100 Subject: [PATCH] vrend: Call glDepthRange if we move from default value Virglrender holds the values in a structure vrend_sub_context that is zeroed out when it is initialized. So, when the first state change set the near_val and far_val to zero, the check assumes it is the old state and doesn't call glDepthRange. Fixes: dEQP-GLES2.functional.depth_range.write.zero_to_zero v2: initialize far_val in vrend_renderer_create_sub_ctx (Gurchetan) Suggested-by: Gert Wollny Reviewed-by: Gurchetan Singh Signed-off-by: Elie Tournier Signed-off-by: Jakob Bornecrantz --- src/vrend_renderer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index e860dcc..53df8a4 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -7302,6 +7302,7 @@ void vrend_renderer_create_sub_ctx(struct vrend_context *ctx, int sub_ctx_id) { struct vrend_sub_context *sub; struct virgl_gl_ctx_param ctx_params; + GLuint i; LIST_FOR_EACH_ENTRY(sub, &ctx->sub_ctxs, head) { if (sub->sub_ctx_id == sub_ctx_id) { @@ -7328,6 +7329,11 @@ void vrend_renderer_create_sub_ctx(struct vrend_context *ctx, int sub_ctx_id) sub->sub_ctx_id = sub_ctx_id; + /* initialize the depth far_val to 1 */ + for (i = 0; i < PIPE_MAX_VIEWPORTS; i++) { + sub->vps[i].far_val = 1.0; + } + if (!vrend_state.have_gles31_vertex_attrib_binding) { glGenVertexArrays(1, &sub->vaoid); glBindVertexArray(sub->vaoid);