From 214347fdb4c30dc8bac5d4b9a823458709bc53ea Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Fri, 31 Aug 2007 16:50:48 +0800 Subject: i965: Calculate the positional light in homogeneous coordinates. fix bug#11009 --- src/mesa/tnl/t_vp_build.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mesa/tnl') diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index ee1a2498b3..336f3c7a2a 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -960,6 +960,11 @@ static void build_lighting( struct tnl_program *p ) VPpli = get_temp(p); half = get_temp(p); + /* In homogeneous object coordinates + */ + emit_op1(p, OPCODE_RCP, dist, 0, swizzle1(Ppli, W)); + emit_op2(p, OPCODE_MUL, Ppli, 0, Ppli, dist); + /* Calulate VPpli vector */ emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V); -- cgit v1.2.3 From 6dd98e9853a6984150aa47467112e016c40a4ab4 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 31 Aug 2007 16:42:05 -0600 Subject: Fix problem introduced in previous commit in which a state variable (uniform) is written to. (see bug 12239) Also, added some assertions to the emit_arg() and emit_dst() functions to catch this kind of error in the future. --- src/mesa/tnl/t_vp_build.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'src/mesa/tnl') diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 336f3c7a2a..63f7890205 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 2006 Tungsten Graphics All Rights Reserved. + * Copyright (C) 2007 Tungsten Graphics All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -457,9 +457,13 @@ static void register_matrix_param5( struct tnl_program *p, } +/** + * Convert a ureg source register to a prog_src_register. + */ static void emit_arg( struct prog_src_register *src, struct ureg reg ) { + assert(reg.file != PROGRAM_OUTPUT); src->File = reg.file; src->Index = reg.idx; src->Swizzle = reg.swz; @@ -469,9 +473,18 @@ static void emit_arg( struct prog_src_register *src, src->RelAddr = 0; } +/** + * Convert a ureg dest register to a prog_dst_register. + */ static void emit_dst( struct prog_dst_register *dst, struct ureg reg, GLuint mask ) { + /* Check for legal output register type. UNDEFINED will occur in + * instruction that don't produce a result (like END). + */ + assert(reg.file == PROGRAM_TEMPORARY || + reg.file == PROGRAM_OUTPUT || + reg.file == PROGRAM_UNDEFINED); dst->File = reg.file; dst->Index = reg.idx; /* allow zero as a shorthand for xyzw */ @@ -956,18 +969,19 @@ static void build_lighting( struct tnl_program *p ) STATE_POSITION); struct ureg V = get_eye_position(p); struct ureg dist = get_temp(p); + struct ureg tmpPpli = get_temp(p); VPpli = get_temp(p); half = get_temp(p); - /* In homogeneous object coordinates - */ - emit_op1(p, OPCODE_RCP, dist, 0, swizzle1(Ppli, W)); - emit_op2(p, OPCODE_MUL, Ppli, 0, Ppli, dist); + /* In homogeneous object coordinates + */ + emit_op1(p, OPCODE_RCP, dist, 0, swizzle1(Ppli, W)); + emit_op2(p, OPCODE_MUL, tmpPpli, 0, Ppli, dist); - /* Calulate VPpli vector + /* Calculate VPpli vector */ - emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V); + emit_op2(p, OPCODE_SUB, VPpli, 0, tmpPpli, V); /* Normalize VPpli. The dist value also used in * attenuation below. @@ -999,6 +1013,7 @@ static void build_lighting( struct tnl_program *p ) emit_normalize_vec3(p, half, half); release_temp(p, dist); + release_temp(p, tmpPpli); } /* Calculate dot products: -- cgit v1.2.3 From a956184f70733bd22e2bbee515386da12302963f Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Thu, 6 Sep 2007 19:12:58 +0200 Subject: Disable an assert for hw that do not emit POS as first vertex attrib, like nv1x --- src/mesa/tnl/t_vertex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/tnl') diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index a6728c318f..da32be9a17 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -294,7 +294,7 @@ GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, GLuint i, j; assert(nr < _TNL_ATTRIB_MAX); - assert(nr == 0 || map[0].attrib == VERT_ATTRIB_POS); +/* assert(nr == 0 || map[0].attrib == VERT_ATTRIB_POS);*/ vtx->new_inputs = ~0; vtx->need_viewport = GL_FALSE; -- cgit v1.2.3 From 3d17cdf55acc2b452b9f2b57a9823595615c4806 Mon Sep 17 00:00:00 2001 From: Matthieu Castet Date: Sun, 16 Sep 2007 16:15:13 +0200 Subject: revert a956184f70733bd22e2bbee515386da12302963f --- src/mesa/tnl/t_vertex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/tnl') diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index da32be9a17..a6728c318f 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -294,7 +294,7 @@ GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, GLuint i, j; assert(nr < _TNL_ATTRIB_MAX); -/* assert(nr == 0 || map[0].attrib == VERT_ATTRIB_POS);*/ + assert(nr == 0 || map[0].attrib == VERT_ATTRIB_POS); vtx->new_inputs = ~0; vtx->need_viewport = GL_FALSE; -- cgit v1.2.3 From f8ee72d98f2d23e034e90870ff6a760659a462a5 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 29 Sep 2007 12:01:34 -0600 Subject: fix VBO-split infinite loop (bug 12164) --- src/mesa/tnl/t_draw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/mesa/tnl') diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 5b2b2ae549..46b8b536a2 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -368,7 +367,7 @@ void _tnl_draw_prims( GLcontext *ctx, _tnl_draw_prims ); return; } - else if (max_index >= max) { + else if (max_index > max) { /* The software TNL pipeline has a fixed amount of storage for * vertices and it is necessary to split incoming drawing commands * if they exceed that limit. -- cgit v1.2.3