llvmpipe: add ARB_post_depth_coverage support.
authorDave Airlie <airlied@redhat.com>
Thu, 26 Mar 2020 03:27:17 +0000 (13:27 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 7 Jul 2020 21:19:25 +0000 (07:19 +1000)
This doesn't pass thie piglits because currently they are broken
for case where GL upgrades 2 samples to 4

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5767>

.gitlab-ci/piglit/quick_gl.txt
docs/features.txt
docs/relnotes/new_features.txt
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_state_fs.c

index 1bc8846c2beb6eb7c520dd5800a2364d5c79c4d8..ec37260be8ead6a70c4cfe1a5729a1172d084d72 100644 (file)
@@ -542,46 +542,34 @@ spec/arb_sample_shading/samplemask 16: skip
 spec/arb_sample_shading/samplemask 16 all: skip
 spec/arb_sample_shading/samplemask 2 all/0.250000 mask_in_one: fail
 spec/arb_sample_shading/samplemask 2 all/0.500000 mask_in_one: fail
-spec/arb_sample_shading/samplemask 2 all/0.500000 partition: fail
 spec/arb_sample_shading/samplemask 2 all/1.000000 mask_in_one: fail
-spec/arb_sample_shading/samplemask 2 all/1.000000 partition: fail
 spec/arb_sample_shading/samplemask 2 all/noms fix: fail
 spec/arb_sample_shading/samplemask 2 all/noms mask_in_one: fail
 spec/arb_sample_shading/samplemask 2 all/noms partition: fail
 spec/arb_sample_shading/samplemask 2 all/sample mask_in_one: fail
-spec/arb_sample_shading/samplemask 2 all/sample partition: fail
 spec/arb_sample_shading/samplemask 2/0.250000 mask_in_one: fail
 spec/arb_sample_shading/samplemask 2/0.500000 mask_in_one: fail
-spec/arb_sample_shading/samplemask 2/0.500000 partition: fail
 spec/arb_sample_shading/samplemask 2/1.000000 mask_in_one: fail
-spec/arb_sample_shading/samplemask 2/1.000000 partition: fail
 spec/arb_sample_shading/samplemask 2/noms fix: fail
 spec/arb_sample_shading/samplemask 2/noms mask_in_one: fail
 spec/arb_sample_shading/samplemask 2/noms partition: fail
 spec/arb_sample_shading/samplemask 2/sample mask_in_one: fail
-spec/arb_sample_shading/samplemask 2/sample partition: fail
 spec/arb_sample_shading/samplemask 32: skip
 spec/arb_sample_shading/samplemask 32 all: skip
 spec/arb_sample_shading/samplemask 4 all/0.250000 mask_in_one: fail
 spec/arb_sample_shading/samplemask 4 all/0.500000 mask_in_one: fail
-spec/arb_sample_shading/samplemask 4 all/0.500000 partition: fail
 spec/arb_sample_shading/samplemask 4 all/1.000000 mask_in_one: fail
-spec/arb_sample_shading/samplemask 4 all/1.000000 partition: fail
 spec/arb_sample_shading/samplemask 4 all/noms fix: fail
 spec/arb_sample_shading/samplemask 4 all/noms mask_in_one: fail
 spec/arb_sample_shading/samplemask 4 all/noms partition: fail
 spec/arb_sample_shading/samplemask 4 all/sample mask_in_one: fail
-spec/arb_sample_shading/samplemask 4 all/sample partition: fail
 spec/arb_sample_shading/samplemask 4/0.250000 mask_in_one: fail
 spec/arb_sample_shading/samplemask 4/0.500000 mask_in_one: fail
-spec/arb_sample_shading/samplemask 4/0.500000 partition: fail
 spec/arb_sample_shading/samplemask 4/1.000000 mask_in_one: fail
-spec/arb_sample_shading/samplemask 4/1.000000 partition: fail
 spec/arb_sample_shading/samplemask 4/noms fix: fail
 spec/arb_sample_shading/samplemask 4/noms mask_in_one: fail
 spec/arb_sample_shading/samplemask 4/noms partition: fail
 spec/arb_sample_shading/samplemask 4/sample mask_in_one: fail
-spec/arb_sample_shading/samplemask 4/sample partition: fail
 spec/arb_sample_shading/samplemask 6: skip
 spec/arb_sample_shading/samplemask 6 all: skip
 spec/arb_sample_shading/samplemask 8: skip
@@ -1684,8 +1672,8 @@ wgl/wgl-sanity: skip
 summary:
        name:  results
        ----  --------
-       pass:    21841
-       fail:      214
+       pass:    21853
+       fail:      202
       crash:        0
        skip:     1445
     timeout:        0
index 284689a0bfc3ac841c9f7bd4d868fb6bdeaf1f95..33484576455d83d906846f90e159f140bb3778b8 100644 (file)
@@ -304,7 +304,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve
   GL_ARB_fragment_shader_interlock                      DONE (i965)
   GL_ARB_gpu_shader_int64                               DONE (i965/gen8+, nvc0, radeonsi, softpipe, llvmpipe)
   GL_ARB_parallel_shader_compile                        DONE (all drivers)
-  GL_ARB_post_depth_coverage                            DONE (i965, nvc0, radeonsi)
+  GL_ARB_post_depth_coverage                            DONE (i965, nvc0, radeonsi, llvmpipe)
   GL_ARB_robustness_isolation                           not started
   GL_ARB_sample_locations                               DONE (nvc0)
   GL_ARB_seamless_cubemap_per_texture                   DONE (etnaviv/SEAMLESS_CUBE_MAP, freedreno, i965, nvc0, r600, radeonsi, softpipe, swr, virgl)
index f5d4b29a058fdfdf87ced8c641650b00daaa6a04..e943b71ad30058202d22194befdcf0f96a2f1346 100644 (file)
@@ -1,5 +1,6 @@
 GL_ARB_compute_variable_group_size on Iris.
 GL_ARB_gpu_shader5 on llvmpipe
+GL_ARB_post_depth_coverage on llvmpipe
 GL 4.2 on llvmpipe
 GL_EXT_shader_group_vote on GLES3.
 VK_AMD_texture_gather_bias_lod on RADV.
index 3cb653707d05979db4b285a70a031b72eaa66ad7..c92d1c4e023e83267690c0049b4e2fadd487a081 100644 (file)
@@ -373,7 +373,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_TES_LAYER_VIEWPORT:
    case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
    case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
-   case PIPE_CAP_POST_DEPTH_COVERAGE:
    case PIPE_CAP_BINDLESS_TEXTURE:
    case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
    case PIPE_CAP_MEMOBJ:
@@ -406,6 +405,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_LOAD_CONSTBUF:
    case PIPE_CAP_TEXTURE_MULTISAMPLE:
    case PIPE_CAP_SAMPLE_SHADING:
+   case PIPE_CAP_POST_DEPTH_COVERAGE:
    case PIPE_CAP_PACKED_UNIFORMS: {
       struct llvmpipe_screen *lscreen = llvmpipe_screen(screen);
       return !lscreen->use_tgsi;
index 9967b4a94ece45f56d24681670c67807764d9fef..edc4dcd2a5ae871aa5357712571c4a37c63ed97e 100644 (file)
@@ -399,6 +399,7 @@ generate_fs_loop(struct gallivm_state *gallivm,
                             shader->info.base.num_instructions < 8) && 0;
    const boolean dual_source_blend = key->blend.rt[0].blend_enable &&
                                      util_blend_state_is_dual(&key->blend, 0);
+   const bool post_depth_coverage = shader->info.base.properties[TGSI_PROPERTY_FS_POST_DEPTH_COVERAGE];
    unsigned attrib;
    unsigned chan;
    unsigned cbuf;
@@ -539,6 +540,11 @@ generate_fs_loop(struct gallivm_state *gallivm,
    LLVMValueRef s_mask_or = lp_build_alloca(gallivm, lp_build_int_vec_type(gallivm, type), "cov_mask_early_depth");
    LLVMBuildStore(builder, LLVMConstNull(lp_build_int_vec_type(gallivm, type)), s_mask_or);
 
+   /* Create storage for post depth sample mask */
+   LLVMValueRef post_depth_sample_mask_in = NULL;
+   if (post_depth_coverage)
+      post_depth_sample_mask_in = lp_build_alloca(gallivm, int_vec_type, "post_depth_sample_mask_in");
+
    LLVMValueRef s_mask = NULL, s_mask_ptr = NULL;
    LLVMValueRef z_sample_value_store = NULL, s_sample_value_store = NULL;
    LLVMValueRef z_fb_store = NULL, s_fb_store = NULL;
@@ -651,6 +657,14 @@ generate_fs_loop(struct gallivm_state *gallivm,
       tmp_s_mask_or = LLVMBuildOr(builder, tmp_s_mask_or, s_mask, "");
       LLVMBuildStore(builder, tmp_s_mask_or, s_mask_or);
 
+      if (post_depth_coverage) {
+         LLVMValueRef mask_bit_idx = LLVMBuildShl(builder, lp_build_const_int32(gallivm, 1), sample_loop_state.counter, "");
+         LLVMValueRef post_depth_mask_in = LLVMBuildLoad(builder, post_depth_sample_mask_in, "");
+         mask_bit_idx = LLVMBuildAnd(builder, s_mask, lp_build_broadcast(gallivm, int_vec_type, mask_bit_idx), "");
+         post_depth_mask_in = LLVMBuildOr(builder, post_depth_mask_in, mask_bit_idx, "");
+         LLVMBuildStore(builder, post_depth_mask_in, post_depth_sample_mask_in);
+      }
+
       LLVMBuildStore(builder, s_mask, s_mask_ptr);
 
       lp_build_for_loop_end(&sample_loop_state);
@@ -664,6 +678,11 @@ generate_fs_loop(struct gallivm_state *gallivm,
          lp_build_interp_soa_update_pos_dyn(interp, gallivm, loop_state.counter, NULL);
          lp_build_mask_update(&mask, tmp_s_mask_or);
       }
+   } else {
+      if (post_depth_coverage) {
+         LLVMValueRef post_depth_mask_in = LLVMBuildAnd(builder, lp_build_mask_value(&mask), lp_build_const_int_vec(gallivm, type, 1), "");
+         LLVMBuildStore(builder, post_depth_mask_in, post_depth_sample_mask_in);
+      }
    }
 
    LLVMValueRef out_sample_mask_storage = NULL;
@@ -673,6 +692,11 @@ generate_fs_loop(struct gallivm_state *gallivm,
          LLVMBuildStore(builder, LLVMConstNull(int_vec_type), out_sample_mask_storage);
    }
 
+   if (post_depth_coverage) {
+      system_values.sample_mask_in = LLVMBuildLoad(builder, post_depth_sample_mask_in, "");
+   }
+   else
+      system_values.sample_mask_in = sample_mask_in;
    if (key->multisample && key->min_samples > 1) {
       lp_build_for_loop_begin(&sample_loop_state, gallivm,
                               lp_build_const_int32(gallivm, 0),
@@ -687,10 +711,13 @@ generate_fs_loop(struct gallivm_state *gallivm,
       lp_build_mask_force(&mask, s_mask);
       lp_build_interp_soa_update_pos_dyn(interp, gallivm, loop_state.counter, sample_loop_state.counter);
       system_values.sample_id = sample_loop_state.counter;
-   } else
+      system_values.sample_mask_in = LLVMBuildAnd(builder, system_values.sample_mask_in,
+                                                  lp_build_broadcast(gallivm, int_vec_type,
+                                                                     LLVMBuildShl(builder, lp_build_const_int32(gallivm, 1), sample_loop_state.counter, "")), "");
+   } else {
       system_values.sample_id = lp_build_const_int32(gallivm, 0);
 
-   system_values.sample_mask_in = sample_mask_in;
+   }
    system_values.sample_pos = sample_pos_array;
 
    lp_build_interp_soa_update_inputs_dyn(interp, gallivm, loop_state.counter, mask_store, sample_loop_state.counter);