llvmpipe: rip out cylindrical wrap support

Acked-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12505>
This commit is contained in:
Erik Faye-Lund 2021-08-23 14:37:42 +02:00 committed by Marge Bot
parent e9cc7f1ae4
commit 6e05f68924
3 changed files with 1 additions and 81 deletions

View File

@ -70,9 +70,8 @@ struct lp_shader_input {
uint interp:4; /* enum lp_interp */
uint usage_mask:4; /* bitmask of TGSI_WRITEMASK_x flags */
uint src_index:8; /* where to find values in incoming vertices */
uint cyl_wrap:4; /* TGSI_CYLINDRICAL_WRAP_x flags */
uint location:2; /* TGSI_INTERPOLOATE_LOC_* */
uint padding:10;
uint padding:14;
};

View File

@ -3777,7 +3777,6 @@ llvmpipe_create_fs_state(struct pipe_context *pipe,
for (i = 0; i < shader->info.base.num_inputs; i++) {
shader->inputs[i].usage_mask = shader->info.base.input_usage_mask[i];
shader->inputs[i].cyl_wrap = 0;
shader->inputs[i].location = shader->info.base.input_interpolate_loc[i];
switch (shader->info.base.input_interpolate[i]) {

View File

@ -471,82 +471,6 @@ apply_perspective_corr( struct gallivm_state *gallivm,
}
/**
* Apply cylindrical wrapping to vertex attributes if enabled.
* Input coordinates must be in [0, 1] range, otherwise results are undefined.
*
* @param cyl_wrap TGSI_CYLINDRICAL_WRAP_x flags
*/
static void
emit_apply_cyl_wrap(struct gallivm_state *gallivm,
struct lp_setup_args *args,
uint cyl_wrap,
LLVMValueRef attribv[3])
{
LLVMBuilderRef builder = gallivm->builder;
struct lp_type type = args->bld.type;
LLVMTypeRef float_vec_type = args->bld.vec_type;
LLVMValueRef pos_half;
LLVMValueRef neg_half;
LLVMValueRef cyl_mask;
LLVMValueRef offset;
LLVMValueRef delta;
LLVMValueRef one;
if (!cyl_wrap)
return;
/* Constants */
pos_half = lp_build_const_vec(gallivm, type, +0.5f);
neg_half = lp_build_const_vec(gallivm, type, -0.5f);
cyl_mask = lp_build_const_mask_aos(gallivm, type, cyl_wrap, 4);
one = lp_build_const_vec(gallivm, type, 1.0f);
one = LLVMBuildBitCast(builder, one, lp_build_int_vec_type(gallivm, type), "");
one = LLVMBuildAnd(builder, one, cyl_mask, "");
/* Edge v0 -> v1 */
delta = LLVMBuildFSub(builder, attribv[1], attribv[0], "");
offset = lp_build_compare(gallivm, type, PIPE_FUNC_GREATER, delta, pos_half);
offset = LLVMBuildAnd(builder, offset, one, "");
offset = LLVMBuildBitCast(builder, offset, float_vec_type, "");
attribv[0] = LLVMBuildFAdd(builder, attribv[0], offset, "");
offset = lp_build_compare(gallivm, type, PIPE_FUNC_LESS, delta, neg_half);
offset = LLVMBuildAnd(builder, offset, one, "");
offset = LLVMBuildBitCast(builder, offset, float_vec_type, "");
attribv[1] = LLVMBuildFAdd(builder, attribv[1], offset, "");
/* Edge v1 -> v2 */
delta = LLVMBuildFSub(builder, attribv[2], attribv[1], "");
offset = lp_build_compare(gallivm, type, PIPE_FUNC_GREATER, delta, pos_half);
offset = LLVMBuildAnd(builder, offset, one, "");
offset = LLVMBuildBitCast(builder, offset, float_vec_type, "");
attribv[1] = LLVMBuildFAdd(builder, attribv[1], offset, "");
offset = lp_build_compare(gallivm, type, PIPE_FUNC_LESS, delta, neg_half);
offset = LLVMBuildAnd(builder, offset, one, "");
offset = LLVMBuildBitCast(builder, offset, float_vec_type, "");
attribv[2] = LLVMBuildFAdd(builder, attribv[2], offset, "");
/* Edge v2 -> v0 */
delta = LLVMBuildFSub(builder, attribv[0], attribv[2], "");
offset = lp_build_compare(gallivm, type, PIPE_FUNC_GREATER, delta, pos_half);
offset = LLVMBuildAnd(builder, offset, one, "");
offset = LLVMBuildBitCast(builder, offset, float_vec_type, "");
attribv[2] = LLVMBuildFAdd(builder, attribv[2], offset, "");
offset = lp_build_compare(gallivm, type, PIPE_FUNC_LESS, delta, neg_half);
offset = LLVMBuildAnd(builder, offset, one, "");
offset = LLVMBuildBitCast(builder, offset, float_vec_type, "");
attribv[0] = LLVMBuildFAdd(builder, attribv[0], offset, "");
}
/**
* Compute the inputs-> dadx, dady, a0 values.
*/
@ -575,13 +499,11 @@ emit_tri_coef( struct gallivm_state *gallivm,
case LP_INTERP_LINEAR:
load_attribute(gallivm, args, key, key->inputs[slot].src_index, attribs);
emit_apply_cyl_wrap(gallivm, args, key->inputs[slot].cyl_wrap, attribs);
emit_linear_coef(gallivm, args, slot+1, attribs);
break;
case LP_INTERP_PERSPECTIVE:
load_attribute(gallivm, args, key, key->inputs[slot].src_index, attribs);
emit_apply_cyl_wrap(gallivm, args, key->inputs[slot].cyl_wrap, attribs);
apply_perspective_corr(gallivm, args, slot+1, attribs);
emit_linear_coef(gallivm, args, slot+1, attribs);
break;