i965: Add i965 plumbing for ARB_post_depth_coverage for i965 (gen9+).
authorPlamena Manolova <plamena.manolova@intel.com>
Tue, 6 Dec 2016 19:37:01 +0000 (21:37 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 7 Dec 2016 11:01:50 +0000 (11:01 +0000)
This extension allows the fragment shader to control whether values in
gl_SampleMaskIn[] reflect the coverage after application of the early
depth and stencil tests.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
docs/features.txt
docs/relnotes/13.1.0.html
src/mesa/drivers/dri/i965/brw_compiler.h
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/gen8_ps_state.c
src/mesa/drivers/dri/i965/intel_extensions.c

index 2c6691f5b4cc6c155df69ac33b2c6197b15ad083..c27d521265ede4cf8a002f0a87968d2b02c522cb 100644 (file)
@@ -287,7 +287,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve
   GL_ARB_indirect_parameters                            DONE (nvc0, radeonsi)
   GL_ARB_parallel_shader_compile                        not started, but Chia-I Wu did some related work in 2014
   GL_ARB_pipeline_statistics_query                      DONE (i965, nvc0, radeonsi, softpipe, swr)
-  GL_ARB_post_depth_coverage                            not started
+  GL_ARB_post_depth_coverage                            DONE (i965)
   GL_ARB_robustness_isolation                           not started
   GL_ARB_sample_locations                               not started
   GL_ARB_seamless_cubemap_per_texture                   DONE (i965, nvc0, radeonsi, r600, softpipe, swr)
index 4f76cc287fe9819499cc6554dbf80a5acc71ea06..5b8b01695cabd5daf45bb42f877c078c338acecb 100644 (file)
@@ -44,6 +44,7 @@ Note: some of the new features are only available with certain drivers.
 </p>
 
 <ul>
+<li>GL_ARB_post_depth_coverage on i965/gen9+</li>
 <li>GL_NV_image_formats on any driver supporting GL_ARB_shader_image_load_store (i965, nvc0, radeonsi, softpipe)</li>
 </ul>
 
index 65a74784642417033a2f82eb0c780ec4e5d54b41..410641f5d944f06f456eae274cbf1ad5aec579c8 100644 (file)
@@ -397,6 +397,7 @@ struct brw_wm_prog_data {
    bool computed_stencil;
 
    bool early_fragment_tests;
+   bool post_depth_coverage;
    bool dispatch_8;
    bool dispatch_16;
    bool dual_src_blend;
index c218f56684d16ae79f1d4ce18dde7a75eb5709b5..ce0c07e124fa940eb7d51b4ed33ba565fd7dd1f6 100644 (file)
@@ -6454,6 +6454,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
        shader->info->outputs_read);
 
    prog_data->early_fragment_tests = shader->info->fs.early_fragment_tests;
+   prog_data->post_depth_coverage = shader->info->fs.post_depth_coverage;
 
    prog_data->barycentric_interp_modes =
       brw_compute_barycentric_interp_modes(compiler->devinfo, shader);
index a4eb962a2cb1160dfa52e1b64b468a880eb11348..33ef02315578ea1b6aa4d0f956d7300262c90b73 100644 (file)
@@ -53,10 +53,17 @@ gen8_upload_ps_extra(struct brw_context *brw,
       dw1 |= GEN8_PSX_SHADER_IS_PER_SAMPLE;
 
    if (prog_data->uses_sample_mask) {
-      if (brw->gen >= 9)
-         dw1 |= BRW_PSICMS_INNER << GEN9_PSX_SHADER_NORMAL_COVERAGE_MASK_SHIFT;
-      else
+      if (brw->gen >= 9) {
+         if (prog_data->post_depth_coverage) {
+            dw1 |= BRW_PCICMS_DEPTH << GEN9_PSX_SHADER_NORMAL_COVERAGE_MASK_SHIFT;
+         }
+         else {
+            dw1 |= BRW_PSICMS_INNER << GEN9_PSX_SHADER_NORMAL_COVERAGE_MASK_SHIFT;
+         }
+      }
+      else {
          dw1 |= GEN8_PSX_SHADER_USES_INPUT_COVERAGE_MASK;
+      }
    }
 
    if (prog_data->uses_omask)
index 66079b5fdd849c3e4760a46dad2ddf3bd6c477d3..19f4684a188364480cc4bcbedc06dfcc5a1a97c7 100644 (file)
@@ -415,6 +415,7 @@ intelInitExtensions(struct gl_context *ctx)
       ctx->Extensions.KHR_texture_compression_astc_ldr = true;
       ctx->Extensions.KHR_texture_compression_astc_sliced_3d = true;
       ctx->Extensions.MESA_shader_framebuffer_fetch = true;
+      ctx->Extensions.ARB_post_depth_coverage = true;
    }
 
    if (ctx->API == API_OPENGL_CORE)