summaryrefslogtreecommitdiffstats
path: root/src/glsl/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl_compiler: Always log the compiler diagnosticsIan Romanick2013-10-071-1/+3
| | | | | | | Not just when there's an error. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl_compiler: Set max GLSL version on the command lineIan Romanick2013-10-071-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 <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* glsl_compiler: Use no_argument instead of 0 in getopt_long optionsIan Romanick2013-10-071-5/+5
| | | | | | | | The choices aren't just 0 and 1, so using the enum names is much more clear. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Switch to the new built-in function module.Kenneth Graunke2013-09-091-1/+1
| | | | | | | | All built-ins are now handled by the new code; the old system is dead. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Bump standalone compiler versions to 3.30.Kenneth Graunke2013-08-251-1/+1
| | | | | | | These are necessary in order to compile the built-in functions. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: Move the common _mesa_glsl_compile_shader() code to glsl/.Eric Anholt2013-06-211-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 <[email protected]> (v1) Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Remove ir_print_visitor.h includes and usageEric Anholt2013-06-211-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 <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Pass struct shader_compiler_options into do_common_optimization.Kenneth Graunke2013-05-121-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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Bump standalone compiler versions to 1.50.Kenneth Graunke2013-03-201-1/+1
| | | | | | | | The version bumps are necessary in order to compile built-ins for 1.50. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* glcpp: Accept pointer to GL context rather than just the API versionCarl Worth2013-01-111-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 <[email protected]>
* glsl: Create builtin function profiles for GLSL 3.00 ES.Paul Berry2012-12-061-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 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Carl Worth <[email protected]>
* glsl: Record in gl_shader whether the shader uses GLSL ES.Paul Berry2012-12-061-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 <[email protected]> [v1] Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Carl Worth <[email protected]>
* mesa: Rename API_OPENGL to API_OPENGL_COMPAT.Paul Berry2012-11-291-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 <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* mesa/glsl: rename preprocess to glcpp_preprocessDave Airlie2012-09-151-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 <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Add doxygen explaining what main.cpp is for.Eric Anholt2012-04-241-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 <[email protected]>
* glsl: Make the standalone compiler accept '.glsl' files.Kenneth Graunke2012-04-171-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 <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Ian Romanick <[email protected]>
* glsl: Let the builtin compiler process GLSL 1.40 shaders.Eric Anholt2012-03-151-3/+3
| | | | | | | This is required to put the new 1.40 builtins in place, since they require new types. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add uniform_locations_assigned parameter to do_dead_code opt passIan Romanick2011-10-251-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 <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980 Tested-by: Brian Paul <[email protected]> Reviewed-by: Bryan Cain <[email protected]> Cc: Vinson Lee <[email protected]> Cc: José Fonseca <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Yuanhan Liu <[email protected]>
* glsl: remove an unnecessary header includeChia-I Wu2011-08-211-1/+0
| | | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* mesa: Ensure that gl_shader_program::InfoLog is never NULLIan Romanick2011-08-021-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 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Move functions into standalone_scaffolding.cpp for later reuse.Paul Berry2011-07-221-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).
* glsl: Flagged extension EXT_texture3D as "supported" in the builtin compiler.Paul Berry2011-06-231-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.
* Use C-style system headers in C++ code to avoid issues with std:: namespaceIan Romanick2011-02-211-2/+0
|
* glsl: Ensure that all GLSL versions are supported in the stand-alone compilerIan Romanick2011-01-311-0/+6
| | | | NOTE: This is a candidate for the 7.9 and 7.10 branches
* Convert everything from the talloc API to the ralloc API.Kenneth Graunke2011-01-311-12/+12
|
* Merge branch 'draw-instanced'Brian Paul2011-01-151-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
| * glsl: add support for system values and GL_ARB_draw_instancedBrian Paul2010-12-081-0/+1
| |
* | glsl: fix implicit int to bool warningBrian Paul2011-01-141-1/+1
| | | | | | | | Maybe preprocess() should return a bool.
* | glsl: Make builtin_compiler portable for non-unices.José Fonseca2011-01-121-31/+28
| |
* | glsl: Use do_common_optimization in the standalone compiler.Kenneth Graunke2010-11-251-20/+1
|/ | | | NOTE: This is a candidate for the 7.9 branch.
* glsl: Improve usage message for glsl_compilerChad Versace2010-11-171-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
* glsl: Slightly change the semantic of _LinkedShadersIan Romanick2010-10-141-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.
* Drop GLcontext typedef and use struct gl_context insteadKristian Høgsberg2010-10-131-6/+6
|
* glsl: add several EmitNo* options, and MaxUnrollIterationsLuca Barbieri2010-09-081-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 <[email protected]>
* glsl: Support GLSL ES in the standalone compile.Chia-I Wu2010-09-081-1/+3
| | | | GLSL ES mode is enabled when --glsl-es is passed to glsl_compiler.
* glsl: Require a context in _mesa_glsl_parse_state.Chia-I Wu2010-09-081-6/+41
| | | | | Create a dummy context in the standalone compiler and pass it to _mesa_glsl_parse_state.
* glsl: Define GL_ES preprocessor macro if API is OpenGL ES 2.0.Kenneth Graunke2010-09-071-1/+1
| | | | Also define it if #version 100 is encountered.
* glsl2: Add module to perform simple loop unrollingIan Romanick2010-09-031-1/+2
|
* glsl2: Perform initial bits of loop analysis during compilationIan Romanick2010-09-031-0/+5
|
* mesa: Free old linked shaders when relinking new shaders.Eric Anholt2010-08-181-1/+5
|
* glsl2: Add constant propagation.Eric Anholt2010-08-091-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.
* glsl2: Clean-up two 'unused variable' warningsIan Romanick2010-08-021-0/+3
|
* glsl2: Add new tree grafting optimization pass.Eric Anholt2010-07-311-0/+1
|
* glsl2: Make the dead code handler make its own talloc context.Eric Anholt2010-07-271-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.
* glsl2: Add optimization pass for algebraic simplifications.Eric Anholt2010-07-271-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).
* glsl2: Fix standalone compiler to not crash horribly.Kenneth Graunke2010-07-221-41/+4
| | | | | ir_to_mesa was updated for the _mesa_glsl_parse_state constructor changes, but main.cpp was not.
* linker: Link built-in functions instead of including them in every shaderIan Romanick2010-07-211-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.
* glsl2: Implement utility routine to talloc reparent an IR treeIan Romanick2010-07-201-9/+1
|
* glsl2: Add definitions of the builtin constants present in GLSL 1.10.Eric Anholt2010-07-201-1/+18
| | | | | Fixes: glsl1-built-in constants
* glsl2: Don't validate IR if there were compilation errorsIan Romanick2010-07-201-3/+3
|