Commit Graph

23 Commits

Author SHA1 Message Date
Ian Romanick
4e4c2ee1fd Merge branch 'mesa_7_6_branch'
This should fix the memory leaks in the assembly parser without the
regressions.

The conflicts in program_lexer.l were related to changes in returning
strings between the branches (always return IDENTIFIER vs. returing
either IDENTIFIER or USED_IDENTIFIER).

The conflicts in program_parse.y were related to two changes in master
One change prints a variable name in an error message.  The other
change adds outputVarSize to the OUTPUT_statement rule.  The cause the
position of the IDENTIFIER to change from $2 to $3.

Conflicts:
	src/mesa/shader/lex.yy.c
	src/mesa/shader/program_lexer.l
	src/mesa/shader/program_parse.tab.c
	src/mesa/shader/program_parse.y
2009-11-06 11:17:00 -08:00
Ian Romanick
1c7337d46e Revert "ARB prog parser: Fix epic memory leak in lexer / parser interface"
This reverts commit 93dae6761b.

This change was completely broken when the parser uses multiple
strings in a single production.  It would be nice if bug fixes could
initially land somewhere other than the stable branch.
2009-11-06 10:46:22 -08:00
Ian Romanick
731810f854 ARB prog parser: Fix a couple issues with previous merge from mesa_7_6_branch
Since the addition of support for Nvidia condition codes, the lexer internally
uses handle_ident to select between returning IDENTIFIER and USED_IDENTIFIER.
Also, use return_string instead of strdup.

Fixes bug #24809.
2009-11-02 12:44:14 -08:00
Brian Paul
7d56caabe4 Merge branch 'mesa_7_6_branch'
Conflicts:

	src/mesa/shader/lex.yy.c
	src/mesa/shader/program_lexer.l
2009-10-28 11:33:51 -06:00
Ian Romanick
93dae6761b ARB prog parser: Fix epic memory leak in lexer / parser interface
Anything that matched IDENTIFIER was strdup'ed and returned to the
parser.  However, almost every case of IDENTIFIER in the parser just
dropped the returned string on the floor.  Every swizzle string, every
option string, every use of a variable, etc. leaked memory.

Create a temporary buffer in the parser state (string_dumpster and
dumpster_size).  Return strings from the lexer to the parser in the
buffer.  Grow the buffer as needed.  When the parser needs to keep a
string (i.e., delcaring a new variable), let it make a copy then.

The only leak that valgrind now detects is /occasionally/ the copy of
the program string in gl_program::String is leaked.  I'm not seeing
how. :(
2009-10-27 17:06:18 -07:00
Alex Deucher
620270c76e Merge branch 'mesa_7_6_branch' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa
regenerated lex.yy.c
2009-10-19 12:10:59 -04:00
Neil Roberts
269f16cd96 mesa: Use _mesa_strtod in the lexer for assembly shaders
See bug 24531.
2009-10-15 08:57:07 -06:00
Ian Romanick
09af58d7ed NV fp lexer: Add UP4B and UP4UB instructions that were previously missing 2009-09-24 18:27:20 -07:00
Ian Romanick
b8e1e8d2d8 Merge branch 'master' into asm-shader-rework-2
Conflicts:
	src/mesa/shader/lex.yy.c
	src/mesa/shader/program_parse.tab.c
	src/mesa/shader/program_parse.tab.h
2009-09-10 15:33:45 -07:00
Ian Romanick
cdb7193994 ARB prog lexer: Add missing #include to silence compile warning 2009-09-10 14:55:36 -07:00
Ian Romanick
0e7953366f ARB prog parser: Differentiate between used and unused names in the lexer
The lexer will return IDENTIFIER only when the name does not have an
associated symbol.  Otherwise USED_IDENTIFIER is returned.
2009-09-10 14:35:33 -07:00
Michal Krol
970823978c mesa: Include <unistd.h> only when one is available. 2009-09-07 09:31:17 +02:00
Ian Romanick
d0adebb8d5 NV fp parser: Support instruction and TEMP / OUTPUT sizes
Adds support for declaring TEMP and OUTPUT variables as 'LONG' or
'SHORT' precision.  The precision specifiers are parsed, but they are
currently ignored.  Some support for this may be added in the future,
but neither Intel hardware nor, as far as I'm aware, Radeon hardware
support multiple precisions.

Also adds support for instruction precision ('X', 'H', and 'R')
suffixes and instruction condition code output ('C') suffix.  This
results in a fairly major change to the lexer.  Instructions are
matched with all the possible suffix strings.  The suffix string are
then carved off by a context (i.e., which program mode and options are
set) aware parser that converts the suffixes to bits in
prog_instruction.

This could have been handled in the same way _SAT was originally
handled in the lexer, but it would have resulted in a very large lexer
with lots of opportunity for cut-and-paste errors.
2009-09-04 17:31:05 -07:00
Brian Paul
592a6642fc ARB prog: replace 'unsigned' with 'gl_state_index'
Fixes compilation warnings with MSVC.
2009-09-04 09:17:59 -06:00
Brian Paul
3fedd08779 ARB prog: rename POINT, SIZE to POINT_TOK, SIZE_TOK
Fixes symbol collisions with typedefs in Microsoft headers.
Perhaps we should prefix/suffix all the lexer tokens to avoid this.
2009-09-04 09:17:59 -06:00
Ian Romanick
ede0cd4d8c NV fp lexer: Add new opcodes 2009-08-31 17:00:31 -07:00
Ian Romanick
9b70c33e73 ARB prog lexer: Fix lexer to eat both DOS and Unix line endings 2009-08-23 11:15:32 -07:00
Ian Romanick
cbe4133109 ARB prog lexer: attenuation is not just for vp 2009-07-29 20:42:28 -07:00
Ian Romanick
aafd576259 ARB prog parser: Add support for GL_MESA_texture_array
This isn't really tested yet as no drivers actually support this extension.
2009-07-27 17:22:21 -07:00
Ian Romanick
1edd13bf23 ARB prog parser: Add support for GL_ARB_fragment_program_shadow
Passes the piglit asmparsertest shadow-0[123].txt tests and
progs/demos/shadowtex.
2009-07-27 16:24:49 -07:00
Ian Romanick
88018e2e07 ARB prog parser: Fix handling of RECT
Require that GL_{ARB,EXT,NV}_texture_rectangle be supported before
allowing use of RECT texture target.
2009-07-27 15:47:52 -07:00
Ian Romanick
6d3ccaf366 ARB prog: Delete comment about possibly needing to free a buffer
Valgrind doesn't complain about a leak here, so delete the comment
about possibly needing to free the state returned by yy_scan_bytes.
2009-07-27 12:38:52 -07:00
Ian Romanick
770cebbc29 ARB_fp/vp: Initial import of new ARB vp/fp assembler
This still needs quite a bit of work, but a bunch of the programs in progs/vp
produce correct results.
2009-07-20 17:44:36 -07:00