#include "lp_state_setup.h"
+/** Setup shader number (for debugging) */
+static unsigned setup_no = 0;
+
+
/* currently organized to interpolate full float[4] attributes even
* when some elements are unused. Later, can pack vertex data more
* closely.
static void
store_coef(struct gallivm_state *gallivm,
- struct lp_setup_args *args,
- unsigned slot,
- LLVMValueRef a0,
- LLVMValueRef dadx,
- LLVMValueRef dady)
+ struct lp_setup_args *args,
+ unsigned slot,
+ LLVMValueRef a0,
+ LLVMValueRef dadx,
+ LLVMValueRef dady)
{
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef idx = lp_build_const_int32(gallivm, slot);
LLVMBuildStore(builder,
- a0,
- LLVMBuildGEP(builder, args->a0, &idx, 1, ""));
+ a0,
+ LLVMBuildGEP(builder, args->a0, &idx, 1, ""));
LLVMBuildStore(builder,
- dadx,
- LLVMBuildGEP(builder, args->dadx, &idx, 1, ""));
+ dadx,
+ LLVMBuildGEP(builder, args->dadx, &idx, 1, ""));
LLVMBuildStore(builder,
- dady,
- LLVMBuildGEP(builder, args->dady, &idx, 1, ""));
+ dady,
+ LLVMBuildGEP(builder, args->dady, &idx, 1, ""));
}
}
builder = gallivm->builder;
+ variant->no = setup_no++;
if (LP_DEBUG & DEBUG_COUNTERS) {
t0 = os_time_get();
memcpy(&variant->key, key, key->size);
variant->list_item_global.base = variant;
- util_snprintf(func_name, sizeof(func_name), "fs%u_setup%u",
- 0, variant->no);
+ util_snprintf(func_name, sizeof(func_name), "setup_variant_%u",
+ variant->no);
/* Currently always deal with full 4-wide vertex attributes from
* the vertices.
LP_COUNT_ADD(llvm_compile_time, t1 - t0);
LP_COUNT_ADD(nr_llvm_compiles, 1);
}
-
+
return variant;
fail:
}
FREE(variant);
}
-
+
return NULL;
}
static void
lp_make_setup_variant_key(struct llvmpipe_context *lp,
- struct lp_setup_variant_key *key)
+ struct lp_setup_variant_key *key)
{
struct lp_fragment_shader *fs = lp->fs;
unsigned i;
assert(sizeof key->inputs[0] == sizeof(uint));
-
+
key->num_inputs = fs->info.base.num_inputs;
key->flatshade_first = lp->rasterizer->flatshade_first;
key->pixel_center_half = lp->rasterizer->half_pixel_center;
for (i = 0; i < key->num_inputs; i++) {
if (key->inputs[i].interp == LP_INTERP_COLOR) {
if (lp->rasterizer->flatshade)
- key->inputs[i].interp = LP_INTERP_CONSTANT;
- else
- key->inputs[i].interp = LP_INTERP_PERSPECTIVE;
+ key->inputs[i].interp = LP_INTERP_CONSTANT;
+ else
+ key->inputs[i].interp = LP_INTERP_PERSPECTIVE;
}
}
static void
remove_setup_variant(struct llvmpipe_context *lp,
- struct lp_setup_variant *variant)
+ struct lp_setup_variant *variant)
{
if (gallivm_debug & GALLIVM_DEBUG_IR) {
debug_printf("llvmpipe: del setup_variant #%u total %u\n",
- variant->no, lp->nr_setup_variants);
+ variant->no, lp->nr_setup_variants);
}
if (variant->gallivm) {
}
void
-lp_dump_setup_coef( const struct lp_setup_variant_key *key,
- const float (*sa0)[4],
- const float (*sdadx)[4],
- const float (*sdady)[4])
+lp_dump_setup_coef(const struct lp_setup_variant_key *key,
+ const float (*sa0)[4],
+ const float (*sdadx)[4],
+ const float (*sdady)[4])
{
int i, slot;
float dady = sdady[0][i];
debug_printf("POS.%c: a0 = %f, dadx = %f, dady = %f\n",
- "xyzw"[i],
- a0, dadx, dady);
+ "xyzw"[i], a0, dadx, dady);
}
for (slot = 0; slot < key->num_inputs; slot++) {
unsigned usage_mask = key->inputs[slot].usage_mask;
for (i = 0; i < TGSI_NUM_CHANNELS; i++) {
- if (usage_mask & (1 << i)) {
- float a0 = sa0 [1 + slot][i];
- float dadx = sdadx[1 + slot][i];
- float dady = sdady[1 + slot][i];
-
- debug_printf("IN[%u].%c: a0 = %f, dadx = %f, dady = %f\n",
- slot,
- "xyzw"[i],
- a0, dadx, dady);
- }
+ if (usage_mask & (1 << i)) {
+ float a0 = sa0 [1 + slot][i];
+ float dadx = sdadx[1 + slot][i];
+ float dady = sdady[1 + slot][i];
+
+ debug_printf("IN[%u].%c: a0 = %f, dadx = %f, dady = %f\n",
+ slot, "xyzw"[i], a0, dadx, dady);
+ }
}
}
}