virgl: Enable depth_clamp by lowering if the host is new enough.
authorGert Wollny <gert.wollny@collabora.com>
Thu, 25 Jul 2019 08:45:14 +0000 (10:45 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Thu, 1 Aug 2019 05:58:53 +0000 (05:58 +0000)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/virgl/virgl_context.c
src/gallium/drivers/virgl/virgl_screen.c

index f68ac815f15adb7f04b6797aaaab56e651619433..bbb5247c86f1b4585a02b8e3dcc1248785052af4 100644 (file)
@@ -464,6 +464,9 @@ static void *virgl_create_rasterizer_state(struct pipe_context *ctx,
    vrs->rs = *rs_state;
    vrs->handle = virgl_object_assign_handle();
 
+   assert(rs_state->depth_clip_near ||
+          virgl_screen(ctx->screen)->caps.caps.v1.bset.depth_clip_disable);
+
    virgl_encode_rasterizer_state(vctx, vrs->handle, rs_state);
    return (void *)vrs;
 }
index e1a9f4ef3855c3e157991bbd535f095e3520b910..37e75b5e048b36aa6068c6fdbabf07021d41d58f 100644 (file)
@@ -115,7 +115,11 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
       return vscreen->caps.caps.v1.bset.fragment_coord_conventions;
    case PIPE_CAP_DEPTH_CLIP_DISABLE:
-      return vscreen->caps.caps.v1.bset.depth_clip_disable;
+      if (vscreen->caps.caps.v1.bset.depth_clip_disable)
+         return 1;
+      if (vscreen->caps.caps.v2.host_feature_check_version >= 3)
+         return 2;
+      return 0;
    case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
       return vscreen->caps.caps.v1.max_streamout_buffers;
    case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS: