summaryrefslogtreecommitdiff
path: root/src/glsl/main.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-10-07glsl_compiler: Always log the compiler diagnosticsIan Romanick1-1/+3
Not just when there's an error. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-07glsl_compiler: Set max GLSL version on the command lineIan Romanick1-12/+173
Infer whether or not to use ES based on the GLSL version (100 or 300 are for ES). This replaces the --glsl-es command line option. Set various compiler limits based on the minimums required for the specified GLSL version. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-07glsl_compiler: Use no_argument instead of 0 in getopt_long optionsIan Romanick1-5/+5
The choices aren't just 0 and 1, so using the enum names is much more clear. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-09-09glsl: Switch to the new built-in function module.Kenneth Graunke1-1/+1
All built-ins are now handled by the new code; the old system is dead. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-25glsl: Bump standalone compiler versions to 3.30.Kenneth Graunke1-1/+1
These are necessary in order to compile the built-in functions. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-06-21mesa: Move the common _mesa_glsl_compile_shader() code to glsl/.Eric Anholt1-58/+1
This code had no relation to ir_to_mesa.cpp, since it was also used by intel and state_tracker, and most of it was duplicated with the standalone compiler (which has periodically drifted from the Mesa copy). v2: Split from the ir_to_mesa to shaderapi.c changes. Acked-by: Paul Berry <stereotype441@gmail.com> (v1) Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-06-21glsl: Remove ir_print_visitor.h includes and usageEric Anholt1-1/+0
We have ir->print() to do the old declaration of a visitor and having the IR accept the visitor (yuck!). And now you can call _mesa_print_ir() safely anywhere that you know what an ir_instruction is. A couple of missing printf("\n")s are added in error paths -- when an expression is handed to the visitor, it doesn't print '\n' (since it might be a step in printing a whole expression tree). Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-05-12glsl: Pass struct shader_compiler_options into do_common_optimization.Kenneth Graunke1-1/+3
do_common_optimization may need to make choices about whether to emit certain kinds of instructions. gl_context::ShaderCompilerOptions contains exactly that information, so it makes sense to pass it in. Rather than passing the whole array, pass the structure for the stage that's currently being worked on. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2013-03-20glsl: Bump standalone compiler versions to 1.50.Kenneth Graunke1-1/+1
The version bumps are necessary in order to compile built-ins for 1.50. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
2013-01-11glcpp: Accept pointer to GL context rather than just the API versionCarl Worth1-1/+1
As the preprocessor becomes more sophisticated and gains more optional behavior, it's easiest to just pass the GL context pointer to it so that it can examine any fields there that it needs to (such as API version, or the state of any driconf options, etc.). Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-06glsl: Create builtin function profiles for GLSL 3.00 ES.Paul Berry1-0/+1
Nearly all of the builtin functions in GLSL 3.00 ES are already implemented in Mesa; this patch enables them. A few functions are not implemented yet; those have been commented out, with a FIXME comment to act as a reminder of what still needs to be implemented. Here is the complete list: packSnorm2x16, unpackSnorm2x16, packUnorm2x16, unpackUnorm2x16, packHalf2x16, unpackHalf2x16. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Carl Worth <cworth@cworth.org>
2012-12-06glsl: Record in gl_shader whether the shader uses GLSL ES.Paul Berry1-0/+1
Previously we recorded just the GLSL version, with the knowledge that 100 means GLSL 1.00 ES. With the advent of GLSL 3.00 ES, this is going to get more complex, and eventually will probably become ambiguous (GLSL 4.00 already exists, and GLSL 4.00 ES is likely to be created some day). To reduce confusion, this patch simply records whether the shader is GLSL ES as an explicit boolean. [v2, idr]: s/IsEs(Shader|Prog)/IsES/ Suggested by Ken and Eric. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1] Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Carl Worth <cworth@cworth.org>
2012-11-29mesa: Rename API_OPENGL to API_OPENGL_COMPAT.Paul Berry1-1/+1
This should help avoid confusion now that we're using the gl_api enum to distinguishing between core and compatibility API's. The corresponding enum value for core API's is API_OPENGL_CORE. Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2012-09-15mesa/glsl: rename preprocess to glcpp_preprocessDave Airlie1-1/+1
This symbol with dricore escapes into the namespace, its too generic, we should prefix it with something just to be nice. Should be applied to stable + 9.0 Acked-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-04-24glsl: Add doxygen explaining what main.cpp is for.Eric Anholt1-0/+9
I keep getting lost in the Makefile trying to figure out what to edit to work on builtin_compiler or glsl_compiler. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-04-17glsl: Make the standalone compiler accept '.glsl' files.Kenneth Graunke1-1/+1
These ought to be treated as 'any stage', but for now, they're just treated as vertex shaders. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Ian Romanick <ian.d.romanick@intel.com>
2012-03-15glsl: Let the builtin compiler process GLSL 1.40 shaders.Eric Anholt1-3/+3
This is required to put the new 1.40 builtins in place, since they require new types. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-25glsl: Add uniform_locations_assigned parameter to do_dead_code opt passIan Romanick1-1/+1
Setting this flag prevents declarations of uniforms from being removed from the IR. Since the IR is directly used by several API functions that query uniforms in shaders, uniform declarations cannot be removed after the locations have been set. However, it should still be safe to reorder the declarations (this is not tested). Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980 Tested-by: Brian Paul <brianp@vmware.com> Reviewed-by: Bryan Cain <bryancain3@gmail.com> Cc: Vinson Lee <vlee@vmware.com> Cc: José Fonseca <jfonseca@vmware.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
2011-08-21glsl: remove an unnecessary header includeChia-I Wu1-1/+0
Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-02mesa: Ensure that gl_shader_program::InfoLog is never NULLIan Romanick1-0/+1
This prevents assertion failures in ralloc_strcat. The ralloc_free in _mesa_free_shader_program_data can be omitted because freeing the gl_shader_program in _mesa_delete_shader_program will take care of this automatically. A bunch of this code could use a refactor to use ralloc a bit more effectively. A bunch of the things that are allocated with malloc and owned by the gl_shader_program should be allocated with ralloc (using the gl_shader_program as the context). Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
2011-07-22glsl: Move functions into standalone_scaffolding.cpp for later reuse.Paul Berry1-57/+3
This patch moves the following functions from main.cpp (the main cpp file for the standalone executable that is used to create the built-in functions) to standalone_scaffolding.cpp, so that they can be re-used in other standalone executables: - initialize_context()* - _mesa_new_shader() - _mesa_reference_shader() *initialize_context contained some code that was specific to main.cpp, so it was split into two functions: initialize_context() (which remains in main.cpp), and initialize_context_from_defaults() (which is in standalone_scaffolding.cpp).
2011-06-23glsl: Flagged extension EXT_texture3D as "supported" in the builtin compiler.Paul Berry1-0/+1
Previously, the builtins in OES_texture_3D.{frag,vert} were only compiling properly as a consequence of bug 38015, which allows unsupported extensions to be enabled. This fix eliminates the builtin compiler's reliance on bug 38015, so that bug 38015 can be fixed.
2011-02-21Use C-style system headers in C++ code to avoid issues with std:: namespaceIan Romanick1-2/+0
2011-01-31glsl: Ensure that all GLSL versions are supported in the stand-alone compilerIan Romanick1-0/+6
NOTE: This is a candidate for the 7.9 and 7.10 branches
2011-01-31Convert everything from the talloc API to the ralloc API.Kenneth Graunke1-12/+12
2011-01-15Merge branch 'draw-instanced'Brian Paul1-0/+1
Conflicts: src/gallium/auxiliary/draw/draw_llvm.c src/gallium/drivers/llvmpipe/lp_state_fs.c src/glsl/ir_set_program_inouts.cpp src/mesa/tnl/t_vb_program.c
2011-01-14glsl: fix implicit int to bool warningBrian Paul1-1/+1
Maybe preprocess() should return a bool.
2011-01-12glsl: Make builtin_compiler portable for non-unices.José Fonseca1-31/+28
2010-12-08glsl: add support for system values and GL_ARB_draw_instancedBrian Paul1-0/+1
2010-11-25glsl: Use do_common_optimization in the standalone compiler.Kenneth Graunke1-20/+1
NOTE: This is a candidate for the 7.9 branch.
2010-11-17glsl: Improve usage message for glsl_compilerChad Versace1-9/+19
The new usage message lists possible command line options. (Newcomers to Mesa currently have to trawl through the source to find the command line options, and we should save them from that trouble.) Example Output -------------- usage: ./glsl_compiler [options] <file.vert | file.geom | file.frag> Possible options are: --glsl-es --dump-ast --dump-hir --dump-lir --link
2010-10-14glsl: Slightly change the semantic of _LinkedShadersIan Romanick1-1/+12
Previously _LinkedShaders was a compact array of the linked shaders for each shader stage. Now it is arranged such that each slot, indexed by the MESA_SHADER_* defines, refers to a specific shader stage. As a result, some slots will be NULL. This makes things a little more complex in the linker, but it simplifies things in other places. As a side effect _NumLinkedShaders is removed. NOTE: This may be a candidate for the 7.9 branch. If there are other patches that get backported to 7.9 that use _LinkedShader, this patch should be cherry picked also.
2010-10-13Drop GLcontext typedef and use struct gl_context insteadKristian Høgsberg1-6/+6
2010-09-08glsl: add several EmitNo* options, and MaxUnrollIterationsLuca Barbieri1-1/+1
This increases the chance that GLSL programs will actually work. Note that continues and returns are not yet lowered, so linking will just fail if not supported. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-08glsl: Support GLSL ES in the standalone compile.Chia-I Wu1-1/+3
GLSL ES mode is enabled when --glsl-es is passed to glsl_compiler.
2010-09-08glsl: Require a context in _mesa_glsl_parse_state.Chia-I Wu1-6/+41
Create a dummy context in the standalone compiler and pass it to _mesa_glsl_parse_state.
2010-09-07glsl: Define GL_ES preprocessor macro if API is OpenGL ES 2.0.Kenneth Graunke1-1/+1
Also define it if #version 100 is encountered.
2010-09-03glsl2: Add module to perform simple loop unrollingIan Romanick1-1/+2
2010-09-03glsl2: Perform initial bits of loop analysis during compilationIan Romanick1-0/+5
2010-08-18mesa: Free old linked shaders when relinking new shaders.Eric Anholt1-1/+5
2010-08-09glsl2: Add constant propagation.Eric Anholt1-0/+1
Whereas constant folding evaluates constant expressions at rvalue nodes, constant propagation tracks constant components of vectors across execution to replace (possibly swizzled) variable dereferences with constant values, triggering possible constant folding or reduced variable liveness.
2010-08-02glsl2: Clean-up two 'unused variable' warningsIan Romanick1-0/+3
2010-07-31glsl2: Add new tree grafting optimization pass.Eric Anholt1-0/+1
2010-07-27glsl2: Make the dead code handler make its own talloc context.Eric Anholt1-1/+1
This way, we don't need to pass in a parse state, and the context doesn't grow with the number of passes through optimization.
2010-07-27glsl2: Add optimization pass for algebraic simplifications.Eric Anholt1-0/+1
This cleans up the assembly output of almost all the non-logic tests glsl-algebraic-*. glsl-algebraic-pow-two needs love (basically, flattening to a temporary and squaring it).
2010-07-22glsl2: Fix standalone compiler to not crash horribly.Kenneth Graunke1-41/+4
ir_to_mesa was updated for the _mesa_glsl_parse_state constructor changes, but main.cpp was not.
2010-07-21linker: Link built-in functions instead of including them in every shaderIan Romanick1-0/+4
This is an invasive set of changes. Each user shader tracks a set of other shaders that contain built-in functions. During compilation, function prototypes are imported from these shaders. During linking, the shaders are linked with these built-in-function shaders just like with any other shader.
2010-07-20glsl2: Implement utility routine to talloc reparent an IR treeIan Romanick1-9/+1
2010-07-20glsl2: Add definitions of the builtin constants present in GLSL 1.10.Eric Anholt1-1/+18
Fixes: glsl1-built-in constants
2010-07-20glsl2: Don't validate IR if there were compilation errorsIan Romanick1-3/+3