diff options
author | Oded Gabbay <oded.gabbay@gmail.com> | 2015-10-29 08:12:07 +0200 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@gmail.com> | 2016-02-26 17:31:21 +0200 |
commit | 5c5ad28d7c54ef9741fe206c615234791500a51f (patch) | |
tree | a4732ec78bd43202222e8234dfe687fed32ad6b9 | |
parent | 59e9b7d1e65586fa9b2d84d9dc641d7e1bd32970 (diff) |
Add debug prints to llvmpipenemanjai
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_interp.c | 102 |
1 files changed, 94 insertions, 8 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c index ceac86abe1..1032adb1da 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c @@ -43,9 +43,9 @@ #include "gallivm/lp_bld_arit.h" #include "gallivm/lp_bld_swizzle.h" #include "gallivm/lp_bld_flow.h" +#include "gallivm/lp_bld_printf.h" #include "lp_bld_interp.h" - /* * The shader JIT function operates on blocks of quads. * Each block has 2x2 quads and each quad has 2x2 pixels. @@ -213,6 +213,7 @@ coeffs_init_simple(struct lp_build_interp_soa_context *bld, ptr = LLVMBuildBitCast(builder, ptr, LLVMPointerType(setup_bld->vec_type, 0), ""); a0aos = LLVMBuildLoad(builder, ptr, ""); + lp_build_print_value(gallivm, "a0aos = ", a0aos); attrib_name(a0aos, attrib, 0, ".a0aos"); break; @@ -246,8 +247,8 @@ attribs_update_simple(struct lp_build_interp_soa_context *bld, struct lp_build_context *setup_bld = &bld->setup_bld; LLVMValueRef oow = NULL; unsigned attrib; - LLVMValueRef pixoffx; - LLVMValueRef pixoffy; + LLVMValueRef pixoffx, x; + LLVMValueRef pixoffy, y; LLVMValueRef ptr; /* could do this with code-generated passed in pixel offsets too */ @@ -258,10 +259,29 @@ attribs_update_simple(struct lp_build_interp_soa_context *bld, ptr = LLVMBuildGEP(builder, bld->yoffset_store, &loop_iter, 1, ""); pixoffy = LLVMBuildLoad(builder, ptr, ""); + if (1) { + lp_build_printf(gallivm, "\n-----------------------------\n"); + lp_build_print_value(gallivm, "pixoffx = ", pixoffx); + lp_build_print_value(gallivm, "pixoffy = ", pixoffy); + lp_build_printf(gallivm, "\n"); + } + + x = lp_build_broadcast_scalar(coeff_bld, bld->x); + y = lp_build_broadcast_scalar(coeff_bld, bld->y); + pixoffx = LLVMBuildFAdd(builder, pixoffx, - lp_build_broadcast_scalar(coeff_bld, bld->x), ""); + x, ""); pixoffy = LLVMBuildFAdd(builder, pixoffy, - lp_build_broadcast_scalar(coeff_bld, bld->y), ""); + y, ""); + + if (1) { + lp_build_print_value(gallivm, "x = ", x); + lp_build_print_value(gallivm, "y = ", y); + lp_build_printf(gallivm, "\n"); + lp_build_print_value(gallivm, "pixoffx + x = ", pixoffx); + lp_build_print_value(gallivm, "pixoffy + y = ", pixoffy); + lp_build_printf(gallivm, "\n"); + } for (attrib = start; attrib < end; attrib++) { const unsigned mask = bld->mask[attrib]; @@ -304,6 +324,10 @@ attribs_update_simple(struct lp_build_interp_soa_context *bld, coeff_bld->type, bld->a0aos[attrib], index); } + lp_build_printf(gallivm, "\n"); + lp_build_print_value(gallivm, "a0 = ", a); + lp_build_print_value(gallivm, "dadx = ", dadx); + lp_build_print_value(gallivm, "dady = ", dady); /* * a = a0 + (x * dadx + y * dady) */ @@ -312,6 +336,10 @@ attribs_update_simple(struct lp_build_interp_soa_context *bld, a = LLVMBuildFAdd(builder, a, dadx, ""); a = LLVMBuildFAdd(builder, a, dady, ""); + lp_build_print_value(gallivm, "dadx*pixoffx = ", dadx); + lp_build_print_value(gallivm, "dady*pixoffy = ", dady); + lp_build_print_value(gallivm, "a = ", a); + if (interp == LP_INTERP_PERSPECTIVE) { if (oow == NULL) { LLVMValueRef w = bld->attribs[0][3]; @@ -382,6 +410,11 @@ coeffs_init(struct lp_build_interp_soa_context *bld, pixoffy = LLVMBuildInsertElement(builder, pixoffy, pixyf, nr, ""); } + if (1) { + lp_build_print_value(gallivm, "pixoffx = ", pixoffx); + lp_build_print_value(gallivm, "pixoffy = ", pixoffy); + lp_build_printf(gallivm, "\n"); + } for (attrib = 0; attrib < bld->num_attribs; ++attrib) { const unsigned mask = bld->mask[attrib]; @@ -431,21 +464,40 @@ coeffs_init(struct lp_build_interp_soa_context *bld, break; } + if (1) { + lp_build_print_value(gallivm, "dadxaos = ", dadxaos); + lp_build_print_value(gallivm, "dadyaos = ", dadyaos); + lp_build_print_value(gallivm, "a0aos = ", a0aos); + lp_build_printf(gallivm, "\n"); + } + /* * a = a0 + (x * dadx + y * dady) * a0aos is the attrib value at top left corner of stamp */ if (interp != LP_INTERP_CONSTANT && interp != LP_INTERP_FACING) { - LLVMValueRef axaos, ayaos; - axaos = LLVMBuildFMul(builder, lp_build_broadcast_scalar(setup_bld, bld->x), + LLVMValueRef axaos, ayaos, x, y; + x = lp_build_broadcast_scalar(setup_bld, bld->x); + y = lp_build_broadcast_scalar(setup_bld, bld->y); + axaos = LLVMBuildFMul(builder, x, dadxaos, ""); - ayaos = LLVMBuildFMul(builder, lp_build_broadcast_scalar(setup_bld, bld->y), + ayaos = LLVMBuildFMul(builder, y, dadyaos, ""); a0aos = LLVMBuildFAdd(builder, a0aos, ayaos, ""); a0aos = LLVMBuildFAdd(builder, a0aos, axaos, ""); + + if (1) { + lp_build_print_value(gallivm, "x = ", x); + lp_build_print_value(gallivm, "y = ", y); + lp_build_print_value(gallivm, "axaos = ", axaos); + lp_build_print_value(gallivm, "ayaos = ", ayaos); + lp_build_print_value(gallivm, "a0aos = ", a0aos); + lp_build_printf(gallivm, "\n"); + } } + /* * dadq = {0, dadx, dady, dadx + dady} * for two quads (side by side) this is: @@ -490,10 +542,22 @@ coeffs_init(struct lp_build_interp_soa_context *bld, coeff_bld->type, a0aos, chan_index); } + if (1) { + lp_build_print_value(gallivm, "a = ", a); + lp_build_print_value(gallivm, "dadx = ", dadx); + lp_build_print_value(gallivm, "dady = ", dady); + } + dadx = LLVMBuildFMul(builder, dadx, pixoffx, ""); dady = LLVMBuildFMul(builder, dady, pixoffy, ""); dadq = LLVMBuildFAdd(builder, dadx, dady, ""); + if (1) { + lp_build_print_value(gallivm, "dadx*pixoffx = ", dadx); + lp_build_print_value(gallivm, "dady*pixoffy = ", dady); + lp_build_print_value(gallivm, "dadq = ", dadq); + } + /* * Compute the attrib values on the upper-left corner of each * group of quads. @@ -507,6 +571,12 @@ coeffs_init(struct lp_build_interp_soa_context *bld, interp != LP_INTERP_FACING) { dadq2 = LLVMBuildFAdd(builder, dadq, dadq, ""); a = LLVMBuildFAdd(builder, a, dadq2, ""); + + if (1) { + lp_build_print_value(gallivm, "dadq2 = ", dadq2); + lp_build_print_value(gallivm, "a+dadq2 = ", a); + lp_build_printf(gallivm, "\n"); + } } #if PERSPECTIVE_DIVIDE_PER_QUAD @@ -620,12 +690,17 @@ attribs_update(struct lp_build_interp_soa_context *bld, } #endif + lp_build_print_value(gallivm, "before add of dadq = ", a); + lp_build_print_value(gallivm, "dadq = ", dadq); + /* * Add the derivatives */ a = lp_build_add(coeff_bld, a, dadq); + lp_build_print_value(gallivm, "after add of dadq = ", a); + #if !PERSPECTIVE_DIVIDE_PER_QUAD if (interp == LP_INTERP_PERSPECTIVE) { if (oow == NULL) { @@ -647,6 +722,17 @@ attribs_update(struct lp_build_interp_soa_context *bld, } attrib_name(a, attrib, chan, ""); + + if (chan == 0) + lp_build_print_value(gallivm, "pos.x = ", a); + else if (chan == 1) + lp_build_print_value(gallivm, "pos.y = ", a); + else if (chan == 2) + lp_build_print_value(gallivm, "pos.z = ", a); + else + lp_build_print_value(gallivm, "pos.w = ", a); + + lp_build_printf(gallivm, "\n"); } bld->attribs[attrib][chan] = a; } |