[virglrenderer-devel] [PATCH 1/7] shaders: handle early fragment tests

Gurchetan Singh gurchetansingh at chromium.org
Fri Jul 20 03:56:57 UTC 2018


On Thu, Jul 19, 2018 at 5:05 PM Dave Airlie <airlied at gmail.com> wrote:
>
> From: Dave Airlie <airlied at redhat.com>
>
> As part of shader image support we need to support this property.
> ---
>  src/vrend_shader.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/vrend_shader.c b/src/vrend_shader.c
> index cad445b..85da325 100644
> --- a/src/vrend_shader.c
> +++ b/src/vrend_shader.c
> @@ -185,6 +185,7 @@ struct dump_ctx {
>     bool vs_has_pervertex;
>     bool write_mul_temp;
>     bool has_sample_input;
> +   bool early_depth_stencil;
>
>     int tcs_vertices_out;
>     int tes_prim_mode;
> @@ -1202,6 +1203,10 @@ iter_property(struct tgsi_iterate_context *iter,
>     if (prop->Property.PropertyName == TGSI_PROPERTY_TES_POINT_MODE) {
>        ctx->tes_point_mode = prop->u[0].Data;
>     }
> +
> +   if (prop->Property.PropertyName == TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL)
> +      ctx->early_depth_stencil = prop->u[0].Data > 0;
> +
>     return TRUE;
>  }
>
> @@ -3738,6 +3743,10 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
>                    ctx->fs_pixel_center ? "pixel_center_integer" : "");
>           STRCAT_WITH_RET(glsl_hdr, buf);
>        }
> +      if (ctx->early_depth_stencil) {
> +         snprintf(buf, 255, "layout(early_fragment_tests) in;\n");
> +         STRCAT_WITH_RET(glsl_hdr, buf);
> +      }

We need to bump up the glsl version if we have early fragment tests in
the FS.  Currently, we have #version 330 only when (ctx->prog_type ==
TGSI_PROCESSOR_COMPUTE).

Example test case:
dEQP-GLES31.functional.image_load_store.early_fragment_tests.early_fragment_tests_depth

>     }
>     if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY) {
>        char invocbuf[25];
> --
> 2.14.3
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel


More information about the virglrenderer-devel mailing list