aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2020-03-26 13:27:17 +1000
committerDave Airlie <[email protected]>2020-07-08 07:19:25 +1000
commit3bb3e8940c93d468b9fbed18b53b6728e8664333 (patch)
tree5b83312868fc45aeeb505525110beec46b448908
parentb8fcb621340c3474f14f15a297308e99b666caf5 (diff)
llvmpipe: add ARB_post_depth_coverage support.
This doesn't pass thie piglits because currently they are broken for case where GL upgrades 2 samples to 4 Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5767>
-rw-r--r--.gitlab-ci/piglit/quick_gl.txt16
-rw-r--r--docs/features.txt2
-rw-r--r--docs/relnotes/new_features.txt1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c31
5 files changed, 34 insertions, 18 deletions
diff --git a/.gitlab-ci/piglit/quick_gl.txt b/.gitlab-ci/piglit/quick_gl.txt
index 1bc8846c2be..ec37260be8e 100644
--- a/.gitlab-ci/piglit/quick_gl.txt
+++ b/.gitlab-ci/piglit/quick_gl.txt
@@ -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
diff --git a/docs/features.txt b/docs/features.txt
index 284689a0bfc..33484576455 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -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)
diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt
index f5d4b29a058..e943b71ad30 100644
--- a/docs/relnotes/new_features.txt
+++ b/docs/relnotes/new_features.txt
@@ -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.
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 3cb653707d0..c92d1c4e023 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -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;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 9967b4a94ec..edc4dcd2a5a 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -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);