diff options
author | Dave Airlie <[email protected]> | 2019-06-24 14:45:36 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2019-07-07 16:23:27 +1000 |
commit | 4f709c86a92e561b4b72f6ace44e1fbf9fae5e67 (patch) | |
tree | 69530e3b9cccaa7f7806e66b721ce3fa1fe615c5 /src/gallium/auxiliary/draw | |
parent | 4271430dd75f5a05ade6040c5daa57e901ebdef5 (diff) |
vertex shader: add exec masking (v2)
As suggested by Roland this is just a compare of fetch_max
vs the counter, much simpler than my original spaghetti code.
We require the vertex shader to have an exec mask to get proper
ssbo/image load/atore/atomics semantics
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 69c10803750..73147e6852b 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -607,7 +607,8 @@ generate_vs(struct draw_llvm_variant *variant, const struct lp_bld_tgsi_system_values *system_values, LLVMValueRef context_ptr, const struct lp_build_sampler_soa *draw_sampler, - boolean clamp_vertex_color) + boolean clamp_vertex_color, + struct lp_build_mask_context *bld_mask) { struct draw_llvm *llvm = variant->llvm; const struct tgsi_token *tokens = llvm->draw->vs.vertex_shader->state.tokens; @@ -619,7 +620,7 @@ generate_vs(struct draw_llvm_variant *variant, lp_build_tgsi_soa(variant->gallivm, tokens, vs_type, - NULL /*struct lp_build_mask_context *mask*/, + bld_mask, /*struct lp_build_mask_context *mask*/ consts_ptr, num_consts_ptr, system_values, @@ -1801,6 +1802,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) true_index_array = lp_build_broadcast_scalar(&blduivec, lp_loop.counter); true_index_array = LLVMBuildAdd(builder, true_index_array, ind_vec, ""); + LLVMValueRef exec_mask = lp_build_cmp(&blduivec, PIPE_FUNC_LEQUAL, true_index_array, fetch_max); /* * Limit indices to fetch_max, otherwise might try to access indices * beyond index buffer (or rather vsplit elt buffer) size. @@ -1880,6 +1882,9 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) } } + struct lp_build_mask_context mask; + + lp_build_mask_begin(&mask, gallivm, vs_type, exec_mask); /* In the paths with elts vertex id has to be unaffected by the * index bias and because indices inside our elements array have * already had index bias applied we need to subtract it here to @@ -1906,8 +1911,10 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) &system_values, context_ptr, sampler, - key->clamp_vertex_color); + key->clamp_vertex_color, + &mask); + lp_build_mask_end(&mask); if (pos != -1 && cv != -1) { /* store original positions in clip before further manipulation */ store_clip(gallivm, vs_type, io, outputs, pos); |