Age | Commit message (Collapse) | Author |
|
And use the talloc-based new for all of the ast objects created by the
parser. This closes a lot of memory leaks, and will allow us to use
these ast objects as talloc parents in the future, (for things like
exec_nodes, etc.).
This closes 164 leaks in the glsl-orangebook-ch06-bump.frag test:
total heap usage: 55,623 allocs, 14,553 frees
(was 14,389 frees)
|
|
Two of these destructors are non-empty, (s_symbol and s_list), so this
commit could potentially introduce memory leaks, (though, no additional
leaks are found in glsl-orangebook-ch06-bump.frag at least---perhaps
the current code is never calling delete on these classes?).
Going forward, we will switch to talloc for exec_node so we won't need
explicit destrcutors to free up any memory used.
|
|
We take advantage of overloading of the new operator (with an
additional parameter!) to make this look as "C++ like" as possible.
This closes 507 memory leaks when compiling glsl-orangebook-ch06-bump.frag
when measured with:
valgrind ./glsl glsl-orangebook-ch06-bump.frag
as seen here:
total heap usage: 55,623 allocs, 14,389 frees
(was 13,882 frees before)
|
|
This is a short-lived object. It exists only for the duration of the
compile_shader() function, (as opposed to the shader and whole_program
which live longer).
The state is created with the same talloc parent as the shader, so
that other allocation can be done with talloc_parent(state) as the
owner in order to attach to a long-lived object.
|
|
This way, whole_program can be our top-level talloc context object,
allowing us to free the lot with a single talloc_free in the end.
|
|
This wasn't serving any purpose. So delete it.
|
|
My current reading of the relevant static functions suggests that last
is never used without being uninitialized, (we only use it if the
expansion function returned non-NULL and the expansion functions
always set it before returning non-NULL).
Apparently gcc isn't coming to the same conclusion. Initializing this
to NULL nicely quites gcc and will guarantee a nice, early segfault if
my anaylsis turns out to be wrong.
|
|
As gcc noticed, this function is not currently being used. Good-bye.
|
|
As gcc noticed, this function is not currently being used. Good-bye.
|
|
Use AH_TOP and AH_BOTTOM macros so that the standard include guard
mechanisms are emitted by autoheader into the generated config.h file.
|
|
This block of code is useless because a (nearly-equivalent) assignment
is made immediately after. The only difference is the omission of
-Wunreadchable-code in the assignment being used. Presumably, that was
intended to be -Wunreachable-code (without the first 'd'), but since
this hasn't been being used we just drop it.
|
|
One of these was just in a comment. But ther other was in an enum
tag, (which is apparently not being used anywhere yet).
|
|
Thanks to valgrind for noticing this problem.
|
|
Fixes CorrectSwizzle3.frag.
|
|
This would fix double-evaluation of assignment RHS expressions,
including possible side effects.
|
|
|
|
|
|
The new cloning code handles them.
|
|
This will be used by function inlining, the linker, and avoiding double
usage of the LHS deref chains in ++, *=, and similar operations.
|
|
|
|
Fixes CorrectPreprocess5.frag.
|
|
This prevents the two code paths from getting out of sync. Also, future
work will need the shader source as a string anyway.
Unfortunately, this copies and pastes load_text_file from main.cpp, with
small changes (support for reading from stdin, talloc).
|
|
Flex couldn't be sure whether "def" and "ndef" were part of the #ifdef
and #ifndef patterns or the trailing context of the #if pattern.
|
|
Now handled by the preprocessor.
|
|
Found in glsl-orangebook-ch06-bump.(frag|vert). This was resulting in
the comments getting passed through to the main compiler's lexer.
|
|
This causes the following tests to pass:
glslparsertest/glsl2/constructor-10.vert
|
|
|
|
Since the program is now passed in, refactor the parameter list to the
function as well.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Store the thing in a variable and deref it for each swizzle if we have to.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
|
|
|