Path: blob/21.2-virgl/src/amd/llvm/ac_llvm_cull.h
7243 views
/*1* Copyright 2019 Advanced Micro Devices, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the5* "Software"), to deal in the Software without restriction, including6* without limitation the rights to use, copy, modify, merge, publish,7* distribute, sub license, and/or sell copies of the Software, and to8* permit persons to whom the Software is furnished to do so, subject to9* the following conditions:10*11* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR12* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,13* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL14* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,15* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR16* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE17* USE OR OTHER DEALINGS IN THE SOFTWARE.18*19* The above copyright notice and this permission notice (including the20* next paragraph) shall be included in all copies or substantial portions21* of the Software.22*23*/2425#ifndef AC_LLVM_CULL_H26#define AC_LLVM_CULL_H2728#include "ac_llvm_build.h"2930struct ac_cull_options {31/* In general, I recommend setting all to true except view Z culling,32* which isn't so effective because W culling is cheaper and partially33* replaces near Z culling, and you don't need to set Position.z34* if Z culling is disabled.35*36* If something doesn't work, turn some of these off to find out what.37*/38bool cull_front;39bool cull_back;40bool cull_view_xy;41bool cull_view_near_z;42bool cull_view_far_z;43bool cull_small_prims;44bool cull_zero_area;45bool cull_w; /* cull primitives with all W < 0 */4647bool use_halfz_clip_space;48};4950/* Callback invoked in the inner-most branch where the primitive is accepted. */51typedef void (*ac_cull_accept_func)(struct ac_llvm_context *ctx, LLVMValueRef accepted,52void *userdata);5354void ac_cull_triangle(struct ac_llvm_context *ctx, LLVMValueRef pos[3][4],55LLVMValueRef initially_accepted, LLVMValueRef vp_scale[2],56LLVMValueRef vp_translate[2], LLVMValueRef small_prim_precision,57struct ac_cull_options *options, ac_cull_accept_func accept_func,58void *userdata);5960#endif616263