LLVMValueRef vertex_index,
boolean is_aindex_indirect,
LLVMValueRef attrib_index,
+ boolean is_sindex_indirect,
LLVMValueRef swizzle_index,
LLVMValueRef value,
LLVMValueRef mask_vec)
LLVMValueRef res;
struct lp_type type = bld->type;
- if (is_vindex_indirect || is_aindex_indirect) {
+ if (is_vindex_indirect || is_aindex_indirect || is_sindex_indirect) {
int i;
for (i = 0; i < type.length; ++i) {
LLVMValueRef idx = lp_build_const_int32(gallivm, i);
LLVMValueRef vert_chan_index = vertex_index ? vertex_index : lp_build_const_int32(gallivm, 0);
LLVMValueRef attr_chan_index = attrib_index;
+ LLVMValueRef swiz_chan_index = swizzle_index;
LLVMValueRef channel_vec;
if (is_vindex_indirect) {
attrib_index, idx, "");
}
+ if (is_sindex_indirect) {
+ swiz_chan_index = LLVMBuildExtractElement(builder,
+ swizzle_index, idx, "");
+ }
+
indices[0] = vert_chan_index;
indices[1] = attr_chan_index;
- indices[2] = swizzle_index;
+ indices[2] = swiz_chan_index;
channel_vec = LLVMBuildGEP(builder, tcs->output, indices, 3, "");
}
static void emit_store_tcs_chan(struct lp_build_nir_context *bld_base,
+ bool is_compact,
unsigned bit_size,
unsigned location,
unsigned const_index,
LLVMValueRef attrib_index_val;
LLVMValueRef swizzle_index_val = lp_build_const_int32(gallivm, swizzle);
- if (indir_index)
- attrib_index_val = lp_build_add(&bld_base->uint_bld, indir_index, lp_build_const_int_vec(gallivm, bld_base->uint_bld.type, location));
- else
+ if (indir_index) {
+ if (is_compact) {
+ swizzle_index_val = lp_build_add(&bld_base->uint_bld, indir_index, lp_build_const_int_vec(gallivm, bld_base->uint_bld.type, swizzle));
+ attrib_index_val = lp_build_const_int32(gallivm, const_index + location);
+ } else
+ attrib_index_val = lp_build_add(&bld_base->uint_bld, indir_index, lp_build_const_int_vec(gallivm, bld_base->uint_bld.type, location));
+ } else
attrib_index_val = lp_build_const_int32(gallivm, const_index + location);
if (bit_size == 64) {
LLVMValueRef split_vals[2];
indir_vertex_index ? true : false,
indir_vertex_index,
indir_index ? true : false,
- attrib_index_val, swizzle_index_val,
+ attrib_index_val,
+ false, swizzle_index_val,
split_vals[0], mask_vec(bld_base));
bld->tcs_iface->emit_store_output(bld->tcs_iface, &bld_base->base, 0,
indir_vertex_index ? true : false,
indir_vertex_index,
indir_index ? true : false,
- attrib_index_val, swizzle_index_val2,
+ attrib_index_val,
+ false, swizzle_index_val2,
split_vals[1], mask_vec(bld_base));
} else {
chan_val = LLVMBuildBitCast(builder, chan_val, bld_base->base.vec_type, "");
bld->tcs_iface->emit_store_output(bld->tcs_iface, &bld_base->base, 0,
indir_vertex_index ? true : false,
indir_vertex_index,
- indir_index ? true : false,
- attrib_index_val, swizzle_index_val,
+ indir_index && !is_compact ? true : false,
+ attrib_index_val,
+ indir_index && is_compact ? true : false,
+ swizzle_index_val,
chan_val, mask_vec(bld_base));
}
}
comp = 2;
}
+ if (var->data.compact) {
+ location += const_index / 4;
+ comp += const_index % 4;
+ const_index = 0;
+ }
+
for (unsigned chan = 0; chan < num_components; chan++) {
if (writemask & (1u << chan)) {
LLVMValueRef chan_val = (num_components == 1) ? dst : LLVMBuildExtractValue(builder, dst, chan, "");
if (bld->tcs_iface) {
- emit_store_tcs_chan(bld_base, bit_size, location, const_index, indir_vertex_index, indir_index, comp, chan, chan_val);
+ emit_store_tcs_chan(bld_base, var->data.compact, bit_size, location, const_index, indir_vertex_index, indir_index, comp, chan, chan_val);
} else
emit_store_chan(bld_base, deref_mode, bit_size, location + const_index, comp, chan, chan_val);
}