[virglrenderer-devel] [PATCH v2] renderer: Call glDepthRange if we move from default value

Elie Tournier tournier.elie at gmail.com
Tue Jun 5 16:54:21 UTC 2018


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 <gert.wollny at collabora.com>
Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
---
 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);
-- 
2.17.1



More information about the virglrenderer-devel mailing list