Module: Mesa Branch: main Commit: 25026076abba64f9b83c1e4fa56a4a93441ab56e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=25026076abba64f9b83c1e4fa56a4a93441ab56e
Author: Marek Olšák <[email protected]> Date: Sun Sep 26 12:06:19 2021 -0400 ac/llvm: pass cull options into cull_bbox directly Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13048> --- src/amd/llvm/ac_llvm_cull.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/amd/llvm/ac_llvm_cull.c b/src/amd/llvm/ac_llvm_cull.c index 3ef1dab8311..1bc6b6a1227 100644 --- a/src/amd/llvm/ac_llvm_cull.c +++ b/src/amd/llvm/ac_llvm_cull.c @@ -117,14 +117,13 @@ static LLVMValueRef ac_cull_face(struct ac_llvm_context *ctx, LLVMValueRef pos[3 static void cull_bbox(struct ac_llvm_context *ctx, LLVMValueRef pos[3][4], LLVMValueRef initially_accepted, struct ac_position_w_info *w, LLVMValueRef vp_scale[2], LLVMValueRef vp_translate[2], - LLVMValueRef small_prim_precision, bool cull_view_xy, - bool cull_view_near_z, bool cull_view_far_z, bool cull_small_prims, - bool use_halfz_clip_space, ac_cull_accept_func accept_func, - void *userdata) + LLVMValueRef small_prim_precision, struct ac_cull_options *options, + ac_cull_accept_func accept_func, void *userdata) { LLVMBuilderRef builder = ctx->builder; - if (!cull_view_xy && !cull_view_near_z && !cull_view_far_z && !cull_small_prims) { + if (!options->cull_view_xy && !options->cull_view_near_z && !options->cull_view_far_z && + !options->cull_small_prims) { if (accept_func) accept_func(ctx, initially_accepted, userdata); return; @@ -136,7 +135,8 @@ static void cull_bbox(struct ac_llvm_context *ctx, LLVMValueRef pos[3][4], LLVMValueRef accepted = ctx->i1true; /* Compute the primitive bounding box for easy culling. */ - for (unsigned chan = 0; chan < (cull_view_near_z || cull_view_far_z ? 3 : 2); chan++) { + for (unsigned chan = 0; chan < (options->cull_view_near_z || + options->cull_view_far_z ? 3 : 2); chan++) { bbox_min[chan] = ac_build_fmin(ctx, pos[0][chan], pos[1][chan]); bbox_min[chan] = ac_build_fmin(ctx, bbox_min[chan], pos[2][chan]); @@ -145,18 +145,18 @@ static void cull_bbox(struct ac_llvm_context *ctx, LLVMValueRef pos[3][4], } /* View culling. */ - if (cull_view_xy || cull_view_near_z || cull_view_far_z) { + if (options->cull_view_xy || options->cull_view_near_z || options->cull_view_far_z) { for (unsigned chan = 0; chan < 3; chan++) { LLVMValueRef visible; - if ((cull_view_xy && chan <= 1) || (cull_view_near_z && chan == 2)) { - float t = chan == 2 && use_halfz_clip_space ? 0 : -1; + if ((options->cull_view_xy && chan <= 1) || (options->cull_view_near_z && chan == 2)) { + float t = chan == 2 && options->use_halfz_clip_space ? 0 : -1; visible = LLVMBuildFCmp(builder, LLVMRealOGE, bbox_max[chan], LLVMConstReal(ctx->f32, t), ""); accepted = LLVMBuildAnd(builder, accepted, visible, ""); } - if ((cull_view_xy && chan <= 1) || (cull_view_far_z && chan == 2)) { + if ((options->cull_view_xy && chan <= 1) || (options->cull_view_far_z && chan == 2)) { visible = LLVMBuildFCmp(builder, LLVMRealOLE, bbox_min[chan], ctx->f32_1, ""); accepted = LLVMBuildAnd(builder, accepted, visible, ""); } @@ -164,7 +164,7 @@ static void cull_bbox(struct ac_llvm_context *ctx, LLVMValueRef pos[3][4], } /* Small primitive elimination. */ - if (cull_small_prims) { + if (options->cull_small_prims) { /* Assuming a sample position at (0.5, 0.5), if we round * the bounding box min/max extents and the results of * the rounding are equal in either the X or Y direction, @@ -244,8 +244,6 @@ void ac_cull_triangle(struct ac_llvm_context *ctx, LLVMValueRef pos[3][4], ""); /* View culling and small primitive elimination. */ - cull_bbox(ctx, pos, accepted, &w, vp_scale, vp_translate, small_prim_precision, - options->cull_view_xy, options->cull_view_near_z, options->cull_view_far_z, - options->cull_small_prims, options->use_halfz_clip_space, accept_func, - userdata); + cull_bbox(ctx, pos, accepted, &w, vp_scale, vp_translate, small_prim_precision, options, + accept_func, userdata); }
