forward precise-flag if supported
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 11 Jul 2018 14:28:30 +0000 (15:28 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 24 Jul 2018 08:27:27 +0000 (10:27 +0200)
New versions of virglrenderer supports the precise-flag, so let's
forward it from TGSI if that's the case.

This fixes a few dEQP-GLES31 tests:
- dEQP-GLES31.functional.tessellation.common_edge.quads_equal_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.quads_fractional_even_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.quads_fractional_odd_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.triangles_equal_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.triangles_fractional_even_spacing_precise
- dEQP-GLES31.functional.tessellation.common_edge.triangles_fractional_odd_spacing_precise

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/virgl/virgl_hw.h
src/gallium/drivers/virgl/virgl_tgsi.c

index c509e9b8a0ac1c9fc9588b6404ea10e083a54d77..4469515dd1295bb2bdad991850c6ac019313437e 100644 (file)
@@ -203,6 +203,7 @@ enum virgl_formats {
 #define VIRGL_CAP_TEXTURE_VIEW         (1 << 1)
 #define VIRGL_CAP_SET_MIN_SAMPLES      (1 << 2)
 #define VIRGL_CAP_COPY_IMAGE           (1 << 3)
+#define VIRGL_CAP_TGSI_PRECISE         (1 << 4)
 
 #define VIRGL_BIND_DEPTH_STENCIL (1 << 0)
 #define VIRGL_BIND_RENDER_TARGET (1 << 1)
index ff5abf6ddbd929752b0f890c4afea1f51d58c161..d1f785d4d213ef847d742518dfa4e5827d7cffc8 100644 (file)
@@ -31,6 +31,7 @@
 struct virgl_transform_context {
    struct tgsi_transform_context base;
    bool cull_enabled;
+   bool has_precise;
 };
 
 static void
@@ -76,7 +77,8 @@ static void
 virgl_tgsi_transform_instruction(struct tgsi_transform_context *ctx,
                                 struct tgsi_full_instruction *inst)
 {
-   if (inst->Instruction.Precise)
+   struct virgl_transform_context *vtctx = (struct virgl_transform_context *)ctx;
+   if (!vtctx->has_precise && inst->Instruction.Precise)
       inst->Instruction.Precise = 0;
 
    for (unsigned i = 0; i < inst->Instruction.NumSrcRegs; i++) {
@@ -104,6 +106,7 @@ struct tgsi_token *virgl_tgsi_transform(struct virgl_context *vctx, const struct
    transform.base.transform_property = virgl_tgsi_transform_property;
    transform.base.transform_instruction = virgl_tgsi_transform_instruction;
    transform.cull_enabled = vscreen->caps.caps.v1.bset.has_cull;
+   transform.has_precise = vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_TGSI_PRECISE;
    tgsi_transform_shader(tokens_in, new_tokens, newLen, &transform.base);
 
    return new_tokens;