diff options
89 files changed, 266 insertions, 141 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c index 6b1754ea002..0bc77a57287 100644 --- a/src/gallium/auxiliary/cso_cache/cso_cache.c +++ b/src/gallium/auxiliary/cso_cache/cso_cache.c @@ -28,7 +28,7 @@ /* Authors: Zack Rusin <[email protected]> */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.c b/src/gallium/auxiliary/cso_cache/cso_hash.c index 4e7664f9bf0..288cef7b6fa 100644 --- a/src/gallium/auxiliary/cso_cache/cso_hash.c +++ b/src/gallium/auxiliary/cso_cache/cso_hash.c @@ -30,7 +30,7 @@ * Zack Rusin <[email protected]> */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "cso_hash.h" diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c index ffeeeb6edeb..12325d30d61 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c +++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c @@ -29,12 +29,12 @@ * \file * Vertex buffer drawing stage. * - * \author Jos� Fonseca <[email protected]> + * \author Jose Fonseca <[email protected]> * \author Keith Whitwell <[email protected]> */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_math.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 0c693a4a65c..46a36af4180 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -32,7 +32,7 @@ #include "util/u_memory.h" #include "util/u_math.h" #include "pipe/p_shader_tokens.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_util.h" #include "tgsi/tgsi_exec.h" @@ -284,6 +284,14 @@ void aos_release_xmm_reg( struct aos_compilation *cp, } +static void aos_soft_release_xmm( struct aos_compilation *cp, + struct x86_reg reg ) +{ + if (reg.file == file_XMM) { + cp->xmm[reg.idx].last_used = cp->insn_counter - 1; + } +} + /* Mark an xmm reg as holding the current copy of a shader reg. @@ -584,10 +592,12 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, sse_mulps(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); + aos_soft_release_xmm(cp, imm_swz); } else if (negs) { struct x86_reg imm_negs = aos_get_internal_xmm(cp, IMM_NEGS); sse_mulps(cp->func, dst, imm_negs); + aos_soft_release_xmm(cp, imm_negs); } @@ -603,8 +613,10 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, sse_maxps(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); + aos_soft_release_xmm(cp, neg); } + aos_soft_release_xmm(cp, arg0); return dst; } @@ -1559,7 +1571,6 @@ static boolean emit_RCP( struct aos_compilation *cp, const struct tgsi_full_inst */ static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - if (0) { struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); struct x86_reg r = aos_get_xmm_reg(cp); @@ -1568,21 +1579,30 @@ static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_inst return TRUE; } else { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg r = aos_get_xmm_reg(cp); + struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); + struct x86_reg r = aos_get_xmm_reg(cp); struct x86_reg neg_half = get_reg_ptr( cp, AOS_FILE_INTERNAL, IMM_RSQ ); struct x86_reg one_point_five = x86_make_disp( neg_half, 4 ); struct x86_reg src = get_xmm_writable( cp, arg0 ); - - sse_rsqrtss( cp->func, r, src ); /* rsqrtss(a) */ - sse_mulss( cp->func, src, neg_half ); /* -.5 * a */ - sse_mulss( cp->func, src, r ); /* -.5 * a * r */ - sse_mulss( cp->func, src, r ); /* -.5 * a * r * r */ - sse_addss( cp->func, src, one_point_five ); /* 1.5 - .5 * a * r * r */ - sse_mulss( cp->func, r, src ); /* r * (1.5 - .5 * a * r * r) */ + struct x86_reg neg = aos_get_internal(cp, IMM_NEGS); + struct x86_reg tmp = aos_get_xmm_reg(cp); + + sse_movaps(cp->func, tmp, src); + sse_mulps(cp->func, tmp, neg); + sse_maxps(cp->func, tmp, src); + + sse_rsqrtss( cp->func, r, tmp ); /* rsqrtss(a) */ + sse_mulss( cp->func, tmp, neg_half ); /* -.5 * a */ + sse_mulss( cp->func, tmp, r ); /* -.5 * a * r */ + sse_mulss( cp->func, tmp, r ); /* -.5 * a * r * r */ + sse_addss( cp->func, tmp, one_point_five ); /* 1.5 - .5 * a * r * r */ + sse_mulss( cp->func, r, tmp ); /* r * (1.5 - .5 * a * r * r) */ store_scalar_dest(cp, &op->FullDstRegisters[0], r); + + aos_release_xmm_reg(cp, tmp.idx); + return TRUE; } } diff --git a/src/gallium/auxiliary/gallivm/storagesoa.cpp b/src/gallium/auxiliary/gallivm/storagesoa.cpp index e1e5cabcf55..4984ce985c6 100644 --- a/src/gallium/auxiliary/gallivm/storagesoa.cpp +++ b/src/gallium/auxiliary/gallivm/storagesoa.cpp @@ -30,7 +30,7 @@ #include "gallivm_p.h" #include "pipe/p_shader_tokens.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include <llvm/BasicBlock.h> #include <llvm/Module.h> diff --git a/src/gallium/auxiliary/indices/u_indices_gen.c b/src/gallium/auxiliary/indices/u_indices_gen.c index 4c05b3eedb3..3c981e5d7f4 100644 --- a/src/gallium/auxiliary/indices/u_indices_gen.c +++ b/src/gallium/auxiliary/indices/u_indices_gen.c @@ -34,7 +34,7 @@ #include "indices/u_indices.h" #include "indices/u_indices_priv.h" #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_defines.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py index 0dc58d0cd0e..af63d099302 100644 --- a/src/gallium/auxiliary/indices/u_indices_gen.py +++ b/src/gallium/auxiliary/indices/u_indices_gen.py @@ -72,7 +72,7 @@ def prolog(): #include "indices/u_indices.h" #include "indices/u_indices_priv.h" #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_defines.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index d8f1f02d681..e6b0b30ff44 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -45,7 +45,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_error.h" #include "pipe/p_state.h" #include "pipe/p_inlines.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index f9e62264368..0cddc95aa67 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -43,7 +43,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_error.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_thread.h" #include "util/u_memory.h" #include "util/u_double_list.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h index d1c9d4c17df..c2b29e974b1 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h @@ -51,7 +51,7 @@ #define PB_BUFFER_FENCED_H_ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #ifdef __cplusplus diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c index 53f497cfb04..282802b1717 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c @@ -34,7 +34,7 @@ */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "pb_buffer.h" #include "pb_bufmgr.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c index c956924cc76..db67d46c561 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c @@ -34,7 +34,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "pb_buffer.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index a1688537134..29117efe9bd 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -35,7 +35,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_thread.h" #include "util/u_memory.h" #include "util/u_double_list.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 26d9c24aec2..070bf3f5173 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -34,7 +34,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_thread.h" #include "util/u_math.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c index 47e9fee5338..e352f5357b5 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c @@ -34,7 +34,7 @@ */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "pb_buffer.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c index 2f5a5d8ea07..f3b1ca73b0c 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c @@ -34,7 +34,7 @@ #include "pipe/p_defines.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_thread.h" #include "util/u_memory.h" #include "util/u_double_list.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c index ba02a84e62d..3d9c7bba0ba 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c @@ -34,7 +34,7 @@ */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "pb_buffer.h" #include "pb_bufmgr.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c index a6ff37653e9..12447acfd93 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c @@ -36,7 +36,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_thread.h" #include "pipe/p_defines.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c index 9b9fedccb4b..a3259351b92 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c @@ -38,7 +38,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_error.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_thread.h" #include "pipe/p_defines.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c b/src/gallium/auxiliary/pipebuffer/pb_validate.c index 94532bb4cec..150fd506181 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_validate.c +++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c @@ -36,7 +36,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_error.h" #include "util/u_memory.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pb_buffer.h" #include "pb_buffer_fenced.h" diff --git a/src/gallium/auxiliary/rtasm/rtasm_cpu.c b/src/gallium/auxiliary/rtasm/rtasm_cpu.c index 5499018b219..03bdd472386 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_cpu.c +++ b/src/gallium/auxiliary/rtasm/rtasm_cpu.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "rtasm_cpu.h" diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index be7433baf87..5acc5bcb7b0 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c +++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c @@ -31,7 +31,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_thread.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/rtasm/rtasm_ppc.c b/src/gallium/auxiliary/rtasm/rtasm_ppc.c index 1bb90262051..e3586482db4 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_ppc.c +++ b/src/gallium/auxiliary/rtasm/rtasm_ppc.c @@ -38,7 +38,7 @@ #include <stdio.h> #include "util/u_memory.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "rtasm_execmem.h" #include "rtasm_ppc.h" diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c index 99ee74cf14b..57fcf6de2ab 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c @@ -26,7 +26,7 @@ #if defined(PIPE_ARCH_X86) #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_pointer.h" #include "rtasm_execmem.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 17886540cf7..a1891a140ac 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "tgsi_build.h" #include "tgsi_parse.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index ab2b1f2c58a..d57cb9139f7 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_string.h" #include "tgsi_dump.h" #include "tgsi_info.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 2ecf1e2f14b..3dc61c48ca3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_string.h" #include "tgsi_dump_c.h" #include "tgsi_build.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index ab641efb603..5c5d8d25500 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1889,6 +1889,7 @@ exec_instruction( case TGSI_OPCODE_RSQ: /* TGSI_OPCODE_RECIPSQRT */ FETCH( &r[0], 0, CHAN_X ); + micro_abs( &r[0], &r[0] ); micro_sqrt( &r[0], &r[0] ); micro_div( &r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &r[0] ); FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 68c7a6b7f58..2b8a6f0fb19 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "tgsi_info.h" static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = diff --git a/src/gallium/auxiliary/tgsi/tgsi_iterate.c b/src/gallium/auxiliary/tgsi/tgsi_iterate.c index 5371a88b964..d88c2558d81 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_iterate.c +++ b/src/gallium/auxiliary/tgsi/tgsi_iterate.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "tgsi_iterate.h" boolean diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index d374b16f9a1..22006edf3d1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "tgsi_parse.h" #include "tgsi_build.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c index f365030e526..0c64ae57131 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c @@ -33,7 +33,7 @@ #if defined(PIPE_ARCH_PPC) -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "util/u_math.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index bc7b941b785..76e773da91c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "tgsi_sanity.h" #include "tgsi_info.h" #include "tgsi_iterate.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 481ba89c5e7..d70bcd03c5c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -29,7 +29,7 @@ #if defined(PIPE_ARCH_X86) -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "util/u_math.h" #if defined(PIPE_ARCH_SSE) @@ -1575,6 +1575,7 @@ emit_instruction( case TGSI_OPCODE_RSQ: /* TGSI_OPCODE_RECIPSQRT */ FETCH( func, *inst, 0, 0, CHAN_X ); + emit_abs( func, 0 ); emit_rsqrt( func, 1, 0 ); FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { STORE( func, *inst, 1, 0, chan_index ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 1e822fbbea1..58fe07c11d1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "tgsi_text.h" #include "tgsi_build.h" #include "tgsi_info.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c index ea87da31e50..062c1be938a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_transform.c +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c @@ -31,7 +31,7 @@ * Authors: Brian Paul */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "tgsi_transform.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c index 50101a9bb0c..71f8a6ca401 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_util.c +++ b/src/gallium/auxiliary/tgsi/tgsi_util.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "tgsi_parse.h" #include "tgsi_build.h" diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile index 44c23777218..671e671df23 100644 --- a/src/gallium/auxiliary/util/Makefile +++ b/src/gallium/auxiliary/util/Makefile @@ -4,7 +4,7 @@ include $(TOP)/configs/current LIBNAME = util C_SOURCES = \ - p_debug.c \ + u_debug.c \ u_blit.c \ u_cache.c \ u_draw_quad.c \ diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript index 35f683fb8e6..84e4c484761 100644 --- a/src/gallium/auxiliary/util/SConscript +++ b/src/gallium/auxiliary/util/SConscript @@ -3,11 +3,11 @@ Import('*') util = env.ConvenienceLibrary( target = 'util', source = [ - 'p_debug.c', - 'p_debug_mem.c', - 'p_debug_prof.c', 'u_blit.c', 'u_cache.c', + 'u_debug.c', + 'u_debug_memory.c', + 'u_debug_profile.c', 'u_draw_quad.c', 'u_gen_mipmap.c', 'u_handle_table.c', diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 841e9c01e7e..efc3a874cc2 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -34,7 +34,7 @@ #include "pipe/p_context.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c index 0a1a64259f1..41cd38171fa 100644 --- a/src/gallium/auxiliary/util/u_cache.c +++ b/src/gallium/auxiliary/util/u_cache.c @@ -36,7 +36,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_math.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/u_debug.c index f373f941dd8..43d424b1d6a 100644 --- a/src/gallium/auxiliary/util/p_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -59,7 +59,7 @@ #endif #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_format.h" #include "pipe/p_state.h" #include "pipe/p_inlines.h" diff --git a/src/gallium/include/pipe/p_debug.h b/src/gallium/auxiliary/util/u_debug.h index e9c95982dda..b298b9b66db 100644 --- a/src/gallium/include/pipe/p_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -35,13 +35,13 @@ * @author Jose Fonseca <[email protected]> */ -#ifndef P_DEBUG_H_ -#define P_DEBUG_H_ +#ifndef U_DEBUG_H_ +#define U_DEBUG_H_ #include <stdarg.h> -#include "p_compiler.h" +#include "pipe/p_compiler.h" #ifdef __cplusplus @@ -358,4 +358,4 @@ void debug_dump_surface_bmp(const char *filename, } #endif -#endif /* P_DEBUG_H_ */ +#endif /* U_DEBUG_H_ */ diff --git a/src/gallium/auxiliary/util/p_debug_mem.c b/src/gallium/auxiliary/util/u_debug_memory.c index 250fd60f634..f6c136f6e5a 100644 --- a/src/gallium/auxiliary/util/p_debug_mem.c +++ b/src/gallium/auxiliary/util/u_debug_memory.c @@ -44,7 +44,7 @@ #include <stdlib.h> #endif -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_double_list.h" diff --git a/src/gallium/auxiliary/util/p_debug_prof.c b/src/gallium/auxiliary/util/u_debug_profile.c index 5f9772ef917..5f9772ef917 100644 --- a/src/gallium/auxiliary/util/p_debug_prof.c +++ b/src/gallium/auxiliary/util/u_debug_profile.c diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 2b4cdab6cf3..7c20c7ce7bb 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -35,7 +35,7 @@ #include "pipe/p_context.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/auxiliary/util/u_handle_table.c b/src/gallium/auxiliary/util/u_handle_table.c index 2d15932ce3b..6da7353e259 100644 --- a/src/gallium/auxiliary/util/u_handle_table.c +++ b/src/gallium/auxiliary/util/u_handle_table.c @@ -34,7 +34,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "util/u_handle_table.h" diff --git a/src/gallium/auxiliary/util/u_hash_table.c b/src/gallium/auxiliary/util/u_hash_table.c index 0bc8de9632c..2f83e318e44 100644 --- a/src/gallium/auxiliary/util/u_hash_table.c +++ b/src/gallium/auxiliary/util/u_hash_table.c @@ -39,7 +39,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "cso_cache/cso_hash.h" diff --git a/src/gallium/auxiliary/util/u_keymap.c b/src/gallium/auxiliary/util/u_keymap.c index 01b17ddb1b3..3f70809efdc 100644 --- a/src/gallium/auxiliary/util/u_keymap.c +++ b/src/gallium/auxiliary/util/u_keymap.c @@ -35,7 +35,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_error.h" #include "cso_cache/cso_hash.h" diff --git a/src/gallium/auxiliary/util/u_linear.c b/src/gallium/auxiliary/util/u_linear.c index e999cefe748..6be365e53bb 100644 --- a/src/gallium/auxiliary/util/u_linear.c +++ b/src/gallium/auxiliary/util/u_linear.c @@ -1,5 +1,5 @@ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "u_linear.h" void diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index ab6f39ac31f..1ecde7a9125 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -40,7 +40,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #ifdef __cplusplus diff --git a/src/gallium/auxiliary/util/u_memory.h b/src/gallium/auxiliary/util/u_memory.h index 1a6b596421f..ceb3a1cb615 100644 --- a/src/gallium/auxiliary/util/u_memory.h +++ b/src/gallium/auxiliary/util/u_memory.h @@ -36,7 +36,7 @@ #include "util/u_pointer.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #ifdef __cplusplus @@ -52,11 +52,11 @@ extern "C" { #endif -#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) && defined(DEBUG) +#if defined(PIPE_OS_WINDOWS) && defined(DEBUG) /* memory debugging */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #define MALLOC( _size ) \ debug_malloc( __FILE__, __LINE__, __FUNCTION__, _size ) diff --git a/src/gallium/auxiliary/util/u_mm.c b/src/gallium/auxiliary/util/u_mm.c index 45ce257b5e5..151a480d34d 100644 --- a/src/gallium/auxiliary/util/u_mm.c +++ b/src/gallium/auxiliary/util/u_mm.c @@ -24,7 +24,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "util/u_mm.h" diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 706155e99a7..3cd2d52c64c 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -34,7 +34,7 @@ #include "pipe/p_context.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_screen.h" diff --git a/src/gallium/drivers/cell/spu/spu_util.c b/src/gallium/drivers/cell/spu/spu_util.c index b8a0d4a265f..af25dd3718a 100644 --- a/src/gallium/drivers/cell/spu/spu_util.c +++ b/src/gallium/drivers/cell/spu/spu_util.c @@ -1,7 +1,7 @@ #include "cell/common.h" #include "pipe/p_shader_tokens.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "tgsi/tgsi_parse.h" //#include "tgsi_build.h" #include "tgsi/tgsi_util.h" diff --git a/src/gallium/drivers/i915simple/i915_debug.c b/src/gallium/drivers/i915simple/i915_debug.c index a300b61c3b9..e08582efaba 100644 --- a/src/gallium/drivers/i915simple/i915_debug.c +++ b/src/gallium/drivers/i915simple/i915_debug.c @@ -31,7 +31,7 @@ #include "i915_debug.h" #include "i915_batch.h" #include "pipe/internal/p_winsys_screen.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" static void diff --git a/src/gallium/drivers/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c index e157b55f07d..58c41840e1f 100644 --- a/src/gallium/drivers/i915simple/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915simple/i915_prim_vbuf.c @@ -40,7 +40,7 @@ #include "draw/draw_context.h" #include "draw/draw_vbuf.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_inlines.h" #include "pipe/internal/p_winsys_screen.h" #include "util/u_math.h" diff --git a/src/gallium/drivers/i965simple/brw_eu_debug.c b/src/gallium/drivers/i965simple/brw_eu_debug.c index 4a94ddefa6a..4adfb0c02f5 100644 --- a/src/gallium/drivers/i965simple/brw_eu_debug.c +++ b/src/gallium/drivers/i965simple/brw_eu_debug.c @@ -30,7 +30,7 @@ */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "brw_eu.h" diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index 4ae4ff49404..029b01e17d5 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -1,7 +1,7 @@ #ifndef __NOUVEAU_STATEOBJ_H__ #define __NOUVEAU_STATEOBJ_H__ -#include "pipe/p_debug.h" +#include "util/u_debug.h" struct nouveau_stateobj_reloc { struct pipe_buffer *bo; diff --git a/src/gallium/drivers/nv04/nv04_prim_vbuf.c b/src/gallium/drivers/nv04/nv04_prim_vbuf.c index 68c61e18ff8..f6458232ae5 100644 --- a/src/gallium/drivers/nv04/nv04_prim_vbuf.c +++ b/src/gallium/drivers/nv04/nv04_prim_vbuf.c @@ -1,5 +1,5 @@ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_inlines.h" #include "pipe/internal/p_winsys_screen.h" #include "pipe/p_compiler.h" diff --git a/src/gallium/drivers/nv10/nv10_prim_vbuf.c b/src/gallium/drivers/nv10/nv10_prim_vbuf.c index 6f824df680d..491a8818068 100644 --- a/src/gallium/drivers/nv10/nv10_prim_vbuf.c +++ b/src/gallium/drivers/nv10/nv10_prim_vbuf.c @@ -38,7 +38,7 @@ */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_inlines.h" #include "pipe/internal/p_winsys_screen.h" diff --git a/src/gallium/drivers/nv20/nv20_prim_vbuf.c b/src/gallium/drivers/nv20/nv20_prim_vbuf.c index 8015b81b72a..319e1f65572 100644 --- a/src/gallium/drivers/nv20/nv20_prim_vbuf.c +++ b/src/gallium/drivers/nv20/nv20_prim_vbuf.c @@ -38,7 +38,7 @@ */ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_inlines.h" #include "pipe/internal/p_winsys_screen.h" diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index 794fa2b9b81..196537a432d 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -21,7 +21,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "r300_chipset.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" /* r300_chipset: A file all to itself for deducing the various properties of * Radeons. */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index c8533d764df..da99a3be6b6 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -23,7 +23,7 @@ #include "util/u_math.h" #include "util/u_pack_color.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/internal/p_winsys_screen.h" #include "r300_context.h" diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index ab76009375c..bd5a672f77e 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -40,7 +40,7 @@ #include "sp_texture.h" #include "sp_tile_cache.h" -#define NUM_ENTRIES 32 +#define NUM_ENTRIES 50 /** XXX move these */ @@ -484,7 +484,7 @@ sp_get_cached_tile(struct softpipe_context *softpipe, static INLINE uint tex_cache_pos(int x, int y, int z, int face, int level) { - uint entry = x + y * 5 + z * 4 + face + level; + uint entry = x + y * 9 + z * 3 + face + level * 7; return entry % NUM_ENTRIES; } @@ -510,8 +510,12 @@ sp_get_cached_tile_tex(struct softpipe_context *sp, if (tc->texture) { struct softpipe_texture *spt = softpipe_texture(tc->texture); if (spt->modified) { - /* texture was modified, force a cache reload */ - tile->x = -1; + /* texture was modified, invalidate all cached tiles */ + uint p; + for (p = 0; p < NUM_ENTRIES; p++) { + tile = tc->entries + p; + tile->x = -1; + } spt->modified = FALSE; } } @@ -523,6 +527,10 @@ sp_get_cached_tile_tex(struct softpipe_context *sp, level != tile->level) { /* cache miss */ +#if 0 + printf("miss at %u x=%d y=%d z=%d face=%d level=%d\n", pos, + x/TILE_SIZE, y/TILE_SIZE, z, face, level); +#endif /* check if we need to get a new surface */ if (!tc->tex_surf || tc->tex_face != face || diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index 7831900ec29..67041759643 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -30,7 +30,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_context.h" diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index a0ead0ded33..d98cef221b7 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -45,7 +45,7 @@ #endif #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "util/u_string.h" #include "util/u_stream.h" diff --git a/src/gallium/drivers/trace/tr_winsys.h b/src/gallium/drivers/trace/tr_winsys.h index 0fd2a405569..3670cb915ed 100644 --- a/src/gallium/drivers/trace/tr_winsys.h +++ b/src/gallium/drivers/trace/tr_winsys.h @@ -30,7 +30,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/internal/p_winsys_screen.h" diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index b42f98ceba1..3f65a604364 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -30,8 +30,9 @@ #define PIPE_FORMAT_H #include "p_compiler.h" -#include "p_debug.h" +/* FIXME: remove these header dependencies */ +#include "util/u_debug.h" #include "util/u_string.h" #ifdef __cplusplus diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index 1aa4b8a6e22..5ac871da814 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -30,7 +30,7 @@ #include "GL/gl.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_thread.h" #include "shared/stw_public.h" diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 6873e813ee3..4b3cf51a537 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -27,7 +27,7 @@ #include <windows.h> -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "pipe/p_screen.h" #include "shared/stw_device.h" @@ -66,6 +66,10 @@ stw_shared_init(const struct stw_winsys *stw_winsys) stw_dev = &stw_dev_storage; memset(stw_dev, 0, sizeof(*stw_dev)); +#ifdef DEBUG + stw_dev->memdbg_no = debug_memory_begin(); +#endif + stw_dev->stw_winsys = stw_winsys; stw_dev->screen = stw_winsys->create_screen(); @@ -87,5 +91,11 @@ error1: void stw_shared_cleanup(void) { + if(stw_dev) { +#ifdef DEBUG + debug_memory_end(stw_dev->memdbg_no); +#endif + } + stw_dev = NULL; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h index bc0bce37c6e..c1e041212b7 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ b/src/gallium/state_trackers/wgl/shared/stw_device.h @@ -35,6 +35,10 @@ struct stw_device { const struct stw_winsys *stw_winsys; struct pipe_screen *screen; + +#ifdef DEBUG + unsigned long memdbg_no; +#endif }; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 84b7b287b91..5cfdd41597c 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "stw_pixelformat.h" #include "stw_public.h" diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c index f50b79b4e11..d7077ca5d4d 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c +++ b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c @@ -27,7 +27,7 @@ #include <windows.h> -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "shared/stw_public.h" #include "stw_wgl.h" #include "stw.h" diff --git a/src/gallium/winsys/xlib/xlib_brw_aub.c b/src/gallium/winsys/xlib/xlib_brw_aub.c index 2956e1b960a..ce4b5f83fff 100644 --- a/src/gallium/winsys/xlib/xlib_brw_aub.c +++ b/src/gallium/winsys/xlib/xlib_brw_aub.c @@ -34,7 +34,7 @@ #include "xlib_brw_aub.h" #include "pipe/p_context.h" #include "pipe/p_state.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" #include "util/u_memory.h" diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index fdce8af31f4..9c540cb2bb7 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -73,6 +73,8 @@ i830CreateContext(const __GLcontextModes * mesaVis, return GL_FALSE; } + _math_matrix_ctr(&intel->ViewportMatrix); + /* Initialize swrast, tnl driver tables: */ intelInitSpanFuncs(ctx); intelInitTriFuncs(ctx); diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 6e2d41e19ab..7549029a1be 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -119,6 +119,8 @@ i915CreateContext(const __GLcontextModes * mesaVis, return GL_FALSE; } + _math_matrix_ctr(&intel->ViewportMatrix); + /* Initialize swrast, tnl driver tables: */ intelInitSpanFuncs(ctx); intelInitTriFuncs(ctx); diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index e63098fdd4a..5f4f2d515df 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -75,8 +75,8 @@ static GLboolean do_check_fallback(struct brw_context *brw) /* _NEW_STENCIL */ - if (ctx->Stencil.Enabled && - !brw->intel.hw_stencil) { + if (ctx->Stencil.Enabled && + (ctx->DrawBuffer->Name == 0 && !brw->intel.hw_stencil)) { DBG("FALLBACK: stencil\n"); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index b501a59ccd5..15ceac6ba1e 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -67,6 +67,8 @@ static void brw_destroy_context( struct intel_context *intel ) brw_destroy_state(brw); brw_draw_destroy( brw ); + _mesa_free(brw->wm.compile_data); + brw_FrameBufferTexDestroy( brw ); for (i = 0; i < brw->state.nr_draw_regions; i++) @@ -90,6 +92,7 @@ static void brw_destroy_context( struct intel_context *intel ) dri_bo_release(&brw->wm.bind_bo); for (i = 0; i < BRW_WM_MAX_SURF; i++) dri_bo_release(&brw->wm.surf_bo[i]); + dri_bo_release(&brw->wm.sampler_bo); dri_bo_release(&brw->wm.prog_bo); dri_bo_release(&brw->wm.state_bo); dri_bo_release(&brw->cc.prog_bo); diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index b2291363164..7c297ec9366 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -54,6 +54,17 @@ #define FILE_DEBUG_FLAG DEBUG_BLIT +#define TRI_CLEAR_COLOR_BITS (BUFFER_BIT_BACK_LEFT | \ + BUFFER_BIT_FRONT_LEFT | \ + BUFFER_BIT_COLOR0 | \ + BUFFER_BIT_COLOR1 | \ + BUFFER_BIT_COLOR2 | \ + BUFFER_BIT_COLOR3 | \ + BUFFER_BIT_COLOR4 | \ + BUFFER_BIT_COLOR5 | \ + BUFFER_BIT_COLOR6 | \ + BUFFER_BIT_COLOR7) + /** * Perform glClear where mask contains only color, depth, and/or stencil. * @@ -75,8 +86,8 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) GLboolean saved_shader_program = 0; unsigned int saved_active_texture; - assert((mask & ~(BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT | - BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) == 0); + assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH | + BUFFER_BIT_STENCIL)) == 0); _mesa_PushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | @@ -170,11 +181,11 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) while (mask != 0) { GLuint this_mask = 0; + GLuint color_bit; - if (mask & BUFFER_BIT_BACK_LEFT) - this_mask = BUFFER_BIT_BACK_LEFT; - else if (mask & BUFFER_BIT_FRONT_LEFT) - this_mask = BUFFER_BIT_FRONT_LEFT; + color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS); + if (color_bit != 0) + this_mask |= (1 << (color_bit - 1)); /* Clear depth/stencil in the same pass as color. */ this_mask |= (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)); @@ -186,6 +197,9 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) _mesa_DrawBuffer(GL_FRONT_LEFT); else if (this_mask & BUFFER_BIT_BACK_LEFT) _mesa_DrawBuffer(GL_BACK_LEFT); + else if (color_bit != 0) + _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0 + + (color_bit - BUFFER_COLOR0 - 1)); else _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); @@ -313,8 +327,11 @@ intelClear(GLcontext *ctx, GLbitfield mask) * buffer with it. */ if (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) { - tri_mask |= blit_mask & BUFFER_BIT_BACK_LEFT; - blit_mask &= ~BUFFER_BIT_BACK_LEFT; + int color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS); + if (color_bit != 0) { + tri_mask |= blit_mask & (1 << (color_bit - 1)); + blit_mask &= ~(1 << (color_bit - 1)); + } } /* SW fallback clearing */ diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index d7ccfa06058..1aa173db181 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -573,8 +573,6 @@ intelInitContext(struct intel_context *intel, intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); - _math_matrix_ctr(&intel->ViewportMatrix); - if (IS_965(intelScreen->deviceID) && !intel->intelScreen->irq_active) { _mesa_printf("IRQs not active. Exiting\n"); exit(1); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index a52271158c6..d6110b8163a 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -302,6 +302,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv) dri_bufmgr_destroy(intelScreen->bufmgr); intelUnmapScreenRegions(intelScreen); + driDestroyOptionCache(&intelScreen->optionCache); FREE(intelScreen); sPriv->private = NULL; diff --git a/src/mesa/drivers/glslcompiler/glslcompiler.c b/src/mesa/drivers/glslcompiler/glslcompiler.c index 918ec418563..54a4c1a7c6d 100644 --- a/src/mesa/drivers/glslcompiler/glslcompiler.c +++ b/src/mesa/drivers/glslcompiler/glslcompiler.c @@ -72,6 +72,7 @@ struct options { const char *VertFile; const char *FragFile; const char *OutputFile; + GLboolean Params; }; static struct options Options; @@ -228,6 +229,8 @@ PrintShaderInstructions(GLuint shader, FILE *f) struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); struct gl_program *prog = sh->Program; _mesa_fprint_program_opt(stdout, prog, Options.Mode, Options.LineNumbers); + if (Options.Params) + _mesa_print_program_parameters(ctx, prog); } @@ -258,6 +261,7 @@ Usage(void) printf(" --debug emit debug-style instructions\n"); printf(" --number, -n emit line numbers\n"); printf(" --output, -o FILE output filename\n"); + printf(" --params also emit program parameter info\n"); printf(" --help display this information\n"); } @@ -272,6 +276,7 @@ ParseOptions(int argc, char *argv[]) Options.VertFile = NULL; Options.FragFile = NULL; Options.OutputFile = NULL; + Options.Params = GL_FALSE; if (argc == 1) { Usage(); @@ -305,6 +310,9 @@ ParseOptions(int argc, char *argv[]) Options.OutputFile = argv[i + 1]; i++; } + else if (strcmp(argv[i], "--params") == 0) { + Options.Params = GL_TRUE; + } else if (strcmp(argv[i], "--help") == 0) { Usage(); exit(0); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 1b31e283cd3..9c8bd13e692 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -208,7 +208,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.ARB_shading_language_100 = GL_TRUE; #endif #if FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_FALSE; /* not quite done */ + ctx->Extensions.ARB_shading_language_120 = GL_TRUE; #endif ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_shadow_ambient = GL_TRUE; @@ -433,7 +433,7 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) ctx->Extensions.EXT_texture_sRGB = GL_TRUE; #endif #ifdef FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_FALSE; /* not quite done */ + ctx->Extensions.ARB_shading_language_120 = GL_TRUE; #endif } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index c3cdc110379..23b3fb68fbd 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -303,6 +303,20 @@ _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, /** + * For debug only. + */ +static void +att_incomplete(const char *msg) +{ +#if 0 + _mesa_printf("attachment incomplete: %s\n", msg); +#else + (void) msg; +#endif +} + + +/** * Test if an attachment point is complete and update its Complete field. * \param format if GL_COLOR, this is a color attachment point, * if GL_DEPTH, this is a depth component attachment point, @@ -323,20 +337,26 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, struct gl_texture_image *texImage; if (!texObj) { + att_incomplete("no texobj"); att->Complete = GL_FALSE; return; } texImage = texObj->Image[att->CubeMapFace][att->TextureLevel]; if (!texImage) { + att_incomplete("no teximage"); att->Complete = GL_FALSE; return; } if (texImage->Width < 1 || texImage->Height < 1) { + att_incomplete("teximage width/height=0"); + _mesa_printf("texobj = %u\n", texObj->Name); + _mesa_printf("level = %d\n", att->TextureLevel); att->Complete = GL_FALSE; return; } if (texObj->Target == GL_TEXTURE_3D && att->Zoffset >= texImage->Depth) { + att_incomplete("bad z offset"); att->Complete = GL_FALSE; return; } @@ -344,6 +364,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, if (format == GL_COLOR) { if (texImage->TexFormat->BaseFormat != GL_RGB && texImage->TexFormat->BaseFormat != GL_RGBA) { + att_incomplete("bad format"); att->Complete = GL_FALSE; return; } @@ -358,11 +379,13 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, } else { att->Complete = GL_FALSE; + att_incomplete("bad depth format"); return; } } else { /* no such thing as stencil textures */ + att_incomplete("illegal stencil texture"); att->Complete = GL_FALSE; return; } @@ -372,6 +395,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, if (!att->Renderbuffer->InternalFormat || att->Renderbuffer->Width < 1 || att->Renderbuffer->Height < 1) { + att_incomplete("0x0 renderbuffer"); att->Complete = GL_FALSE; return; } @@ -381,6 +405,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, ASSERT(att->Renderbuffer->RedBits); ASSERT(att->Renderbuffer->GreenBits); ASSERT(att->Renderbuffer->BlueBits); + att_incomplete("bad renderbuffer color format"); att->Complete = GL_FALSE; return; } @@ -395,6 +420,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, /* OK */ } else { + att_incomplete("bad renderbuffer depth format"); att->Complete = GL_FALSE; return; } @@ -411,6 +437,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, } else { att->Complete = GL_FALSE; + att_incomplete("bad renderbuffer stencil format"); return; } } diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index a9e22d340a3..a42c44686dd 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -93,7 +93,7 @@ compute_version(const GLcontext *ctx) (ctx->Extensions.EXT_stencil_two_side || ctx->Extensions.ATI_separate_stencil)); const GLboolean ver_2_1 = (ver_2_0 && - /*ctx->Extensions.ARB_shading_language_120 &&*/ + ctx->Extensions.ARB_shading_language_120 && ctx->Extensions.EXT_pixel_buffer_object && ctx->Extensions.EXT_texture_sRGB); if (ver_2_1) diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index ce48767a871..516ea733017 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -212,15 +212,13 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, GLboolean relAddr, const struct gl_program *prog) { static char str[100]; + const char *addr = relAddr ? "ADDR+" : ""; str[0] = 0; switch (mode) { case PROG_PRINT_DEBUG: - if (relAddr) - _mesa_sprintf(str, "%s[ADDR+%d]", file_string(f, mode), index); - else - _mesa_sprintf(str, "%s[%d]", file_string(f, mode), index); + _mesa_sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index); break; case PROG_PRINT_ARB: @@ -235,19 +233,19 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, _mesa_sprintf(str, "temp%d", index); break; case PROGRAM_ENV_PARAM: - _mesa_sprintf(str, "program.env[%d]", index); + _mesa_sprintf(str, "program.env[%s%d]", addr, index); break; case PROGRAM_LOCAL_PARAM: - _mesa_sprintf(str, "program.local[%d]", index); + _mesa_sprintf(str, "program.local[%s%d]", addr, index); break; case PROGRAM_VARYING: /* extension */ - _mesa_sprintf(str, "varying[%d]", index); + _mesa_sprintf(str, "varying[%s%d]", addr, index); break; case PROGRAM_CONSTANT: /* extension */ - _mesa_sprintf(str, "constant[%d]", index); + _mesa_sprintf(str, "constant[%s%d]", addr, index); break; case PROGRAM_UNIFORM: /* extension */ - _mesa_sprintf(str, "uniform[%d]", index); + _mesa_sprintf(str, "uniform[%s%d]", addr, index); break; case PROGRAM_STATE_VAR: { @@ -284,16 +282,16 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, _mesa_sprintf(str, "c[%d]", index); break; case PROGRAM_VARYING: /* extension */ - _mesa_sprintf(str, "varying[%d]", index); + _mesa_sprintf(str, "varying[%s%d]", addr, index); break; case PROGRAM_UNIFORM: /* extension */ - _mesa_sprintf(str, "uniform[%d]", index); + _mesa_sprintf(str, "uniform[%s%d]", addr, index); break; case PROGRAM_CONSTANT: /* extension */ - _mesa_sprintf(str, "constant[%d]", index); + _mesa_sprintf(str, "constant[%s%d]", addr, index); break; case PROGRAM_STATE_VAR: /* extension */ - _mesa_sprintf(str, "state[%d]", index); + _mesa_sprintf(str, "state[%s%d]", addr, index); break; default: _mesa_problem(NULL, "bad file in reg_string()"); diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 2dd122c9a54..ac01462bd55 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -451,7 +451,7 @@ emit_arl_load(slang_emit_info *emitInfo, struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL); inst->SrcReg[0].File = file; inst->SrcReg[0].Index = index; - inst->SrcReg[0].Swizzle = swizzle; + inst->SrcReg[0].Swizzle = fix_swizzle(swizzle); inst->DstReg.File = PROGRAM_ADDRESS; inst->DstReg.Index = 0; inst->DstReg.WriteMask = WRITEMASK_X; @@ -873,6 +873,7 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) if (n->Children[0]->Store->Size != n->Children[1]->Store->Size) { slang_info_log_error(emitInfo->log, "invalid operands to == or !="); + n->Store = NULL; return NULL; } @@ -902,6 +903,7 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) slang_ir_storage tempStore; if (!alloc_local_temp(emitInfo, &tempStore, 4)) { + n->Store = NULL; return NULL; /* out of temps */ } @@ -1813,6 +1815,25 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) } +/** + * Return the size of a swizzle mask given that some swizzle components + * may be NIL/undefined. For example: + * swizzle_size(".zzxx") = 4 + * swizzle_size(".xy??") = 2 + * swizzle_size(".w???") = 1 + */ +static GLuint +swizzle_size(GLuint swizzle) +{ + GLuint i; + for (i = 0; i < 4; i++) { + if (GET_SWZ(swizzle, i) == SWIZZLE_NIL) + return i; + } + return 4; +} + + static struct prog_instruction * emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n) { @@ -1820,14 +1841,24 @@ emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n) inst = emit(emitInfo, n->Children[0]); -#if 0 - assert(n->Store->Parent); - /* Apply this node's swizzle to parent's storage */ - GLuint swizzle = n->Store->Swizzle; - _slang_copy_ir_storage(n->Store, n->Store->Parent); - n->Store->Swizzle = _slang_swizzle_swizzle(n->Store->Swizzle, swizzle); - assert(!n->Store->Parent); -#endif + if (n->Children[0]->Opcode == IR_VAR || + n->Children[0]->Opcode == IR_SWIZZLE || + n->Children[0]->Opcode == IR_ELEMENT) { + /* We can resolve the swizzle now. Other swizzles will be resolved + * in storage_to_src_reg(). + */ + const GLuint swizzle = n->Store->Swizzle; + assert(n->Store->Parent); + /* new storage is parent storage with updated Swizzle + Size fields */ + _slang_copy_ir_storage(n->Store, n->Store->Parent); + /* Apply this node's swizzle to parent's storage */ + n->Store->Swizzle = _slang_swizzle_swizzle(n->Store->Swizzle, swizzle); + /* Update size */ + n->Store->Size = swizzle_size(n->Store->Swizzle); + assert(!n->Store->Parent); + assert(n->Store->Index >= 0); + } + return inst; } @@ -2428,7 +2459,9 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, maxUniforms = ctx->Const.VertexProgram.MaxUniformComponents / 4; } if (prog->Parameters->NumParameters > maxUniforms) { - slang_info_log_error(log, "Constant/uniform register limit exceeded"); + slang_info_log_error(log, "Constant/uniform register limit exceeded " + "(max=%u vec4)", maxUniforms); + return GL_FALSE; } diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 8b9b18f94df..862d29fb1bd 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -41,7 +41,7 @@ #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" /* * Map mesa register file to TGSI register file. @@ -475,15 +475,6 @@ compile_instruction( break; case OPCODE_RSQ: fullinst->Instruction.Opcode = TGSI_OPCODE_RSQ; - - /* KW: Don't do this here. If particular hardware needs to do - * this, can do so in the driver.. - */ -#if 0 - tgsi_util_set_full_src_register_sign_mode( - &fullinst->FullSrcRegisters[0], - TGSI_UTIL_SIGN_CLEAR ); -#endif break; case OPCODE_SCS: fullinst->Instruction.Opcode = TGSI_OPCODE_SCS; |