src/compiler/translator/ParseContext.h


Log

Author Commit Date CI Message
Qiankun Miao 7ebb97fc 2016-09-08T18:01:50 Use 64-bits compile options BUG=chromium:645071 Change-Id: I31825123bf4cb45fb37a93f538e8936487beb5ff Reviewed-on: https://chromium-review.googlesource.com/382712 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho d0bad2c7 2016-09-09T18:01:16 Split ternary node class from TIntermSelection Ternary operator nodes are typed parts of expressions, they always have two children and the children are also guaranteed to be TIntermTyped. "If" selection nodes can't be a part of an expression, they can have either one or two children and the children are code blocks. Due to all of these differences it makes sense to store these using two different AST node classes. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I913ab1d806e3cdb5c21106f078cc9c0b6c72ac54 Reviewed-on: https://chromium-review.googlesource.com/384512 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 3272a6d3 2016-08-29T17:54:50 Promote and fold indexing nodes similarly to other binary ops Indexing nodes now get their type set in TIntermBinary::promote, same as math and logic ops. They are also constant folded through TIntermBinary::fold() instead of having special functions for constant folding them in ParseContext. Index nodes for struct and interface block member access now always have integer type, instead of sometimes having the type of the field they were used to access. Usage of TIntermBinary constructor is cleaned up so only the constructor that takes in left and right operands is used. The type of TIntermBinary nodes is always determined automatically. Together these changes make the code considerably cleaner. Note that the code for constant folding for array indexing is actually never hit because constant folding array constructors is still intentionally disabled in the code. BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ifcec45257476cdb0d495c7d72e3cf2f83388e8c5 Reviewed-on: https://chromium-review.googlesource.com/377961 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f119a263 2016-08-19T15:54:22 Clean up unary and aggregate math folding Prefer asserts instead of adding internal errors to the compiler log when types of arguments are not as expected or the folding function runs into an operation it can't handle. Neither of these cases should be possible, the checks for correct argument types are solid at this point. In the future, when new built-in functions are added, constant folding support for them should be added as well. foldUnaryWithDifferentReturnType and foldUnaryWithSameReturnType are renamed to foldUnaryNonComponentWise and foldUnaryComponentWise respectively. These names better reflect what these functions are doing. The info sink member is removed from TIntermediate, since TDiagnostics is now passed into the functions that may generate warnings instead. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I6a08abbe29cf23f3a318032fdc46dd3dbaf4410e Reviewed-on: https://chromium-review.googlesource.com/377959 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 613b959d 2016-09-05T12:05:53 Clean up qualification order checks Move determining whether qualification order checks are relaxed to QualifierTypes.cpp. The ParseContext only needs to construct TTypeQualifierBuilder with the shader version as a parameter, and it will make the decision based on that. ParseContext still passes diagnostics to the TTypeQualifierBuilder functions that return variable qualification to make it more explicit when errors are generated. Also encapsulate looking for symbols in the AST inside compiler_test.cpp. BUG=angleproject:1442 TEST=angle_unittests Change-Id: I4190e6a680ace0cc0568a517e86353a95cc63c08 Reviewed-on: https://chromium-review.googlesource.com/380556 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Martin Radev 4a9cd800 2016-09-01T16:51:51 Refactor type_specifier_nonarray parsing to reduce code repetition When type_specifier_nonarray gets parsed the scope gets saved into TType and the code becomes repetitive. Setting of the scope is moved to type_specifier_no_prec as it occurs less times. BUG=angleproject:911 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I6da5fe7bc2d60ba2996221af71b719b818f5e9b1 Reviewed-on: https://chromium-review.googlesource.com/380535 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Martin Radev 70866b89 2016-07-22T15:27:42 Change grammar to support features from es31 The grammar has been changed so that ES31 grammar is followed more closely. The ES31 grammar is not fully supported, only functionality related to qualifier enumeration is added. The ParseContext is changed so that type qualifiers can be now joined together (i.e. like layout qualifiers). This will allow enumeration of multiple storage qualifiers (i.e. uniform readonly coherent) which is essential for support of ES31 features. Some of the error checks had to be moved closer to the root of the parse tree since some of the information about the expression might be missing. Unfortunately, as there is no explicit ordering imposed by the grammar, additional checks for proper order of qualifiers had to be added. I also included unit tests which test against malformed shaders. BUG=angleproject:1442 TEST=angle_end2end_tests TEST=angle_unittests TEST=dEQP-GLES3.functional.shaders.*precision* TEST=dEQP-GLES3.functional.shaders.*function* TEST=dEQP-GLES2.functional.shaders.* Change-Id: Ib3653a1ed1bfced099a6b2cbf35a7cd480c9100d Reviewed-on: https://chromium-review.googlesource.com/362940 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Martin Radev 4c4c8e72 2016-08-04T12:25:34 Add compute program compilation and linking support Compute shaders can be now compiled and linked to create programs. Some tests are added to verify successful and unsuccessful compute shader linking. The patch also replaces std::array<int, 3> with a custom struct WorkGroupSize. BUG=angleproject:1442 TEST=angle_end2end_tests TEST=angle_unittests Change-Id: I4ab0ac05755d0167a6d2a798f8d7f1516cf54d84 Reviewed-on: https://chromium-review.googlesource.com/366740 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 1dded803 2016-08-18T18:13:13 Check multiplication validity in ParseContext This improves separation of responsibilities in the code: ParseContext should handle operand type validation, while TIntermBinary::promote should ideally only determine the type of the node based on the operation and operands. BUG=angleproject:952 TEST=angle_unittests Change-Id: I9a8d8ede21cdf35de631623a62194c0da5c604d2 Reviewed-on: https://chromium-review.googlesource.com/372622 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Qiankun Miao f69682be 2016-08-16T14:50:42 Add unittests to verify invariant doesn't leak This is a followup CL of https://chromium-review.googlesource.com/366720. Unittests is added to check invariant status does not leak across shaders. This CL also moves mInvariantVaryings and mGlobalInvariant from TSymbolTable to TSymbolTableLevel. So at the end of a compilation, the levels pop, and the settings will be cleared and will not affect the next compilation. Change-Id: I1199fade7a637276ab149ab9a599621b9977298b Reviewed-on: https://chromium-review.googlesource.com/370844 Commit-Queue: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Kenneth Russell bccc65d3 2016-07-19T16:48:43 Flatten "#pragma STDGL invariant(all)" into varying variables. This is implemented as a compiler option which is enabled by default when outputting to desktop GLSL version 130 and greater, which does not support this #pragma in fragment shaders. As a workaround, and for better compatibility on desktop OpenGL drivers, this pragma is also flattened into the outputs of vertex shaders, and the inputs of ESSL 1.00 fragment shaders. TEST=conformance/glsl/misc/shaders-with-invariance.html with --enable-unsafe-es3-apis BUG=629622, angleproject:1293 Change-Id: Ib040230915e639971505ed496d26e804c9d64e68 Reviewed-on: https://chromium-review.googlesource.com/361792 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Olli Etuaho 8a17626d 2016-08-16T14:23:01 Refactor: Return true when checks succeed in ParseContext Instead of returning false when a check succeeds in ParseContext, return true. This is more intuitive and in line with conventions used elsewhere inside ANGLE. Also includes some minor other cleanup in ParseContext, like improved variable names and code structure especially when checking array element properties. This will make introducing arrays of arrays easier in the future. BUG=angleproject:911 TEST=angle_unittests Change-Id: I68233c01ccfbfef9529341af588f615efc2b503a Reviewed-on: https://chromium-review.googlesource.com/371238 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 856c497e 2016-08-08T11:38:39 Clarify error checking function names in the GLSL parser Most error checking functions in ParseContext used to follow a format like <property>ErrorCheck. Sometimes this function would check that the node/value would have <property>, sometimes it would check that the node/value would not have it, which was confusing. Change most of these functions to use a lot more descriptive names, which clearly communicate what they are checking for. Also includes a bit of refactoring in constructorErrorCheck(), so that the function only checks for errors rather than also setting the type of the constructor node. Also make TType::arraySize unsigned, and return a sanitized size from checkIsValidArraySize() instead of using an output parameter. BUG=angleproject:911 TEST=angle_unittests Change-Id: Id9767b8c79594ad3f782f801ea68eb96df721a31 Reviewed-on: https://chromium-review.googlesource.com/367070 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 383b791a 2016-08-05T11:22:59 Remove recover() from ParseContext This call is a no-op. The shader parser is intended to almost always recover from errors, so including it doesn't clarify the code either. It's simpler to remove it entirely. BUG=angleproject:911 TEST=angle_unittests Change-Id: I0feae097c2807c8e9559672e7a3d50a2fc4fbdea Reviewed-on: https://chromium-review.googlesource.com/367040 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev 802abe01 2016-08-04T17:48:32 Add compute shader compilation support in the glsl compiler Support is added for compute shader compilation. There is a small extension to the parser so that 'local_size_x = ', 'local_size_y = ' and 'local_size_z = ' are supported as layout qualifiers. A few shader compilation tests are added and one which checks the AST whether the layout qualifiers are properly parsed. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I67283797d1cf13fa4ac47faa2a6e66d93a2db867 Reviewed-on: https://chromium-review.googlesource.com/362300 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 90892fbd 2016-07-14T14:44:51 Refine swizzle/indexing constant folding code Fix constant folding of subscripting non-square matrices. Previously constant folding would offset the pointer into the matrix in multiples of the number of columns, when it should offset the pointer in multiples of the number of rows. Also change the MalformedShaderTest so that it only succeeds if vector swizzle is being checked correctly. Previously compilation would fail in the test either way because the shader code contained a call to an undefined function. Also refactor indexing checks and constant folding so that constant folding is done entirely separately from out-of-range checks. Bogus comments are removed from the constant folding functions. BUG=angleproject:1444 TEST=angle_unittests, angle_end2end_tests Change-Id: I7073b38f759e9b3635ee05947df4f6d8e23a39d5 Reviewed-on: https://chromium-review.googlesource.com/360112 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 9de84a5d 2016-06-14T17:36:01 Clean up parsing function headers Move function header parsing code to ParseContext instead of having it in the grammar file. This commit is pure refactoring. This code needs to be changed later to detect returning arrays containing structs. This commit also disables clang format for glslang.cpp generated by bison. TEST=angle_unittests BUG=angleproject:1015 Change-Id: If60848ca32da6b98ea8bcd95bba8c3f831634b51 Reviewed-on: https://chromium-review.googlesource.com/352480 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 5f80d016 2016-01-11T11:16:01 Disallow invariant(all) pragma in ESSL 3.00 fragment shaders ESSL 3.00.4 section 4.6.1 says that using #pragma STDGL invariant(all) in a fragment shader is an error, so make it an error. This spec language is not found in ESSL 1.00, and it's been removed in ESSL 3.10. BUG=angleproject:1276 TEST=angle_unittests Change-Id: I2022f35475f867304b55dfb142f8568f6df28830 Reviewed-on: https://chromium-review.googlesource.com/321240 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Olli Etuaho ee63f5d9 2016-01-04T11:34:54 Move function parsing code to ParseContext This change is pure refactoring. It will make it easier to fix bugs related to function declarations. BUG=angleproject:911 BUG=angleproject:1067 BUG=angleproject:1068 TEST=angle_unittests Change-Id: I031783dc02612d9cf3ff7a9c8291cf8ab33577aa Reviewed-on: https://chromium-review.googlesource.com/320081 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho e1a94c67 2015-11-16T17:35:25 Check that texture offset is constant and valid Offset passed to textureOffset and similar functions must be constant. See ESSL 3.00 spec section 8.8. It must also be in the valid range between MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET. Using values outside the valid range makes the results of the texture lookup undefined, as specified in GLES 3.0.4 section 3.8.10. We generate a compiler error if an offset is outside the valid range. BUG=angleproject:1215 TEST=angle_unittests Change-Id: Ida28361444d2f4050d516160f1491674c31868a1 Reviewed-on: https://chromium-review.googlesource.com/312223 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 15c2ac30 2015-11-09T15:51:43 Fix constructor parsing issues After this patch, ANGLE no longer accepts constructors where any of multiple parameters is sampler or void. Also, structure array constructors with just one parameter are now accepted. Error message for a constructor with no parameters is also more informative than before. BUG=angleproject:1193 TEST=angle_unittests Change-Id: I6b897973448cf500096f612b3b95dcc23aebc716 Reviewed-on: https://chromium-review.googlesource.com/311590 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 1d122789 2015-11-06T15:35:17 Fix constructor constant folding The previous solution for constant folding constructors was significantly overengineered and partially incorrect. Switch to a much simpler constructor folding function that does not use an AST traverser, but simply iterates over the constant folded parameters of the constructor and doesn't do any unnecessary checks. It also reuses some code for constant folding other built-in functions. This fixes issues with initializing constant matrices with only a single parameter. Instead of copying the first component of the constructor parameter all over the matrix, passing a vec4 or matrix argument now assigns the values correctly. BUG=angleproject:1193 TEST=angle_unittests, WebGL conformance tests Change-Id: I50b10721ea30cb15843fba892c1b1a211f1d72e5 Reviewed-on: https://chromium-review.googlesource.com/311191 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7c3848e5 2015-11-04T13:19:17 Allow constant folding some non-constant expressions This requires removing the assumption that constant folding implies constness in the constant expression sense from various places in the code. This particularly benefits ternary operators, which can now be simplified if just the condition is a compile-time constant. In the future, the groundwork that is laid here could be used to implement more aggressive constant folding of user-defined functions for example. TEST=angle_unittests BUG=angleproject:851 Change-Id: I0eede806570d56746c3dad1e01aa89a91d66013d Reviewed-on: https://chromium-review.googlesource.com/310750 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 0b2d2dcf 2015-11-04T16:35:32 Move comma operator parsing to ParseContext This change is pure refactoring. It will help with fixing comma operator return value qualifier bug. BUG=angleproject:911 BUG=angleproject:1201 Change-Id: I481c337adbaf789cc959c8a1106f99ad7275e1e5 Reviewed-on: https://chromium-review.googlesource.com/311170 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 82c29ed2 2015-11-03T13:06:54 Move variable identifier parsing to ParseContext This change is purely refactoring existing functionality to make it easier to change variable identifier parsing. BUG=angleproject:911 BUG=541551 Change-Id: I282fbb66d40cd71fa0f4804e4a8e893744cd6bfc Reviewed-on: https://chromium-review.googlesource.com/309724 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho a6996685 2015-10-12T14:32:30 Automatically enable highp in fragment shaders on ESSL3 Most code using the translator already enables highp with the resources flag when a shader spec that accepts ESSL3 is used, but for example the shader_translator utility doesn't. This fix makes sure that highp is always enabled when a fragment shader written in ESSL3 or newer is being compiled. This will make shader_translator easier to use for testing ESSL3 shaders. BUG=541550 TEST=angle_unittests Change-Id: Ia1911677c55f3c5d921829a8cbb808847ac8b636 Reviewed-on: https://chromium-review.googlesource.com/305190 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 56193ce3 2015-08-12T15:55:09 Clean up parseMatrixFields Applying field selection directly on matrices is not mentioned in ESSL 1.00 or 3.00 specs. Remove erroneous code that generated odd error messages when a shader tried to apply certain kinds of field selection on a matrix. BUG=angleproject:1118 TEST=angle_unittests, dEQP-GLES3.functional.shaders.swizzles.* Change-Id: I7bbf5d0cbaee3f21d20b830d904c0feef445dd78 Reviewed-on: https://chromium-review.googlesource.com/293190 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Kimmo Kinnunen b18609b9 2015-07-16T14:13:11 Implement ES 2,3 parts of EXT_blend_func_extended for shader translation Exposes gl_SecondaryFragColor, glSecondaryFragData[] and gl_MaxDualSourceDrawBuffers to GLES SL 1.0. Relaxes rules for undefined output locations for GLES SL 3.0 and exposes gl_MaxDualSourceDrawBuffers. If the output GL context is GL ES 2.0 or 3.0: The emulation layer is expected to turn on EXT_blend_func_extended if the output GL context supports it. If the output GL context is GL: The emulation layer is expected to turn on EXT_blend_func_extended if the output GL context supports ARB_blend_func_extended or if GL context is 3.2 or later. If the source shader spec is GLES SL 2.0: The emulation layer is expected to inspect the shader compilation output variables upon linking. If output target is GL SL, the emulation layer should bind color location 0, index 1 to "angle_SecondaryFragColor" if variable "gl_SecondaryFragColorEXT" is used. Alternatively, emulation layer should bind "angle_SecondaryFragData" to locations 0,1,2,3,..., all color index 1, if "gl_SecondaryFragData" array is used. (The caller can not bind the locations or specify output variables.) If the source shader spec is GLES SL 3.0: The emulation layer is expected to do location auto-resolve of the the output variables that have undefined output locations that have not been bound by the caller. (The caller can not use gl_ built-ins, so nothing to do with those.) BUG=angleproject:1085 TEST=angle_unittest Change-Id: I5cafe205b0c29478b0dcd24aa89a7b0000f5d046 Reviewed-on: https://chromium-review.googlesource.com/287580 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Kimmo Kinnunen <kkinnunen@nvidia.com>
Olli Etuaho cc36b983 2015-07-10T14:14:18 Implement ESSL 3.00 shader input/output variable type rules ESSL 3.00 allows a wider variety of types of input/output variables than ESSL 1.00, but there are still specific restrictions on structs, matrices and arrays. Some of the checks need to be implemented twice: once for array syntax where the brackets are after the type, and another time for array syntax where the brackets are after the variable name. This requires fixes to constant folding unit tests which were previously incorrectly using matrix outputs in fragment shaders. New unit tests are added for several of the rules introduced, but some cases are also covered by dEQP. TEST=angle_unittests, dEQP-GLES.functional.shaders.linkage.varying.rules.* BUG=angleproject:1061 Change-Id: I655b054cfe56d376db775b96a2bb41b3ac5740b0 Reviewed-on: https://chromium-review.googlesource.com/285482 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 185fb403 2015-06-12T15:48:48 Move function prototypes and declarations out of the .y This will make the code easier to edit and maintain. BUG=none TEST=angle_unittests,angle_end2end_tests Change-Id: I955307d1209170fa99142103bc4d361c9eab1cc8 Reviewed-on: https://chromium-review.googlesource.com/286145 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Corentin Wallez bc99bb6b 2015-05-14T17:42:20 Enable more warnings on GCC and clang BUG=angleproject:892 Change-Id: I74ca341f29b245f698d1e1ad43149a91db46817f Reviewed-on: https://chromium-review.googlesource.com/271411 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 14e95b38 2015-05-07T10:10:41 translator: Reject shaders that use both FragColor+FragData. *re-land with fix for unused var in release* We checked this at link time in the D3D back-end, but this restriction applies to all shaders. TEST=dEQP-GLES2.functional.shaders.fragdata.* BUG=angleproject:995 BUG=478572 Change-Id: I63258f4de47e658812822f31601cc235f48c0826 Reviewed-on: https://chromium-review.googlesource.com/271470 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 531e3d22 2015-05-15T11:01:27 Revert "translator: Reject shaders that use both FragColor+FragData." The change introduced a warning in Windows release build. This reverts commit b8e3a568bbd16fca1099a1b54cd82a981cd88a8e. Change-Id: I77bbc35876043c9a164aa2665965f5189ee90052 Reviewed-on: https://chromium-review.googlesource.com/271430 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez e8675195 2015-05-14T15:31:36 Fix "unused private variable" warning in ParseContext BUG=angleproject:892 Change-Id: I3d0c23f1c2d43477c8b4ff28a6db470b3491de0b Reviewed-on: https://chromium-review.googlesource.com/271276 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill b8e3a568 2015-05-07T10:10:41 translator: Reject shaders that use both FragColor+FragData. We checked this at link time in the D3D back-end, but this restriction applies to all shaders. TEST=dEQP-GLES2.functional.shaders.fragdata.* BUG=angleproject:995 BUG=478572 Change-Id: I99111cc6aa05b9352693f9c3b5bc70d56c9842d4 Reviewed-on: https://chromium-review.googlesource.com/269846 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6e06b1f4 2015-05-14T10:01:17 Make TParseContext a class, with private data. *re-land with build fix* BUG=angleproject:995 Change-Id: I67d3ded8f6c705b54fb372857e07ce1a86b58475 Reviewed-on: https://chromium-review.googlesource.com/271162 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 749fe340 2015-05-13T21:07:55 Revert "Make TParseContext a class, with private data." Causing build errors on Linux: FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma/gomacc "C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\angle\src\compiler\translator\translator_lib.ParseContext.obj.rsp /c ..\..\third_party\angle\src\compiler\translator\ParseContext.cpp /Foobj\third_party\angle\src\compiler\translator\translator_lib.ParseContext.obj /Fdobj\third_party\angle\src\translator_lib.cc.pdb c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\validateglobalinitializer.h(11) : error C2220: warning treated as error - no 'object' file generated c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\validateglobalinitializer.h(11) : warning C4099: 'TParseContext' : type name first seen using 'class' now seen using 'struct' c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\parsecontext.h(28) : see declaration of 'TParseContext' BUG=angleproject:995 This reverts commit 6c0c2987fba9dcf2a8d432534c9548092281bfa4. Change-Id: I49a8b7df9bc8b7c4892bf3af5e2c7a6444fba890 Reviewed-on: https://chromium-review.googlesource.com/270767 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6c0c2987 2015-05-13T13:50:04 Make TParseContext a class, with private data. BUG=angleproject:995 Change-Id: Ie077e3a4f0fd5ef840aa35edeb41d15a98b7c0ff Reviewed-on: https://chromium-review.googlesource.com/270628 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 06145236 2015-05-13T13:10:01 Refactor style in ParseContext.h. BUG=angleproject:995 Change-Id: I893785a068d0d5cf4afc18123896bf540e53a3e0 Reviewed-on: https://chromium-review.googlesource.com/270627 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 37ad4744 2015-04-27T13:18:50 Add support for parsing ESSL3 invariant qualifiers The parser recognizes ESSL3 invariant variable declaration syntax and marks the variables as invariant. In ESSL3, invariant out variables can be linked to non-invariant in variables, so linking checks should now be different depending on shading language version. A shading language version dependent varying matching check is added to the translator API to facilitate this. Tested by deqp/data/gles3/shaders/qualification_order.html after patching Chrome to use the new linking check API. A previous revision of this change that broke API compatibility was reverted since it broke Chromium FYI bots. This revision keeps deprecated API functionality around for now so that changes can be rolled step-by-step to Chromium without breakage. TEST=WebGL 2 conformance tests, angle_unittests BUG=angleproject:987 Change-Id: Iecb64e3afd23e267ba999bc17f44390affcdfc13 Reviewed-on: https://chromium-review.googlesource.com/269940 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 9e64edce 2015-05-07T14:08:06 Revert "Add support for parsing ESSL3 invariant qualifiers" Build breaks in GPU FYI bots. BUG=angleproject:987 This reverts commit 4008879357159c7850cf105f2ae842bc68dd3c18. Change-Id: Ia88ad302c403c65516c050eb7741316b5097bcfb Reviewed-on: https://chromium-review.googlesource.com/269847 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 40088793 2015-04-27T13:18:50 Add support for parsing ESSL3 invariant qualifiers The parser recognizes ESSL3 invariant variable declaration syntax and marks the variables as invariant. In ESSL3, invariant out variables can be linked to non-invariant in variables, so linking checks should now be different depending on shading language version. The varying matching check in the translator API is changed to be shading language version dependent to facilitate this. Tested by deqp/data/gles3/shaders/qualification_order.html after patching Chrome to use the new linking check API. TEST=WebGL 2 conformance tests, angle_unittests BUG=angleproject:987 Change-Id: I3982feff7380c4dfc647940ee03a020692dd0c59 Reviewed-on: https://chromium-review.googlesource.com/267663 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 214c2d8e 2015-04-27T14:49:13 Separate invariance from qualifiers ESSL3 makes it possible to combine invariant with several more different qualifiers. To avoid combinatorial explosion of the qualifier enum, track invariance with a separate boolean. TEST=WebGL conformance tests, angle_unittests BUG=angleproject:987 Change-Id: I0c6629e5ca2ded06db9ac9e5bab2fb6480299a5a Reviewed-on: https://chromium-review.googlesource.com/267662 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d57e0db3 2015-04-24T15:05:08 Remove separate compilerdebug.h in favor of debug.h This unifies the behavior across the compiler and rest of ANGLE - for example, one can use #define ANGLE_TEST_CONFIG to disable UNIMPLEMENTED asserts in both the compiler and the rest of ANGLE. Compiler traces from asserts also go to the same TRACE_OUTPUT_FILE as other traces instead of being directed through ParseContext. The compiler build already includes the common sources, so no changes to build config are needed. The original version of this change was reverted due to release mode build issues. This version adds UNUSED_ASSERTION_VARIABLE where needed. TEST=angle_unittests, angle_end2end_tests, dEQP-GLES3.functional.shaders.* BUG=angleproject:983 Change-Id: I36929020a04251b8bc834fbb3c069e10128c3082 Reviewed-on: https://chromium-review.googlesource.com/267411 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill a656490d 2015-04-27T14:30:32 Revert "Remove separate compilerdebug.h in favor of debug.h" Causing compile warnings in Release: 1>compiler\translator\CallDAG.cpp(238): error C2220: warning treated as error - no 'object' file generated 1>compiler\translator\CallDAG.cpp(238): warning C4189: 'op' : local variable is initialized but not referenced 1>compiler\translator\IntermNode.cpp(1495): error C2220: warning treated as error - no 'object' file generated 1>compiler\translator\IntermNode.cpp(1495): warning C4189: 'replaced' : local variable is initialized but not referenced 1>compiler\translator\IntermNode.cpp(1517): warning C4189: 'replaced' : local variable is initialized but not referenced This reverts commit 5271025865b34685da71d0309131c5aff2e32f71. Change-Id: Icdf1c37eef22a13d083767609ab0b0285d3dc517 Reviewed-on: https://chromium-review.googlesource.com/267359 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 52710258 2015-04-24T15:05:08 Remove separate compilerdebug.h in favor of debug.h This unifies the behavior across the compiler and rest of ANGLE - for example, one can use #define ANGLE_TEST_CONFIG to disable UNIMPLEMENTED asserts in both the compiler and the rest of ANGLE. Compiler traces from asserts also go to the same TRACE_OUTPUT_FILE as other traces instead of being directed through ParseContext. The compiler build already includes the common sources, so no changes to build config are needed. TEST=angle_unittests, angle_end2end_tests, dEQP-GLES3.functional.shaders.* BUG=angleproject:983 Change-Id: Ifca4d16f667b1e5cf9c2e7cc4139940091917a1c Reviewed-on: https://chromium-review.googlesource.com/266993 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho ffe6edfd 2015-04-13T17:32:03 Add basic support for the length() method of arrays Support expressions where the expression that .length() is called on does not have side effects. Tested with WebGL 2 test sdk/tests/deqp/data/gles3/shaders/arrays.html TEST=WebGL 2 conformance tests BUG=angleproject:972 Change-Id: Ib4f8377a51da61179b6e47fbcf6b4d915e351fbd Reviewed-on: https://chromium-review.googlesource.com/265654 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 5290174b 2015-04-15T13:42:45 Refactor ternary operator parsing Refactor ternary operator parsing so that validation is done in ParseContext and Intermediate's role is simply to create the node added to the tree. Remove partially bugged checks for null nodes as a part of this - in error cases the parser doesn't typically add null nodes to the tree, but rather always has a fallback to add a dummy node if parsing fails as a method of recovery. When parsing ternary operators it should be guaranteed that none of the parameter nodes is null. Includes a better explanation of why ternary operators are not always folded when only the condition is constant, and a test to make sure this doesn't regress. BUG=angleproject:952 TEST=WebGL conformance tests, angle_unittests Change-Id: Icbcb721b5ab36cf314a16e79f9814aef1f355fa0 Reviewed-on: https://chromium-review.googlesource.com/265643 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 376f1b5d 2015-04-13T13:23:41 Add support for implicit array size ESSL3 introduces implicit array size that is determined automatically according to the initializer. Implicit sizes are resolved when parsing constructors and when initializers are evaluated, so ANGLE's AST will not contain implicit sizes. Declarations where there are two differently sized arrays with the same implicitly sized type, for example: float[] a = float[](0.0), b = float[](0.0, 1.0); will be transformed into declarations where the two arrays don't share the array size like this: float a[1] = float[1](0.0), float b[2] = float[2](0.0, 1.0); so they are not a problem. Unlike sized arrays, implicitly sized arrays don't have a size limit enforced by the parser. Include a test that verifies that non-initialization of an implicitly sized array defined using ESSL3 type syntax is caught by the parser. Additionally tested with WebGL 2 test sdk/tests/deqp/data/gles3/shaders/arrays.html TEST=WebGL 2 conformance tests, angle_unittests BUG=angleproject:941 Change-Id: Ib55b7601848102a103af9db284a80f09abaeb021 Reviewed-on: https://chromium-review.googlesource.com/265653 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3875ffd1 2015-04-10T16:45:14 Add parser support for initializing sized arrays Still missing from this patch: HLSL output, implicitly sized arrays. Tested with WebGL 2 test sdk/tests/deqp/data/gles3/shaders/arrays.html TEST=WebGL 2 conformance tests BUG=angleproject:941 Change-Id: I900f2af843fd8046f23dd4b77352e77026bbba84 Reviewed-on: https://chromium-review.googlesource.com/265652 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho e7847b08 2015-03-16T11:56:12 Unify declaration parsing code Remove the unused identifierSymbol parameter from parseSingleDeclarator and unify the ordering of parameters and the code style of different declaration and declarator parsing functions. Some minor functional changes to array size handling are done mainly to unify error message generation. There's soon going to be more of these functions, so it's good to be systematic. TEST=angle_unittests, WebGL conformance tests BUG=angleproject:941 Change-Id: I03b0220de93ca5719fdb7c1790a5999b8cb5b225 Reviewed-on: https://chromium-review.googlesource.com/265202 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho fa33d580 2015-04-09T14:33:12 Improve handling of declarator lists with empty declarations The code previously failed to check for correctness of layout qualifiers in case a declarator followed an empty declaration, like so: layout(packed) uniform float, a; Fix this by running all necessary declaration checks also for declarators which follow an empty declaration. structQualifierErrorCheck is merged into singleDeclarationErrorCheck. TEST=angle_unittests, WebGL conformance tests BUG=angleproject:969 Change-Id: Idcb0673e3bcf64087744ff0d260f51a7546f024a Reviewed-on: https://chromium-review.googlesource.com/264812 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 2935c581 2015-04-08T14:32:06 Simplify code related to variable declaration Rename nonInitErrorCheck to declareVariable to clarify that it declares variables. Merge arrayErrorCheck with that so that logic that is common between array and non-array declarations is only in one place. This will simplify adding array initializer handling. This also enables redeclaring gl_LastFragData using ESSL3 array type syntax. Comments in executeInitializer claimed that the TVariable object was needed for error recovery, but that was not actually true, so it can also use the new declareVariable method. Make "variable" a local variable instead of a parameter to executeInitializer, since the parameter was never used by callers of the function. TEST=angle_unittests, WebGL conformance tests BUG=angleproject:941 Change-Id: Ie133be62afc3e1f997370803cf21cada4e738935 Reviewed-on: https://chromium-review.googlesource.com/264674 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 6ed7bbe8 2015-04-07T18:08:46 Clean up arrayErrorCheck Remove some unnecessary TPublicType/TType conversions from the code, and clean up code style. voidErrorCheck is changed to take TBasicType so that it can be used with both TType and TPublicType. TEST=angle_unittests BUG=angleproject:941 Change-Id: I6f6cbc0761a4fc971299bad48864309009c54e7f Reviewed-on: https://chromium-review.googlesource.com/264673 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3739d235 2015-04-08T12:23:44 Make checking for array non-constness depend on input version First, remove duplicate check for const qualifier on arrays. Only keep the check inside arrayQualifierErrorCheck(). Second, ESSL3 will introduce array initializers and by extension constant arrays, so it should allow const qualifier on arrays. These checks are somewhat superfluous in ESSL1 as well, since the parser already checks for missing initializers, but it's useful to keep the informative error messages around. Add a few tests to make sure that when the ESSL3 implementation progresses, it still checks for missing initializers on constant arrays. TEST=angle_unittests BUG=angleproject:941 Change-Id: Id871c872c5b92e2a5bf81c00080ac23004916a75 Reviewed-on: https://chromium-review.googlesource.com/264671 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f6c694bc 2015-03-26T14:50:53 Assign built-in function return type in promote() This finishes the refactoring of unary math operation handling so that IntermUnary::promote has the complete code for setting the return type of the node. BUG=angleproject:952 TEST=angle_unittests, WebGL conformance tests Change-Id: I19bd8d53029e24f734c9436eceb446b37e7fcf26 Reviewed-on: https://chromium-review.googlesource.com/262416 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 69c11b5d 2015-03-26T12:59:00 Move validation from Intermediate::addUnaryMath to ParseContext Intermediate should only have logic for creating node objects, validation of parameter types belongs in ParseContext. BUG=angleproject:952 TEST=angle_unittests, WebGL conformance tests Change-Id: Ie90697641fabb2a837ccc4571a93616d63ea64e6 Reviewed-on: https://chromium-review.googlesource.com/262414 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Olli Etuaho 47fd36a7 2015-03-19T14:22:24 Move some validation from IntermBinary::promote to ParseContext This makes the role of promote() in the system clearer and helps to make the code more understandable, since more of the checks are in the same logical place. BUG=angleproject:952 TEST=angle_unittests, WebGL conformance tests Change-Id: Idb2de927d872e46210d71cf6de06a6f8c1fc5da1 Reviewed-on: https://chromium-review.googlesource.com/260803 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho d6b14287 2015-03-17T14:31:35 Move binary op array check to ParseContext Also piece together an addAssign function in ParseContext that uses the binary op array check. This will make it easier to change the array-related checks in the future to use shaderVersion. Moving validation out from IntermBinary::promote also makes the architecture clearer, promote()'s role should be mainly to determine the type of the return value of the binary operation, not to do validation. BUG=angleproject:941 TEST=angle_unittests, WebGL conformance tests Change-Id: If1de33ea250893527be7f0d7930d4678a0864684 Reviewed-on: https://chromium-review.googlesource.com/260571 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho fc1806e1 2015-03-17T13:03:11 Move most of addBinaryMath from Intermediate to ParseContext Some type checks for binary math will be different based on the shading language version, which is easily accessible in ParseContext. Because of this and also for architectural simplicity it makes more sense to have the checks in ParseContext. BUG=angle:941 TEST=angle_unittests, WebGL conformance tests Change-Id: I92a499f47e1cbc6a7b6391ce0fa04284803e7140 Reviewed-on: https://chromium-review.googlesource.com/260570 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Nico Weber 092e1a12 2015-03-09T07:40:11 Initialize fragmentPrecisionHigh in constructor. This was the only field not initialized by the constructor, which looks like an oversight. Change-Id: If61424d574c663113a4c6d31e94b6ec13b412884 Reviewed-on: https://chromium-review.googlesource.com/257360 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho c4ba3bef 2015-03-02T14:42:24 Refactor addFunctionCallOrMethod out of glslang.y TEST=angle_unittests BUG=angle:911 Change-Id: I6d4c0f0bfbf9e6252e241ae5bb1b6acdb463fce6 Reviewed-on: https://chromium-review.googlesource.com/255451 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 53f076fa 2015-02-20T10:55:14 Add basic error checks for switch and case Check that the case labels have constant scalar integers, and that switch statements are initialized with scalar integers. Also check that case and default labels do not exist outside switch statements. Allow break statements inside switch statements. Tested by manually disabling shading language version checks for switch in a Chromium build and checking that the expected errors are generated. BUG=angle:921 Change-Id: Ibe83d0db52958c493ded5640d4babf670dc02d55 Reviewed-on: https://chromium-review.googlesource.com/251523 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho a3a36664 2015-02-17T13:46:51 Implement parsing switch statements Put in some groundwork for parsing switch statements and case labels in the parser, including definitions for IntermNode classes. Intermediate functions for adding the statements are stubbed to only generate errors for now. Tested by manually disabling shading language version checks for switch in a Chromium build and checking that the expected errors are generated. BUG=angle:921 Change-Id: I064b3e0c4c1b724a083cf5bc78eebfdd3794eb1b Reviewed-on: https://chromium-review.googlesource.com/250380 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 49300865 2015-02-20T14:54:49 Refactor validating jump statements out of glslang.y Move the logic to ParseContext. This will simplify changing the logic for the break statement that is needed to implement switch. BUG=angle:921, angle:911 TEST=WebGL conformance tests Change-Id: Ib8bbc7075c05d345e90377202b5446fb3307f94c Reviewed-on: https://chromium-review.googlesource.com/251522 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho b6e07a6a 2015-02-16T12:22:10 Implement ESSL3 modf This is the first built-in function that has an out parameter, so l-value checks are added for built-ins. BUG=angle:918 Change-Id: Ifd5befe955224f706f864e25107879c9cdce9e9f Reviewed-on: https://chromium-review.googlesource.com/250780 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho a3a5cc6a 2015-02-13T13:12:22 Expose the IntermNode tree generated in the compiler for testing This refactoring makes it possible for tests to access the IntermNode tree produced by compilation by calling compileTree(). Removing ParseContext usage from OutputHLSL has the additional benefit of better separation between parsing and output. BUG=angle:916 Change-Id: Ib40954832316328772a5c1dcbbe6b46b238e4e65 Reviewed-on: https://chromium-review.googlesource.com/249723 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 09b22474 2015-02-11T11:47:26 Add addBinaryMath and addUnaryMath helpers to ParseContext This refactoring reduces code duplication and moves functionality that is not immediately related to the language grammar out of glslang.y. BUG=angle:911 Change-Id: If5e225461890ed542dee01905829df1c9a6f5e27 Reviewed-on: https://chromium-review.googlesource.com/248570 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Austin Kinross 3ae6465f 2015-01-26T15:51:39 Fix lots of variable shadowing in ANGLE BUG=angle:877 Change-Id: I3df0fffb19f5ecbe439fbc2a8d6d239a5dc6b638 Reviewed-on: https://chromium-review.googlesource.com/243334 Tested-by: Austin Kinross <aukinros@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 74cafab1 2015-01-23T23:17:32 Revert "Fix lots of variable shadowing in ANGLE" Caused WebGL CTS failures on the texture-npot test: https://www.khronos.org/registry/webgl/sdk/tests/conformance/textures/texture-npot.html This reverts commit c67e6e9fade44ef8938724e82db11db725e9c8e5. Change-Id: I089e99859231e0d657084ac3647257c650a9da92 Reviewed-on: https://chromium-review.googlesource.com/243041 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Austin Kinross c67e6e9f 2015-01-21T16:01:07 Fix lots of variable shadowing in ANGLE BUG=angle:877 Change-Id: I15168ae32605b26aee08274464ffe68adb5a7e87 Reviewed-on: https://chromium-review.googlesource.com/242351 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Austin Kinross <aukinros@microsoft.com>
Olli Etuaho 853dc1ab 2014-11-06T17:25:48 Add mediump and lowp precision emulation support for GLSL output This implements the rounding as specified in WEBGL_debug_shader_precision extension proposal for desktop GLSL and ESSL output. The bulk of the new functionality is added in the form of a new EmulatePrecision AST traverser, which inserts calls to the rounding routines angle_frm and angle_frl in the appropriate places, and writes the rounding routines themselves to the shader. Compound assignments which are subject to emulation are transformed from "x op= y" to "angle_compound_op_frm(x, y)", a call to a function which does the appropriate rounding and places the result of the operation to x. The angle_ prefixed names should not clash with user-defined names if name hashing is on. If name hashing is not on, the precision emulation can only be used if the angle_ prefix is reserved for use by ANGLE. To support the rounding routines in output, a new operator type is added for internal helper function calls, which are not subject to name hashing. In ESSL output, all variables are forced to highp when precision emulation is on to ensure consistency with how precision emulation performs on desktop. Comprehensive tests for the added code generation are included. BUG=angle:787 Change-Id: I0d0ad9327888f803a32e79b64b08763c654c913b Reviewed-on: https://chromium-review.googlesource.com/229631 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Geoff Lang 0a73dd85 2014-11-19T16:18:08 Fix include guards. BUG=angle:733 Change-Id: I08b2c11c4831f1161c178c1842b10e807185aced Reviewed-on: https://chromium-review.googlesource.com/230831 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 21203702 2014-11-13T16:16:21 Fix precision tracking of constructor return values Precision should be set for constructor return values if they are of a built-in type. Structs should not be precision qualified. BUG=angle:787 Change-Id: Ie5efd5be25a788ff6f01c5b989254572c00231eb Reviewed-on: https://chromium-review.googlesource.com/229560 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Zhenyao Mo 94ac7b78 2014-10-15T18:22:08 Invariant related processing. * Fix a bug in PreProcessor for STDGL pragma. * Record all invariant settings and set them in ShaderVariable. * Write #pragma STDGL invariant(all) in GL BUG=angle:776 TEST=https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/misc/shaders-with-invariance.html Change-Id: Ie28b75480deed79f0c9f26e3b98f1778d1290182 Reviewed-on: https://chromium-review.googlesource.com/223610 Tested-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 47e3ec08 2014-08-20T16:38:33 Add a helper method to parse invariant declarations. This pulls out more functionality from the grammar into simple c++ source files. BUG=angle:711 Change-Id: I19121d710dc1543585361cb53a0deb2ea0479db9 Reviewed-on: https://chromium-review.googlesource.com/212938 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill 5c09702f 2014-08-20T16:38:32 Add a getNamedVariable helper method to TParseContext. This method will be useful in more than one place, since we need to get a TType from an indentifier when parsing invariant declarations. BUG=angle:711 Change-Id: I1c1befbdcc93ea626428fb4e313b8c6326c158f6 Reviewed-on: https://chromium-review.googlesource.com/212937 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill b1a85f48 2014-08-19T15:23:24 Rename compiler intermediate source files. This prevents confusion between "TIntermediate" and "TIntermNode". BUG=angle:711 Change-Id: Ib7a086382a479db3f77bf2ab06ce321aa7b35d13 Reviewed-on: https://chromium-review.googlesource.com/212936 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill 183bde55 2014-07-02T15:31:19 Return shader variable information using GLenum values. Instead of duplicating GL header define values, explictly return GLenum for variable queries in the shader inspection API. This reduces the duplicate defines in the shader compiler header. BUG=angle:466 Change-Id: Iddaaff597b188251fa2e546f352bf77ab3ac43bc Reviewed-on: https://chromium-review.googlesource.com/205860 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill ce505553 2014-06-26T14:56:33 Revert "Return variable type queries using GLenum values." Breaks the FYI bots until we get Chromium patched. BUG=angle:466 This reverts commit 53221f5a0382887155d90f7f286e41190d4f5bfb. Change-Id: Ib28548df5c10a6f76f46e4cf8f2013dca5cf0ee2 Reviewed-on: https://chromium-review.googlesource.com/205850 Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 53221f5a 2014-06-25T16:04:59 Return variable type queries using GLenum values. Instead of duplicating GL header define values, explictly return GLenum for variable queries in the shader inspection API. This reduces the duplicate defines in the shader compiler header. BUG=angle:466 Change-Id: If631b20ce68747297a946e1371def7709027a613 Reviewed-on: https://chromium-review.googlesource.com/204937 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <nicolascapens@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill d4a3a317 2014-06-25T16:04:56 Rename ShHandle.h to Compiler.h. Since the above source file matches Compiler.cpp, more closely follow our standard naming convention. BUG=angle:466 Change-Id: Ib1422f87f16097f91f2bcdad550ec5bd940ce711 Reviewed-on: https://chromium-review.googlesource.com/204681 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Nicolas Capens 16004fca 2014-06-11T11:29:11 Eliminate conversion operations. They've been replaced by using constructor nodes, so any code handling conversion operators can be removed. BUG=380353 Change-Id: I70413179e7443efccbf997a5dd0f053c23689589 Reviewed-on: https://chromium-review.googlesource.com/203453 Tested-by: Nicolas Capens <nicolascapens@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6b9cb259 2013-10-17T10:45:47 Rename ParseHelper.cpp/h to ParseContext.cpp/h. TRAC #24002 Signed-off-by: Shannon Woods Signed-off-by: Geoff Lang