This just adds the NIR paths for shader group vote.
v2: drop feq for now. (Roland)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3213>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3213>
spec/arb_shader_draw_parameters/preprocessor/disabled-undefined-core.vert: skip
spec/arb_shader_draw_parameters/preprocessor/enabled-core.tesc: skip
spec/arb_shader_draw_parameters/preprocessor/enabled-core.tese: skip
+spec/arb_shader_group_vote/preprocessor/disabled-defined-compat.frag: skip
+spec/arb_shader_group_vote/preprocessor/disabled-defined-compat.vert: skip
+spec/arb_shader_group_vote/preprocessor/disabled-defined-core.comp: skip
+spec/arb_shader_group_vote/preprocessor/disabled-defined-core.frag: skip
+spec/arb_shader_group_vote/preprocessor/disabled-defined-core.geom: skip
spec/arb_shader_group_vote/preprocessor/disabled-defined-core.tesc: skip
spec/arb_shader_group_vote/preprocessor/disabled-defined-core.tese: skip
+spec/arb_shader_group_vote/preprocessor/disabled-defined-core.vert: skip
+spec/arb_shader_group_vote/preprocessor/disabled-undefined-compat.frag: skip
+spec/arb_shader_group_vote/preprocessor/disabled-undefined-compat.vert: skip
+spec/arb_shader_group_vote/preprocessor/disabled-undefined-core.comp: skip
+spec/arb_shader_group_vote/preprocessor/disabled-undefined-core.frag: skip
+spec/arb_shader_group_vote/preprocessor/disabled-undefined-core.geom: skip
spec/arb_shader_group_vote/preprocessor/disabled-undefined-core.tesc: skip
spec/arb_shader_group_vote/preprocessor/disabled-undefined-core.tese: skip
-spec/arb_shader_group_vote/preprocessor/enabled-compat.frag: skip
-spec/arb_shader_group_vote/preprocessor/enabled-compat.vert: skip
-spec/arb_shader_group_vote/preprocessor/enabled-core.comp: skip
-spec/arb_shader_group_vote/preprocessor/enabled-core.frag: skip
-spec/arb_shader_group_vote/preprocessor/enabled-core.geom: skip
+spec/arb_shader_group_vote/preprocessor/disabled-undefined-core.vert: skip
spec/arb_shader_group_vote/preprocessor/enabled-core.tesc: skip
spec/arb_shader_group_vote/preprocessor/enabled-core.tese: skip
-spec/arb_shader_group_vote/preprocessor/enabled-core.vert: skip
spec/arb_shader_image_load_store/preprocessor/disabled-defined-compat.frag: skip
spec/arb_shader_image_load_store/preprocessor/disabled-defined-compat.vert: skip
spec/arb_shader_image_load_store/preprocessor/disabled-defined-core.comp: skip
summary:
name: results
---- --------
- pass: 9692
+ pass: 9686
fail: 2
crash: 0
- skip: 5089
+ skip: 5095
timeout: 0
warn: 0
incomplete: 0
spec/arb_shader_ballot/execution/fs-readinvocation-uint-uniform: skip
spec/arb_shader_clock/execution/clock: skip
spec/arb_shader_clock/execution/clock2x32: skip
-spec/arb_shader_group_vote/cs-all: skip
-spec/arb_shader_group_vote/cs-any: skip
-spec/arb_shader_group_vote/cs-eq: skip
-spec/arb_shader_group_vote/vs-all-const: skip
-spec/arb_shader_group_vote/vs-all-uniform: skip
-spec/arb_shader_group_vote/vs-any-const: skip
-spec/arb_shader_group_vote/vs-any-uniform: skip
-spec/arb_shader_group_vote/vs-eq-const: skip
-spec/arb_shader_group_vote/vs-eq-uniform: skip
spec/arb_shader_image_load_store/execution/gl45-imageatomicexchange-float: skip
spec/arb_shader_precision/fs-degrees-float: skip
spec/arb_shader_precision/fs-degrees-vec2: skip
summary:
name: results
---- --------
- pass: 8930
+ pass: 8939
fail: 55
crash: 0
- skip: 6361
+ skip: 6352
timeout: 0
warn: 0
incomplete: 0
GL_ARB_polygon_offset_clamp DONE (freedreno, i965, nv50, nvc0, r600, llvmpipe, swr, virgl)
GL_ARB_shader_atomic_counter_ops DONE (freedreno/a5xx+, i965/gen7+, nvc0, r600, llvmpipe, softpipe, virgl)
GL_ARB_shader_draw_parameters DONE (i965, llvmpipe, nvc0)
- GL_ARB_shader_group_vote DONE (i965, nvc0)
+ GL_ARB_shader_group_vote DONE (i965, nvc0, llvmpipe)
GL_ARB_spirv_extensions DONE (i965/gen7+)
GL_ARB_texture_filter_anisotropic DONE (freedreno, i965, nv50, nvc0, r600, softpipe (*), llvmpipe (*))
GL_ARB_transform_feedback_overflow_query DONE (i965/gen6+, nvc0, llvmpipe, softpipe, virgl)
case nir_intrinsic_global_atomic_exchange:
case nir_intrinsic_global_atomic_comp_swap:
visit_global_atomic(bld_base, instr, result);
+ case nir_intrinsic_vote_all:
+ case nir_intrinsic_vote_any:
+ case nir_intrinsic_vote_ieq:
+ bld_base->vote(bld_base, cast_type(bld_base, get_src(bld_base, instr->src[0]), nir_type_int, 32), instr, result);
break;
default:
assert(0);
void (*emit_vertex)(struct lp_build_nir_context *bld_base, uint32_t stream_id);
void (*end_primitive)(struct lp_build_nir_context *bld_base, uint32_t stream_id);
+
+ void (*vote)(struct lp_build_nir_context *bld_base, LLVMValueRef src, nir_intrinsic_instr *instr, LLVMValueRef dst[4]);
// LLVMValueRef main_function
};
}
}
+static void emit_vote(struct lp_build_nir_context *bld_base, LLVMValueRef src, nir_intrinsic_instr *instr, LLVMValueRef result[4])
+{
+ struct gallivm_state * gallivm = bld_base->base.gallivm;
+ LLVMBuilderRef builder = gallivm->builder;
+
+ LLVMValueRef exec_mask = mask_vec(bld_base);
+ struct lp_build_loop_state loop_state;
+
+ LLVMValueRef outer_cond = LLVMBuildICmp(builder, LLVMIntNE, exec_mask, bld_base->uint_bld.zero, "");
+
+ LLVMValueRef res_store = lp_build_alloca(gallivm, bld_base->int_bld.elem_type, "");
+ LLVMValueRef init_val;
+ if (instr->intrinsic == nir_intrinsic_vote_ieq) {
+ /* for equal we unfortunately have to loop and find the first valid one. */
+ lp_build_loop_begin(&loop_state, gallivm, lp_build_const_int32(gallivm, 0));
+ LLVMValueRef if_cond = LLVMBuildExtractElement(gallivm->builder, outer_cond, loop_state.counter, "");
+
+ struct lp_build_if_state ifthen;
+ lp_build_if(&ifthen, gallivm, if_cond);
+ LLVMValueRef value_ptr = LLVMBuildExtractElement(gallivm->builder, src,
+ loop_state.counter, "");
+ LLVMBuildStore(builder, value_ptr, res_store);
+ lp_build_endif(&ifthen);
+ lp_build_loop_end_cond(&loop_state, lp_build_const_int32(gallivm, bld_base->uint_bld.type.length),
+ NULL, LLVMIntUGE);
+ lp_build_print_value(gallivm, "init_val is ", LLVMBuildLoad(builder, res_store, ""));
+ init_val = LLVMBuildLoad(builder, res_store, "");
+ } else {
+ LLVMBuildStore(builder, lp_build_const_int32(gallivm, instr->intrinsic == nir_intrinsic_vote_any ? 0 : -1), res_store);
+ }
+
+ LLVMValueRef res;
+ lp_build_loop_begin(&loop_state, gallivm, lp_build_const_int32(gallivm, 0));
+ LLVMValueRef value_ptr = LLVMBuildExtractElement(gallivm->builder, src,
+ loop_state.counter, "");
+ struct lp_build_if_state ifthen;
+ LLVMValueRef if_cond;
+ if_cond = LLVMBuildExtractElement(gallivm->builder, outer_cond, loop_state.counter, "");
+
+ lp_build_if(&ifthen, gallivm, if_cond);
+ res = LLVMBuildLoad(builder, res_store, "");
+
+ if (instr->intrinsic == nir_intrinsic_vote_ieq) {
+ LLVMValueRef tmp = LLVMBuildICmp(builder, LLVMIntEQ, init_val, value_ptr, "");
+ tmp = LLVMBuildSExt(builder, tmp, bld_base->uint_bld.elem_type, "");
+ res = LLVMBuildOr(builder, res, tmp, "");
+ } else if (instr->intrinsic == nir_intrinsic_vote_any)
+ res = LLVMBuildOr(builder, res, value_ptr, "");
+ else
+ res = LLVMBuildAnd(builder, res, value_ptr, "");
+ LLVMBuildStore(builder, res, res_store);
+ lp_build_endif(&ifthen);
+ lp_build_loop_end_cond(&loop_state, lp_build_const_int32(gallivm, bld_base->uint_bld.type.length),
+ NULL, LLVMIntUGE);
+ result[0] = lp_build_broadcast_scalar(&bld_base->uint_bld, LLVMBuildLoad(builder, res_store, ""));
+}
+
void lp_build_nir_soa(struct gallivm_state *gallivm,
struct nir_shader *shader,
const struct lp_build_tgsi_params *params,
bld.bld_base.barrier = emit_barrier;
bld.bld_base.image_op = emit_image_op;
bld.bld_base.image_size = emit_image_size;
+ bld.bld_base.vote = emit_vote;
bld.mask = params->mask;
bld.inputs = params->inputs;
case PIPE_CAP_PCI_FUNCTION:
case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
- case PIPE_CAP_TGSI_VOTE:
case PIPE_CAP_MAX_WINDOW_RECTANGLES:
case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE:
case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:
return 1;
+ case PIPE_CAP_TGSI_VOTE:
case PIPE_CAP_LOAD_CONSTBUF:
case PIPE_CAP_PACKED_UNIFORMS: {
struct llvmpipe_screen *lscreen = llvmpipe_screen(screen);