diff options
author | Kenneth Graunke <[email protected]> | 2013-08-29 23:06:39 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-09-09 14:42:18 -0700 |
commit | 7ddc312c1b2c610ba8f244b49f4c4bc94eeca985 (patch) | |
tree | a44a49790f90cfa6f66a295e84890cc11144bcd2 /src/glsl/ir.h | |
parent | 8d90328eb3a934e07a9fa54b829e768750ab6d8b (diff) |
glsl: Write a new built-in function module.
This creates a new replacement for the existing built-in function code.
The new module lives in builtin_functions.cpp (not builtin_function.cpp)
and exists in parallel with the existing system. It isn't used yet.
The new built-in function code takes a significantly different approach:
Instead of implementing built-ins via printed IR, build time scripts,
and run time parsing, we now implement them directly in C++, using
ir_builder. This translates to faster load times, and a much less
complex build system.
It also takes a different approach to built-in availability: each
signature now stores a boolean predicate, which makes it easy to
construct arbitrary expressions based on _mesa_glsl_parse_state's
fields. This is much more flexible than the old system, and also
easier to use.
Built-ins are also now stored in a single gl_shader object, rather
than being spread out across a number of shaders that need to be linked.
When searching for a matching prototype, we simply consult the
availability predicate. This also simplifies the code.
v2: Incorporate Matt Turner's feedback: use the new fma() function rather
than expr(). Don't expose textureQueryLOD() in GLSL 4.00 (since it
was renamed to textureQueryLod()). Also correct some #undefs.
v3: Incorporate Paul Berry's feedback: rename legacy to compatibility;
add comments to explain a few things; fix uvec availability; include
shaderobj.h instead of repeating the _mesa_new_shader prototype.
v4: Fix lack of TEX_PROJECT on textureProjGrad[Offset] (caught by oglc).
Add an out_var convenience function (more feedback by Matt Turner).
v5: Rework availability predicates for Lod functions. They were broken.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Enthusiastically-acked-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl/ir.h')
-rw-r--r-- | src/glsl/ir.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 0646e6d754c..bfbb94c5b15 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -2127,9 +2127,19 @@ extern void _mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state); extern void +_mesa_glsl_initialize_builtin_functions(); + +extern ir_function_signature * +_mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state, + const char *name, exec_list *actual_parameters); + +extern void _mesa_glsl_release_functions(void); extern void +_mesa_glsl_release_builtin_functions(void); + +extern void reparent_ir(exec_list *list, void *mem_ctx); struct glsl_symbol_table; |