summaryrefslogtreecommitdiffstats
path: root/src/glsl/hir_field_selection.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: add ast/parser support for subroutine parsing storage (v3.2)Dave Airlie2015-07-231-39/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This is the guts of the GLSL parser and AST support for shader subroutines. The code creates a subroutine type in the parser, and uses that there to validate the identifiers. The parser also distinguishes between subroutine types/function prototypes /uniforms and subroutine defintions for functions. Then in the AST conversion it recreates the types, and stores the subroutine definition info or subroutine info into the ir_function along with a side lookup table in the parser state. It also converts subroutine calls into the enhanced ir_call. v2: move to handling method calls in function handling not in field selection. v3: merge Chris's previous parser patches in here, to make it clearer what's changed in one place. v3.1: add more documentation, drop unused include v3.2: drop is_subroutine_def Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Signed-off-by: Dave Airlie <airlied@redhat.com>
* glsl: Remove unused include from hir_field_selection.cppThomas Helland2014-06-101-1/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system Reviewed-by: Tom Stellard <thomas.stellard@amd.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Thomas Helland <thomashelland90@gmail.com>
* glsl: Add check for unsized arrays to glsl typesTimothy Arceri2013-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | The main purpose of this patch is to increase readability of the array code by introducing is_unsized_array() to glsl_types. Some redundent is_array() checks are also removed, and small number of other related clean ups. The introduction of is_unsized_array() should also make the ARB_arrays_of_arrays code simpler and more readable when it arrives. V2: Also replace code that checks for unsized arrays directly with the length variable Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au> v3 (Paul Berry <stereotype441@gmail.com>): clean up formatting. Separate whitespace cleanups to their own patch. Reviewed-by: Paul Berry <stereotype441@gmail.com>
* glsl: Be consistent about '\n', '.', and capitalization in errors/warnings.Paul Berry2013-07-271-10/+10
| | | | | | | | | | | | The majority of calls to _mesa_glsl_error(), _mesa_glsl_warning(), and _mesa_glsl_parse_state::check_version() use a message that begins with a lower case letter and ends without a period. This patch makes all messages follow that convention. Also, error/warning messages shouldn't end in '\n', since _mesa_glsl_msg() automatically adds '\n' at the end of the message. Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl: Allow swizzles on scalars.Matt Turner2013-06-141-1/+3
| | | | | | Required by ARB_shading_language_420pack. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: Allow .length() method on vectors and matrices.Matt Turner2013-06-141-20/+38
| | | | | | Required by ARB_shading_language_420pack. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: Allow dereferencing fields of an interface instanceIan Romanick2013-01-251-1/+2
| | | | | Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl: Enable GLSL ES 3.00 features inherited from desktop GLSL.Paul Berry2012-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | This patch turns on the following features for GLSL ES 3.00: - Array constructors, whole array assignment, and array comparisons. - Second and third operands of ?: may be arrays. - Use of "in" and "out" qualifiers on globals. - Bitwise and modulus operators. - Integral vertex shader inputs. - Range-checking of literal integers. - array.length method. - Function calls may be constant expressions. - Integral varyings must be qualified with "flat". - Interpolation and centroid qualifiers may not be applied to vertex shader inputs. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Carl Worth <cworth@cworth.org>
* glsl: Make use of new _mesa_glsl_parse_state::check_version() function.Paul Berry2012-12-061-2/+1
| | | | | | | | | | | | | | | | | | Previous to this patch, we were not very consistent about the errors we generate when a shader tried to use a feature that is prohibited in the current GLSL version. Some error messages failed to mention the GLSL version currently in use (or did so inaccurately), and some error messages failed to mention the first GLSL version in which the given feature is allowed. This patch reworks all of the error checks to use the check_version() function, which produces error messages in a standard form (approximately "$FEATURE forbidden in $CURRENT_GLSL_VERSION ($REQUIRED_GLSL_VERSION required)."). Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Carl Worth <cworth@cworth.org>
* glsl: Use ir_rvalue to represent generic error_type values.Kenneth Graunke2012-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Currently, ir_call can be used as either a statement (for void functions) or a value (for non-void functions). This is rather awkward, as it's the only class that can be used in both forms. A number of places use ir_call::get_error_instruction() to construct a generic value of error_type. If ir_call is to become a statement, it can no longer serve this purpose. Unfortunately, none of our classes are particularly well suited for this, and creating a new one would be rather aggrandizing. So, this patch introduces ir_rvalue::error_value(), a static method that creates an instance of the base class, ir_rvalue. This has the nice property that you can't accidentally try and access uninitialized fields (as it doesn't have any). The downside is that the base class is no longer abstract. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* Use C-style system headers in C++ code to avoid issues with std:: namespaceIan Romanick2011-02-211-2/+0
|
* glsl: Add using statements for standard library functions.Vinson Lee2011-02-031-0/+2
| | | | | | | | | | | | | Standard library functions in C++ are in the std namespace. When using C++-style header files for the standard library, some compilers, such as Sun Studio, provide symbols only for the std namespace and not for the global namespace. This patch adds using statements for standard library functions. Another option could have been to prepend standard library function calls with 'std::'. This patch fixes several compilation errors with Sun Studio.
* glsl: Include main/core.h.Chia-I Wu2010-08-241-1/+0
| | | | Make glsl include only main/core.h from core mesa.
* glsl2: Remove unnecessary use of 'struct' before type namesIan Romanick2010-08-131-1/+1
| | | | | | | | In C++ you don't have to say 'struct' or 'class' if the declaration of the type has been seen. Some compilers will complain if you use 'struct' when 'class' should have been used and vice versa. Fixes bugzilla #29539.
* glsl2: Give the path within src/mesa/ for headers instead of relying on -I.Aras Pranckevicius2010-08-021-1/+1
|
* glsl2: Add support for the .length() method on arrays.Kenneth Graunke2010-07-201-0/+22
| | | | | | Fixes piglit test glsl-array-length, and provides proper error messages for negative piglit tests array-length-110.frag, array-length-unsized.frag, and array-length-args.frag.
* glsl2: Use _mesa_glsl_parse_state as the talloc parent, not glsl_shader.Kenneth Graunke2010-06-301-1/+1
| | | | | | | | | | | | | _mesa_glsl_parse_state should be the parent for all temporary allocation done while compiling a shader. glsl_shader should only be used as the parent for the shader's final IR---the _result_ of compilation. Since many IR instructions may be added or discarded during optimization passes, IR should not ever be allocated to glsl_shader directly. Done via sed -i s/talloc_parent(state)/state/g and s/talloc_parent(st)/st/g. This also removes a ton of talloc_parent calls, which may help performance.
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-241-0/+81