summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-08-07 02:05:10 +0200
committerMarek Olšák <[email protected]>2017-04-01 00:06:41 +0200
commit150736b5c34fc07de296454b973ae72ede215ae2 (patch)
tree54d93a00b5b0da2000e9de564d7ce2be57c51842 /src/gallium/auxiliary/gallivm
parentc011fe7452f5a0c90e1839e3549efc4c2ac665c1 (diff)
gallium: remove support for predicates from TGSI (v2)
Neved used. v2: gallivm: rename "pred" -> "exec_mask" etnaviv: remove the cap gallium: fix tgsi_instruction::Padding Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_limits.h4
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c46
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c6
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c141
5 files changed, 18 insertions, 181 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_limits.h b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
index 7a4c8e480cd..b8c5c800e6f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_limits.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
@@ -49,8 +49,6 @@
#define LP_MAX_TGSI_IMMEDIATES 4096
-#define LP_MAX_TGSI_PREDS 16
-
#define LP_MAX_TGSI_CONSTS 4096
#define LP_MAX_TGSI_CONST_BUFFERS 16
@@ -109,8 +107,6 @@ gallivm_get_shader_param(enum pipe_shader_cap param)
return PIPE_MAX_CONSTANT_BUFFERS;
case PIPE_SHADER_CAP_MAX_TEMPS:
return LP_MAX_TGSI_TEMPS;
- case PIPE_SHADER_CAP_MAX_PREDS:
- return LP_MAX_TGSI_PREDS;
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
return 1;
case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR:
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index b6b3fe369b4..a9f3d449e74 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -458,7 +458,6 @@ struct lp_build_tgsi_soa_context
LLVMValueRef immediates[LP_MAX_INLINED_IMMEDIATES][TGSI_NUM_CHANNELS];
LLVMValueRef temps[LP_MAX_INLINED_TEMPS][TGSI_NUM_CHANNELS];
LLVMValueRef addr[LP_MAX_TGSI_ADDRS][TGSI_NUM_CHANNELS];
- LLVMValueRef preds[LP_MAX_TGSI_PREDS][TGSI_NUM_CHANNELS];
/* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is
* set in the indirect_files field.
@@ -552,7 +551,6 @@ struct lp_build_tgsi_aos_context
LLVMValueRef immediates[LP_MAX_INLINED_IMMEDIATES];
LLVMValueRef temps[LP_MAX_INLINED_TEMPS];
LLVMValueRef addr[LP_MAX_TGSI_ADDRS];
- LLVMValueRef preds[LP_MAX_TGSI_PREDS];
/* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is
* set in the indirect_files field.
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
index 2bd42916e50..58c39facfe0 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
@@ -256,10 +256,6 @@ lp_emit_store_aos(
ptr = bld->addr[reg->Indirect.Index];
break;
- case TGSI_FILE_PREDICATE:
- ptr = bld->preds[reg->Register.Index];
- break;
-
default:
assert(0);
return;
@@ -267,43 +263,6 @@ lp_emit_store_aos(
if (!ptr)
return;
- /*
- * Predicate
- */
-
- if (inst->Instruction.Predicate) {
- LLVMValueRef pred;
-
- assert(inst->Predicate.Index < LP_MAX_TGSI_PREDS);
-
- pred = LLVMBuildLoad(builder,
- bld->preds[inst->Predicate.Index], "");
-
- /*
- * Convert the value to an integer mask.
- */
- pred = lp_build_compare(bld->bld_base.base.gallivm,
- bld->bld_base.base.type,
- PIPE_FUNC_NOTEQUAL,
- pred,
- bld->bld_base.base.zero);
-
- if (inst->Predicate.Negate) {
- pred = LLVMBuildNot(builder, pred, "");
- }
-
- pred = bld->bld_base.emit_swizzle(&bld->bld_base, pred,
- inst->Predicate.SwizzleX,
- inst->Predicate.SwizzleY,
- inst->Predicate.SwizzleZ,
- inst->Predicate.SwizzleW);
-
- if (mask) {
- mask = LLVMBuildAnd(builder, mask, pred, "");
- } else {
- mask = pred;
- }
- }
/*
* Writemask
@@ -442,11 +401,6 @@ lp_emit_declaration_aos(
bld->addr[idx] = lp_build_alloca(gallivm, vec_type, "");
break;
- case TGSI_FILE_PREDICATE:
- assert(idx < LP_MAX_TGSI_PREDS);
- bld->preds[idx] = lp_build_alloca(gallivm, vec_type, "");
- break;
-
case TGSI_FILE_SAMPLER_VIEW:
/*
* The target stored here MUST match whatever there actually
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
index f8f43a561c8..e0cc0af279e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
@@ -305,8 +305,7 @@ analyse_instruction(struct analysis_context *ctx,
} else if (dst->File == TGSI_FILE_OUTPUT) {
regs = info->output;
max_regs = ARRAY_SIZE(info->output);
- } else if (dst->File == TGSI_FILE_ADDRESS ||
- dst->File == TGSI_FILE_PREDICATE) {
+ } else if (dst->File == TGSI_FILE_ADDRESS) {
continue;
} else {
assert(0);
@@ -389,8 +388,7 @@ analyse_instruction(struct analysis_context *ctx,
memset(res, 0, sizeof res);
- if (!inst->Instruction.Predicate &&
- !inst->Instruction.Saturate) {
+ if (!inst->Instruction.Saturate) {
for (chan = 0; chan < 4; ++chan) {
if (dst->WriteMask & (1 << chan)) {
if (inst->Instruction.Opcode == TGSI_OPCODE_MOV) {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 6871795b4b2..bfa32b9ad54 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -753,30 +753,21 @@ static void lp_exec_default(struct lp_exec_mask *mask,
*/
static void lp_exec_mask_store(struct lp_exec_mask *mask,
struct lp_build_context *bld_store,
- LLVMValueRef pred,
LLVMValueRef val,
LLVMValueRef dst_ptr)
{
LLVMBuilderRef builder = mask->bld->gallivm->builder;
+ LLVMValueRef exec_mask = mask->has_mask ? mask->exec_mask : NULL;
assert(lp_check_value(bld_store->type, val));
assert(LLVMGetTypeKind(LLVMTypeOf(dst_ptr)) == LLVMPointerTypeKind);
assert(LLVMGetElementType(LLVMTypeOf(dst_ptr)) == LLVMTypeOf(val));
- /* Mix the predicate and execution mask */
- if (mask->has_mask) {
- if (pred) {
- pred = LLVMBuildAnd(builder, pred, mask->exec_mask, "");
- } else {
- pred = mask->exec_mask;
- }
- }
-
- if (pred) {
+ if (exec_mask) {
LLVMValueRef res, dst;
dst = LLVMBuildLoad(builder, dst_ptr, "");
- res = lp_build_select(bld_store, pred, val, dst);
+ res = lp_build_select(bld_store, exec_mask, val, dst);
LLVMBuildStore(builder, res, dst_ptr);
} else
LLVMBuildStore(builder, val, dst_ptr);
@@ -1036,22 +1027,12 @@ emit_mask_scatter(struct lp_build_tgsi_soa_context *bld,
LLVMValueRef base_ptr,
LLVMValueRef indexes,
LLVMValueRef values,
- struct lp_exec_mask *mask,
- LLVMValueRef pred)
+ struct lp_exec_mask *mask)
{
struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
unsigned i;
-
- /* Mix the predicate and execution mask */
- if (mask->has_mask) {
- if (pred) {
- pred = LLVMBuildAnd(builder, pred, mask->exec_mask, "");
- }
- else {
- pred = mask->exec_mask;
- }
- }
+ LLVMValueRef pred = mask->has_mask ? mask->exec_mask : NULL;
/*
* Loop over elements of index_vec, store scalar value.
@@ -1733,74 +1714,6 @@ emit_fetch_deriv(
*ddy = lp_build_ddy(&bld->bld_base.base, src);
}
-
-/**
- * Predicate.
- */
-static void
-emit_fetch_predicate(
- struct lp_build_tgsi_soa_context *bld,
- const struct tgsi_full_instruction *inst,
- LLVMValueRef *pred)
-{
- LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder;
- unsigned index;
- unsigned char swizzles[4];
- LLVMValueRef unswizzled[4] = {NULL, NULL, NULL, NULL};
- LLVMValueRef value;
- unsigned chan;
-
- if (!inst->Instruction.Predicate) {
- TGSI_FOR_EACH_CHANNEL( chan ) {
- pred[chan] = NULL;
- }
- return;
- }
-
- swizzles[0] = inst->Predicate.SwizzleX;
- swizzles[1] = inst->Predicate.SwizzleY;
- swizzles[2] = inst->Predicate.SwizzleZ;
- swizzles[3] = inst->Predicate.SwizzleW;
-
- index = inst->Predicate.Index;
- assert(index < LP_MAX_TGSI_PREDS);
-
- TGSI_FOR_EACH_CHANNEL( chan ) {
- unsigned swizzle = swizzles[chan];
-
- /*
- * Only fetch the predicate register channels that are actually listed
- * in the swizzles
- */
- if (!unswizzled[swizzle]) {
- value = LLVMBuildLoad(builder,
- bld->preds[index][swizzle], "");
-
- /*
- * Convert the value to an integer mask.
- *
- * TODO: Short-circuit this comparison -- a D3D setp_xx instructions
- * is needlessly causing two comparisons due to storing the intermediate
- * result as float vector instead of an integer mask vector.
- */
- value = lp_build_compare(bld->bld_base.base.gallivm,
- bld->bld_base.base.type,
- PIPE_FUNC_NOTEQUAL,
- value,
- bld->bld_base.base.zero);
- if (inst->Predicate.Negate) {
- value = LLVMBuildNot(builder, value, "");
- }
-
- unswizzled[swizzle] = value;
- } else {
- value = unswizzled[swizzle];
- }
-
- pred[chan] = value;
- }
-}
-
/**
* store an array of 8 64-bit into two arrays of 8 floats
* i.e.
@@ -1813,7 +1726,6 @@ emit_fetch_predicate(
static void
emit_store_64bit_chan(struct lp_build_tgsi_context *bld_base,
LLVMValueRef chan_ptr, LLVMValueRef chan_ptr2,
- LLVMValueRef pred,
LLVMValueRef value)
{
struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
@@ -1841,8 +1753,8 @@ emit_store_64bit_chan(struct lp_build_tgsi_context *bld_base,
bld_base->base.type.length),
"");
- lp_exec_mask_store(&bld->exec_mask, float_bld, pred, temp, chan_ptr);
- lp_exec_mask_store(&bld->exec_mask, float_bld, pred, temp2, chan_ptr2);
+ lp_exec_mask_store(&bld->exec_mask, float_bld, temp, chan_ptr);
+ lp_exec_mask_store(&bld->exec_mask, float_bld, temp2, chan_ptr2);
}
/**
@@ -1854,7 +1766,6 @@ emit_store_chan(
const struct tgsi_full_instruction *inst,
unsigned index,
unsigned chan_index,
- LLVMValueRef pred,
LLVMValueRef value)
{
struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
@@ -1917,7 +1828,7 @@ emit_store_chan(
/* Scatter store values into output registers */
emit_mask_scatter(bld, outputs_array, index_vec, value,
- &bld->exec_mask, pred);
+ &bld->exec_mask);
}
else {
LLVMValueRef out_ptr = lp_get_output_ptr(bld, reg->Register.Index,
@@ -1927,9 +1838,9 @@ emit_store_chan(
LLVMValueRef out_ptr2 = lp_get_output_ptr(bld, reg->Register.Index,
chan_index + 1);
emit_store_64bit_chan(bld_base, out_ptr, out_ptr2,
- pred, value);
+ value);
} else
- lp_exec_mask_store(&bld->exec_mask, float_bld, pred, value, out_ptr);
+ lp_exec_mask_store(&bld->exec_mask, float_bld, value, out_ptr);
}
break;
@@ -1955,7 +1866,7 @@ emit_store_chan(
/* Scatter store values into temp registers */
emit_mask_scatter(bld, temps_array, index_vec, value,
- &bld->exec_mask, pred);
+ &bld->exec_mask);
}
else {
LLVMValueRef temp_ptr;
@@ -1966,10 +1877,10 @@ emit_store_chan(
reg->Register.Index,
chan_index + 1);
emit_store_64bit_chan(bld_base, temp_ptr, temp_ptr2,
- pred, value);
+ value);
}
else
- lp_exec_mask_store(&bld->exec_mask, float_bld, pred, value, temp_ptr);
+ lp_exec_mask_store(&bld->exec_mask, float_bld, value, temp_ptr);
}
break;
@@ -1977,17 +1888,10 @@ emit_store_chan(
assert(dtype == TGSI_TYPE_SIGNED);
assert(LLVMTypeOf(value) == int_bld->vec_type);
value = LLVMBuildBitCast(builder, value, int_bld->vec_type, "");
- lp_exec_mask_store(&bld->exec_mask, int_bld, pred, value,
+ lp_exec_mask_store(&bld->exec_mask, int_bld, value,
bld->addr[reg->Register.Index][chan_index]);
break;
- case TGSI_FILE_PREDICATE:
- assert(LLVMTypeOf(value) == float_bld->vec_type);
- value = LLVMBuildBitCast(builder, value, float_bld->vec_type, "");
- lp_exec_mask_store(&bld->exec_mask, float_bld, pred, value,
- bld->preds[reg->Register.Index][chan_index]);
- break;
-
default:
assert( 0 );
}
@@ -2037,18 +1941,14 @@ emit_store(
{
unsigned chan_index;
- struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(inst->Instruction.Opcode);
- if(info->num_dst) {
- LLVMValueRef pred[TGSI_NUM_CHANNELS];
-
- emit_fetch_predicate( bld, inst, pred );
+ if(info->num_dst) {
TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
if (tgsi_type_is_64bit(dtype) && (chan_index == 1 || chan_index == 3))
continue;
- emit_store_chan(bld_base, inst, 0, chan_index, pred[chan_index], dst[chan_index]);
+ emit_store_chan(bld_base, inst, 0, chan_index, dst[chan_index]);
}
}
}
@@ -2998,15 +2898,6 @@ lp_emit_declaration_soa(
}
break;
- case TGSI_FILE_PREDICATE:
- assert(last < LP_MAX_TGSI_PREDS);
- for (idx = first; idx <= last; ++idx) {
- for (i = 0; i < TGSI_NUM_CHANNELS; i++)
- bld->preds[idx][i] = lp_build_alloca(gallivm, vec_type,
- "predicate");
- }
- break;
-
case TGSI_FILE_SAMPLER_VIEW:
/*
* The target stored here MUST match whatever there actually