summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_setup.c78
1 files changed, 40 insertions, 38 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c
index 870459f5126..361ee70b662 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c
@@ -50,6 +50,10 @@
#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.
@@ -82,26 +86,26 @@ struct lp_setup_args
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, ""));
}
@@ -728,6 +732,7 @@ generate_setup_variant(struct lp_setup_variant_key *key,
}
builder = gallivm->builder;
+ variant->no = setup_no++;
if (LP_DEBUG & DEBUG_COUNTERS) {
t0 = os_time_get();
@@ -736,8 +741,8 @@ generate_setup_variant(struct lp_setup_variant_key *key,
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.
@@ -810,7 +815,7 @@ generate_setup_variant(struct lp_setup_variant_key *key,
LP_COUNT_ADD(llvm_compile_time, t1 - t0);
LP_COUNT_ADD(nr_llvm_compiles, 1);
}
-
+
return variant;
fail:
@@ -820,7 +825,7 @@ fail:
}
FREE(variant);
}
-
+
return NULL;
}
@@ -828,13 +833,13 @@ fail:
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;
@@ -872,9 +877,9 @@ lp_make_setup_variant_key(struct llvmpipe_context *lp,
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;
}
}
@@ -883,11 +888,11 @@ lp_make_setup_variant_key(struct llvmpipe_context *lp,
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) {
@@ -983,10 +988,10 @@ lp_delete_setup_variants(struct llvmpipe_context *lp)
}
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;
@@ -996,23 +1001,20 @@ lp_dump_setup_coef( const struct lp_setup_variant_key *key,
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);
+ }
}
}
}