summaryrefslogtreecommitdiff
path: root/src/glsl/ast_type.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-02-20glsl: parse invocations layout qualifier for ARB_gpu_shader5Jordan Justen1-0/+12
_mesa_glsl_parse_state in_qualifier->invocations will store the invocations count. v3: * Use in_qualifier to allow the primitive to be specied separately from the invocations count (merge_qualifiers) Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2014-02-20glsl: Generate error for invalid input layout declarationsJordan Justen1-0/+13
Fixes various piglit tests: spec/glsl-1.50/compiler/incorrect-in-layout-qualifier-*.geom Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2014-02-20glsl: convert GS input primitive to use ast_type_qualifierJordan Justen1-0/+81
We introduce a new merge_in_qualifier ast_type_qualifier which allows specialized handling of merging input layout qualifiers. By merging layout qualifiers into state->in_qualifier, we allow multiple input qualifiers. For example, the primitive type can be specified specified separately from the invocations count (ARB_gpu_shader5). state->gs_input_prim_type is moved into state->in_qualifier->prim_type state->gs_input_prim_type_specified is still processed separately so we can determine when the input primitive is specified. This is important since certain scenerios are not supported until after the primitive type has been specified in the shader code. v4: * Merge with compute shader input layout qualifiers Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2014-02-12glsl/ast: Keep track of type qualifiers defined by ARB_shader_image_load_store.Francisco Jerez1-0/+5
v2: Add comment next to the read_only and write_only qualifier flags. Change temporary copies of the type qualifier mask to use uint64_t too. Reviewed-by: Paul Berry <stereotype441@gmail.com>
2014-02-06glsl: Initialize ubo_binding_mask flags to zero.Matt Turner1-0/+1
Missed in commit e63bb298. Caused sporadic test failures, like incorrect-in-layout-qualifier-repeated-prim.geom. Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2014-02-05glsl/cs: Handle compute shader local_size_{x,y,z} declaration.Paul Berry1-0/+14
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2014-01-23glsl: remove remaining is_array variablesTimothy Arceri1-4/+2
Previously the reason we needed is_array was because we used array_size == NULL to represent both non-arrays and unsized arrays. Now that we use a non-NULL array_specifier to represent an unsized array, is_array is redundant. Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au> Reviewed-by: Paul Berry <stereotype441@gmail.com>
2014-01-23glsl: Add ARB_arrays_of_arrays support to yacc definition and astTimothy Arceri1-6/+2
Adds array specifier object to hold array information Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au> Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-12-07glsl: Add frontend support for `sample` auxiliary storage qualifierChris Forbes1-1/+2
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2013-11-07glsl: Implement parser support for atomic counters.Francisco Jerez1-2/+11
v2: Mark atomic counters as read-only variables. Move offset overlap code to the linker. Use the contains_atomic() convenience method. v3: Use pointer to integer instead of non-const reference. Add comment so we remember to add a spec quotation from the next GLSL release once the issue of atomic counter aggregation within structures is clarified. v4 (idr): Don't use std::map because it's overkill. Add an assertion that ctx->Const.MaxAtomicBufferBindings <= MAX_COMBINED_ATOMIC_BUFFERS. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-08-21glsl: Merge precision qualifiers tooIan Romanick1-0/+3
We never noticed this before because we previously didn't enfoce GLSL ES fragement shader requirements that precision be defined. There may also have been some interaction here with the addition of GL_ARB_shading_language_420pack, but it doesn't appear to me that it added any new bugs (just perhaps uncovered some old ones). Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Cc: "9.2" <mesa-stable@lists.freedesktop.org>
2013-08-01glsl: Parse the GLSL 1.50 GS layout qualifiers.Eric Anholt1-0/+19
Limited semantic checking (compatibility between declarations, checking that they're in the right shader target, etc.) is done. v2: Remove stray debug printfs. v3 (Paul Berry <stereotype441@gmail.com>): Process input layout qualifiers at ast_to_hir time rather than at parse time, since certain error conditions depend on the relative ordering between input layout qualifiers, declarations, and calls to .length(). Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-07-27glsl: Be consistent about '\n', '.', and capitalization in errors/warnings.Paul Berry1-1/+1
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>
2013-07-18glsl: Parse the "binding" keyword and store it in ast_type_qualifier.Kenneth Graunke1-1/+5
Nothing actually uses this yet. v2: Remove >= 0 checks. They'll be handled in later validation. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-07-18glsl: Add a new ast_type_qualifier::has_auxiliary_storage() method.Kenneth Graunke1-0/+6
"Auxiliary storage qualifiers" is the new term given to "centroid", "patch", and "sample" by GLSL 4.20/GL_ARB_shading_language_420pack. Even though we only support "centroid", it's useful to add this now so that all auxiliary storage qualifiers get handled in the right places once they're eventually supported. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-07-18glsl: Add a new ast_type_qualifier::has_storage() method.Kenneth Graunke1-0/+11
This makes it easy to check if any storage qualifiers are set. "centroid" is not considered a storage qualifier. In the old language rules, you can't specify "centroid" by itself; it's always "centroid in", "centroid out", or "centroid varying." So one of the other storage qualifiers will always be set; there's no need to specifically check for centroid. In the new 4.20 rules, centroid is an auxiliary storage qualifier, not a storage qualifier. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-07-18glsl: Add a new ast_type_qualifier::has_layout() method.Kenneth Graunke1-0/+18
This makes it easy to check if any layout qualifiers are set. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-07-11glsl: Remove unnecessary #include from ast_type.cpp.Matt Turner1-3/+0
Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Ian Romanick <ian.d.romainck@intel.com>
2012-07-31glsl: Add support for default layout qualifiers for uniforms.Eric Anholt1-0/+45
I ended up having to add rallocing of the ast_type_qualifier in order to avoid pulling in ast.h for glsl_parser_extras.h, because I wanted to track an ast_type_qualifier in the state. Fixes piglit ARB_uniform_buffer_object/row-major. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-04-09glsl: Drop the round-trip through ast_type_specifier for many builtin types.Eric Anholt1-67/+1
We have lexer recognition of a bunch of our types based on the handling. This code was mapping those recognized tokens to an enum and then to a string of their name. Just drop the enums and provide the string directly in the parser. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-03glsl: add support for GL_OES_EGL_image_externalChia-I Wu1-0/+1
This extension introduces a new sampler type: samplerExternalOES. texture2D (and texture2DProj) can be used to do a texture look up in an external texture. Reviewed-by: Brian Paul <brianp@vmware.com> Acked-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-02-21Use C-style system headers in C++ code to avoid issues with std:: namespaceIan Romanick1-3/+0
2011-02-03glsl: Add using statements for standard library functions.Vinson Lee1-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.
2011-01-17glsl: Add support for default precision statementsChad Versace1-1/+2
* Add new field ast_type_specifier::is_precision_statement. * Add semantic checks in ast_type_specifier::hir(). * Alter parser rules accordingly.
2011-01-17glsl: Change default value of ast_type_specifier::precisionChad Versace1-1/+1
Change default value to ast_precision_none, which denotes the absence of a precision of a qualifier. Previously, the default value was ast_precision_high. This made it impossible to detect if a precision qualifier was present or not.
2011-01-17glsl: Check that interpolation qualifiers do not precede 'varying'Chad Versace1-0/+7
... and 'centroid varying'. The check is performed only in GLSL versions >= 1.30. From page 29 (page 35 of the PDF) of the GLSL 1.30 spec: "interpolation qualifiers may only precede the qualifiers in, centroid in, out, or centroid out in a declaration. They do not apply to the deprecated storage qualifiers varying or centroid varying." Fixes Piglit test spec/glsl-1.30/compiler/interpolation-qualifiers/smooth-varying-01.frag.
2011-01-17glsl: Add method ast_type_qualifier::interpolation_string()Chad Versace1-0/+13
If an interpolation qualifier is present, then the method returns that qualifier's string representation. For example, if the noperspective bit is set, then it returns "noperspective".
2010-10-08glsl: Wrap ast_type_qualifier contents in a struct in a unionIan Romanick1-5/+1
This will ease adding non-bit fields in the near future.
2010-08-02glsl2: Give the path within src/mesa/ for headers instead of relying on -I.Aras Pranckevicius1-1/+1
2010-06-29glsl2: Add a method for querying if an AST type has any qualifiers.Kenneth Graunke1-0/+10
2010-06-24glsl2: Wrap includes of C interfaces with extern "C".Eric Anholt1-0/+2
2010-06-24glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt1-0/+110