diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index 04b286f..fdaaf72 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -35,6 +35,7 @@ #include "draw/draw_vs.h" #include "draw/draw_llvm.h" #include "gallivm/lp_bld_init.h" +#include "gallivm/lp_bld_debug.h" struct llvm_middle_end { @@ -236,7 +237,75 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle, return; } - if (fetch_info->linear) + if (fetch_info->linear) { + if(getenv("DRAW_LLVM_DEBUG") { + int i, x; + + _debug_printf("\njit_func at 0x%x -> 0x%x\n", &fpme->current_variant->jit_func, fpme->current_variant->jit_func); + + _debug_printf("\njit_context = 0x%x\n", &fpme->llvm->jit_context); + if(&fpme->llvm->jit_context.vs_constants) + _debug_printf("\n .vs_constants at 0x%x -> 0x%x = %f\n", &fpme->llvm->jit_context.vs_constants, fpme->llvm->jit_context.vs_constants, *fpme->llvm->jit_context.vs_constants); + if(fpme->llvm->jit_context.gs_constants) /* checking address (&) crashes */ + _debug_printf("\n .gs_constants at 0x%x -> 0x%x = %f\n\n", &fpme->llvm->jit_context.gs_constants, fpme->llvm->jit_context.gs_constants, *fpme->llvm->jit_context.gs_constants); + else + _debug_printf("\n .gs_constants is not available\n\n"); + for (i = 0; i <= DRAW_TOTAL_CLIP_PLANES; i++) { + for (x = 0; x <= 4; x++) { + if(&fpme->llvm->jit_context.planes[i][x]) + _debug_printf(" .planes[%d][%d] at 0x%x -> 0x%x = %f\n", i, x, &fpme->llvm->jit_context.planes[i][x], fpme->llvm->jit_context.planes[i][x], *fpme->llvm->jit_context.planes[i][x]); + } + } + if(&fpme->llvm->jit_context.viewport) + _debug_printf("\n .viewport at 0x%x -> 0x%x = %f\n", &fpme->llvm->jit_context.viewport, fpme->llvm->jit_context.viewport, *fpme->llvm->jit_context.viewport); + for (i = 0; i <= PIPE_MAX_SAMPLERS; i++) { + _debug_printf("\n .textures[%d]\n", i); + if(&fpme->llvm->jit_context.textures[i].width) + _debug_printf(" .width at 0x%x = 0x%x\n", &fpme->llvm->jit_context.textures[i].width, fpme->llvm->jit_context.textures[i].width); + if(&fpme->llvm->jit_context.textures[i].height) + _debug_printf(" .height at 0x%x = 0x%x\n", &fpme->llvm->jit_context.textures[i].height, fpme->llvm->jit_context.textures[i].height); + if(&fpme->llvm->jit_context.textures[i].depth) + _debug_printf(" .depth at 0x%x = 0x%x\n", &fpme->llvm->jit_context.textures[i].depth, fpme->llvm->jit_context.textures[i].depth); + if(&fpme->llvm->jit_context.textures[i].first_level) + _debug_printf(" .first_level at 0x%x = 0x%x\n", &fpme->llvm->jit_context.textures[i].first_level, fpme->llvm->jit_context.textures[i].first_level); + if(&fpme->llvm->jit_context.textures[i].last_level) + _debug_printf(" .last_level at 0x%x = 0x%x\n", &fpme->llvm->jit_context.textures[i].last_level, fpme->llvm->jit_context.textures[i].last_level); + for (x = 0; x <= PIPE_MAX_TEXTURE_LEVELS; x++) { + if(&fpme->llvm->jit_context.textures[i].row_stride[x]) + _debug_printf(" .row_stride[%d] at 0x%x = 0x%x\n", x, &fpme->llvm->jit_context.textures[i].row_stride[x], fpme->llvm->jit_context.textures[i].row_stride[x]); + if(&fpme->llvm->jit_context.textures[i].img_stride[x]) + _debug_printf(" .img_stride[%d] at 0x%x = 0x%x\n", x, &fpme->llvm->jit_context.textures[i].img_stride[x], fpme->llvm->jit_context.textures[i].img_stride[x]); + if(fpme->llvm->jit_context.textures[i].data[x]) /* checking address (&) crashes */ + _debug_printf(" .data[%d] at 0x%x -> 0x%x = 0x%x\n", x, &fpme->llvm->jit_context.textures[i].data[x], fpme->llvm->jit_context.textures[i].data[x], *((char *)fpme->llvm->jit_context.textures[i].data[x])); + else + _debug_printf(" .data[%d] is not available\n", x); + } + if(&fpme->llvm->jit_context.textures[i].min_lod) + _debug_printf(" .min_lod at 0x%x = %f\n", &fpme->llvm->jit_context.textures[i].min_lod, fpme->llvm->jit_context.textures[i].min_lod); + if(&fpme->llvm->jit_context.textures[i].max_lod) + _debug_printf(" .max_lod at 0x%x = %f\n", &fpme->llvm->jit_context.textures[i].max_lod, fpme->llvm->jit_context.textures[i].max_lod); + if(&fpme->llvm->jit_context.textures[i].lod_bias) + _debug_printf(" .lod_bias at 0x%x = %f\n", &fpme->llvm->jit_context.textures[i].lod_bias, fpme->llvm->jit_context.textures[i].lod_bias); + for (x = 0; x <= 4; x++) { + if(&fpme->llvm->jit_context.textures[i].border_color[x]) + _debug_printf(" .border_color[%d] at 0x%x = %f\n", x, &fpme->llvm->jit_context.textures[i].border_color[x], fpme->llvm->jit_context.textures[i].border_color[x]); + } + } + + _debug_printf("\nverts = 0x%x\n", llvm_vert_info.verts); + _debug_printf("\nvbuffer = 0x%x\n", (const char **)draw->pt.user.vbuffer); + _debug_printf("\nstart at 0x%x = 0x%x\n", &fetch_info->start, fetch_info->start); + _debug_printf("\ncount at 0x%x = 0x%x\n", &fetch_info->count, fetch_info->count); + _debug_printf("\nvertex_size at 0x%x = 0x%x\n", &fpme->vertex_size, fpme->vertex_size); + _debug_printf("\nvertex_buffer at 0x%x = 0x%x\n", &draw->pt.vertex_buffer, draw->pt.vertex_buffer); + _debug_printf("\ninstance_id at 0x%x = 0x%x\n\n", &draw->instance_id, draw->instance_id); + + _debug_printf("\n\nCalling JIT function\n\t0x%x(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n\n", fpme->current_variant->jit_func, &fpme->llvm->jit_context, llvm_vert_info.verts, (const char **)draw->pt.user.vbuffer, fetch_info->start, fetch_info->count, fpme->vertex_size, draw->pt.vertex_buffer, draw->instance_id); + + _debug_printf("\nRunning lp_disassemble(0x%x)\n\n", fpme->current_variant->jit_func); + lp_disassemble(fpme->current_variant->jit_func); + } + clipped = fpme->current_variant->jit_func( &fpme->llvm->jit_context, llvm_vert_info.verts, (const char **)draw->pt.user.vbuffer, @@ -245,7 +314,7 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle, fpme->vertex_size, draw->pt.vertex_buffer, draw->instance_id); - else + } else clipped = fpme->current_variant->jit_func_elts( &fpme->llvm->jit_context, llvm_vert_info.verts, (const char **)draw->pt.user.vbuffer,