src/compiler/translator/ParseContext.h


Log

Author Commit Date CI Message
Shahbaz Youssefi 249cb200 2019-12-03T11:10:06 Translator: Rename TIntermInvariantDeclaration to ..GlobalQualifier.. This is to support the upcoming `precise` keyword. Bug: angleproject:3569 Change-Id: Idbcc8fd6f261757dbbf81b381e7a2dae938d8101 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1947451 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 1d02157e 2019-09-24T10:54:40 Only enable shader array size restrictions for HLSL Shader arrays are currently restricted to 64K entries for all translator back ends. This is being changed to just HLSL, since the other back ends appear to have support for larger sizes. Bug: angleproject:3865 Test: dEQP-GLES31.functional.compute.basic.copy_image_to_ssbo_large Test: dEQP-GLES31.functional.compute.basic.copy_ssbo_to_image_large Test: ComputeShaderTest.VeryLargeArrayInsideFunction/* Change-Id: I9a9d1322e24b3206debdea6a3fd517b4d6869ed9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1821943 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis b7418a17 2019-07-03T13:53:11 Restore flatten invariant behavior This was removed with a previous commit to fix behavior of invariant pragma overall, however, the flattening is still needed for the initial translation step of webGL VSs. This change restores the flattening as it previously existed, however it is now only applied to VS outputs. FS inputs are no longer flattened as the previous fixes preclude the need for that workaround any longer. Bug: 980675 Change-Id: Ia3c0471e24cae2905eb0d7bde153091e4d3829b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1687788 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Tobin Ehlis 38ff3c70 2019-05-15T10:07:09 Vulkan:Allow same-named var in nested scope ESSL 1.00 spec allows for variable with same name to override outer variable inside of a nested scope. This change adds new scope to symbol table inside of a function defintion, but after function parameters for ESSL 1.00 shaders (but not webGL). This prevents an error while parsing. This also includes some new code in translator to rename any vars that are redefined between the function body and the function parameters. This prevents an error later on when the translated shader is then parsed as a desktop GLSL version. Bug: angleproject:3287 Change-Id: I3f025805cf8d65bf912283bb15e6dad6e5e9b967 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1601553 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mingyu Hu ebab670c 2019-04-19T14:36:45 Adding new extension GL_OVR_multiview GL_OVR_multiview functions exactly the same as GL_OVR_multiview2. All GL_OVR_multiview2 tests now also repeat the same test using GL_OVR_multiview Bug: angleproject:3341 Change-Id: I7e5294fb6bbf7692535174a15da6a42e1b5fc4e2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1575904 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tobin Ehlis e9421b2c 2019-04-08T15:16:56 Vulkan:Only apply invariant pragma to output vars The "#pragma STDGL invariant(all)" directive should only be applied to shader output vars. This change also removes the workaround SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT which is no longer needed. This change fixes two tests that were incorrectly assuming that the pragma would be applied to inputs: GLSLTest.InvariantAll[Both|In]. Bug: angleproject:1293 Bug: angleproject:3285 Change-Id: I4eb03fa89fbc7c560150ee0cc32382024b0cb3e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1558678 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Enrico Galli ee7ffd9e 2018-12-13T14:07:52 ES31: Enabling skipped deqp atomic counter tests on D3D11 Enabling deqp tests previously skipped due to lack of atomic counters. Fixing bug found in translator found by new tests. * Switching atomicCounterDecrement from pre to post decrement * Added 4 byte alignment check to atomic_uint offset * Added workaround for NVIDIA D3D bug * Added globallycoherent to atomic counters Bug: angleproject:1729 Change-Id: If62ea003826fbe2df0834b905ff3ad7b76328399 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1480867 Commit-Queue: Enrico Galli <enrico.galli@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Olli Etuaho a78092cb 2018-09-26T14:16:13 Support ESSL 3.00 EXT_blend_func_extended shaders This adds support for the index layout qualifier that's used in EXT_blend_func_extended to set whether a fragment output should be bound to the primary or secondary blend source color. Output locations are now validated correctly so that two outputs can have the same location as long as they have a different index. Some tests are fixed to allow this. BUG=angleproject:1085 TEST=angle_unittests Change-Id: I1de3ad1406398952287791eca367562bed59d380 Reviewed-on: https://chromium-review.googlesource.com/1245982 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 72e3589c 2018-06-20T11:43:08 Refactor debug output of types Instead of passing around strings from TType::getCompleteString(), add a stream operator to InfoSinkBase that takes a TType. This makes the compiler executable a few kilobytes smaller and will help with getting rid of TString altogether. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I31a6693b40a28824b3959e19ad3c0a2ce0f0a35f Reviewed-on: https://chromium-review.googlesource.com/1107712 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Geoff Lang 197d5294 2018-04-25T14:29:00 Wrap all preprocessor code in the angle namespace. BUG=836820 BUG=801364 Change-Id: I08b6a2f9f12b689e09df6efd916c313e71e8a051 Reviewed-on: https://chromium-review.googlesource.com/1028581 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Olli Etuaho 5fec7ab2 2018-04-04T11:58:33 Identify functions by unique id in BuiltInFunctionEmulator Now that unique ids of all builtins are compile-time constants, we can use them to look up functions in BuiltInFunctionEmulator. This is simpler than using a custom struct with the name and parameters for identifying functions. This requires that we store a reference to a TFunction in those TIntermUnary nodes that were created based on a function. This decreases shader_translator binary size by about 6 KB on Windows. BUG=angleproject:2267 BUG=chromium:823856 TEST=angle_unittests Change-Id: Idd5a00c772c6f26dd36fdbbfbe161d22ab27c2fe Reviewed-on: https://chromium-review.googlesource.com/995372 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 59c5b897 2018-04-03T11:44:50 Validate gl_FragData and gl_FragColor access after parsing After this simply declaring both variables invariant is not treated as static use. This simplifies ParseContext a bit, but the effect on compiler performance tests seems marginal. BUG=angleproject:2450 TEST=angle_unittests Change-Id: Ib90cb1d2bd1331542d1cd37732f24efb7833036a Reviewed-on: https://chromium-review.googlesource.com/992112 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 94bbed1e 2018-03-20T14:44:53 Collect static use information during parsing We now collect metadata for variables in the symbol table. The metadata is stored in a map using the variable unique id as a key, so we can store the variables themselves as constexpr while still having dynamic metadata. For now we collect whether a variable is statically read or written. This can be used to more accurately determine whether a variable is statically used, but can also enable more optimizations in the future, such as pruning variables that are never read or folding variables that are never written after initialization. The collection is done during parsing, so that nothing is pruned from the AST before the static use is recorded. Static writes are flagged in ParseContext::checkCanBeLValue, as that function is already called for all variables that are written. Static reads are flagged whenever there's an operation that requires a variable to be read. This includes: * Unary and binary math ops * Comma ops * Ternary ops * Assignments * Returning the variable * Passing the variable as an in or inout argument to a function * Using the variable as a constructor argument * Using the variable as an if statement condition * Using the variable as a loop condition or expression * Using the variable as an index * Using the variable as a switch statement init expression In case there are statements that simply refer to a variable without doing operations on it, the variable is being treated as statically read. Examples of such statements: my_var; my_arr[2]; These are a bit of a corner case, but it makes sense to treat them as static use for validation purposes. Collecting correct static use information costs us a bit of compiler performance, but the regression is on the order of just a few percent in the compiler perf tests. BUG=angleproject:2262 TEST=angle_unittests, angle_end2end_tests Change-Id: Ib0d7add7e4a7d11bffeb2a4861eeea982c562234 Reviewed-on: https://chromium-review.googlesource.com/977964 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7b7d2e6a 2018-03-23T16:37:36 Remove createAssign: only called once This will make it easier to add tracking of static reads. BUG=angleproject:2262 TEST=angle_unittests Change-Id: I23e0587c022c45ac62434a2a0d8170e8978d1c24 Reviewed-on: https://chromium-review.googlesource.com/983916 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 697bf65c 2018-02-16T11:50:54 Avoid redundant symbol lookup when parsing functions The lexical phase looks up symbols when it encounters an identifier. Instead of duplicating this work when parsing non-constructor functions, we now store the symbol looked up in the lexical phase in TFunctionLookup. This improves scores of the real world shader compiler perf test by 1-2%. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Idc99776571313d8b654910f9daaf9bf34a048228 Reviewed-on: https://chromium-review.googlesource.com/923725 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho fbb1c792 2018-01-19T16:26:59 Store symbol names as a ImmutableString This will enable compile-time initialization of built-in symbols as well as reducing copying strings. Most of the code that deals with names is changed to use ImmutableString where it makes sense to avoid conversions. The lexer/parser now allocate const char pointers into pool memory instead of allocating TStrings. These are then converted to ImmutableString upon entering TParseContext. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: I244d6271ea1ecf7150d4f89dfa388a7745a1150c Reviewed-on: https://chromium-review.googlesource.com/881561 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 95ed1947 2018-02-01T14:01:19 Add a class for function lookups Using a purpose-built class for function lookups instead of using a combination of TFunction and a struct container for the this node and arguments makes the code clearer. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I3f345d836abeaa7f84cc46b4b840fd06c7e2e1a7 Reviewed-on: https://chromium-review.googlesource.com/897363 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho dd21ecf8 2018-01-10T12:42:09 Add const qualification to symbol accesses All accesses to built-in symbols now happen through const-qualified pointers. This also encapsulates TSymbolTableLevel inside TSymbolTable. This prepares for statically allocating built-in symbols. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I473014d978daa765b4a733d761d6c08b28288776 Reviewed-on: https://chromium-review.googlesource.com/859959 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho b60d30f7 2018-01-16T12:31:06 Make TVariable type immutable This enables using constexpr types for built-in variables and some of the variables created in AST transformations. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Ie85b3c9872a071a7c023ced013b14ad91cff7cee Reviewed-on: https://chromium-review.googlesource.com/868134 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho c74ec1a5 2018-01-09T15:23:28 Record gl_in array size in a symbol in ParseContext Instead of referring to the gl_in symbol in the symbol table, create a gl_in symbol with the right array size once the array size is known. This makes the type of TIntermSymbol nodes pointing to gl_in consistent with the variable type. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I31673d33526a91f8d069ee8d7d2f181a49665fd0 Reviewed-on: https://chromium-review.googlesource.com/857004 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 765924f0 2018-01-04T12:48:36 Fold ternary and comma ops only after parsing is done In case folding a ternary op or a comma op would change the qualifier of the expression, the folding is deferred to a separate traversal step. After this there are no more cases where the type of a TIntermSymbol node needs to differ from the type of the variable it is referring to. There are still some cases where some parts of TIntermSymbol type are changed while keeping the TVariable type the same though, like when assigning array size to gl_PerVertex nodes or sanitizing qualifiers of struct declarations. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: I1501c8d361f5f765f43ca810d1b7248d9e2c5986 Reviewed-on: https://chromium-review.googlesource.com/850672 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho bed35d76 2017-12-20T16:36:26 Don't query names of empty symbols This makes it possible to return a reference from TSymbol::name() instead of a pointer. This is safer since it completely avoids the possibility of a nullptr dereference. An assert is making sure that the function is not being called for empty symbols. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I44279f65989dbb828322843fc0216ba84d91dedf Reviewed-on: https://chromium-review.googlesource.com/836894 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 0c37100d 2017-12-13T17:00:25 Always create TFunctions for function call nodes This simplifies code and ensures that nodes get consistent data. In the future function call nodes could have a pointer to the TFunction instead of converting the same information into a different data structure. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: Ic0c24bb86b44b9bcc4a5da7f6b03701081a3af5c Reviewed-on: https://chromium-review.googlesource.com/824606 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d5f44c98 2017-11-29T17:15:40 Simplify parsing struct field declarators This removes the dummy type that was attached to struct declarators while parsing. This makes TParseContext::addStructDeclaratorList in particular simpler to understand. The new TDeclarator data type is the parsed representation of the struct_declarator grammar rule. It is completely immutable. The name and location stored in TField can also be qualified as constant now. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I2834f87fc0eee0bdb7673ef495a55fb463023c55 Reviewed-on: https://chromium-review.googlesource.com/797033 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ebee5b3b 2017-11-23T12:56:32 Add GLSL support for runtime-sized arrays in SSBOs The GLSL parser now allows a runtime-sized array as the last member in a shader storage block. Clamping indexing against the memory bounds is done by determining the array length at runtime. Runtime-sized arrays are used in dEQP tests for many compute shader tests, so these now work on the OpenGL backend. BUG=angleproject:1951 TEST=angle_unittests, dEQP-GLES31.functional.shaders.linkage.shader_storage_block.* dEQP-GLES31.functional.shaders.builtin_functions.*compute* Change-Id: Ibecca24623ca8e4723af6f0e0421fe9711ea828d Reviewed-on: https://chromium-review.googlesource.com/787976 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 7881cfdf 2017-08-23T18:00:21 Add parsing of arrays of arrays This changes the grammar so that multiple array sizes can be chained together, and adds arrays of arrays support to TPublicType. In TPublicType the array sizes are stored using a pointer to a vector, a plain vector won't work due to bison restrictions. A larger subset of program interface query tests now pass. Some are still failing due to unrelated bugs. BUG=angleproject:2125 TEST=angle_unittests, angle_end2end_tests, dEQP-GLES31.functional.shaders.arrays_of_arrays.* dEQP-GLES31.functional.uniform_location.nested_array.* dEQP-GLES31.functional.program_interface_query.* dEQP-GLES31.functional.ubo.*level*array.* Change-Id: Iee16477a3752b953f5068c0473a2ed62fead8155 Reviewed-on: https://chromium-review.googlesource.com/633944 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiajia Qin a3106c58 2017-11-03T09:39:39 ES31: Add atomic memory functions BUG=angleproject:1442 TEST=angle_unittests, angle_end2end_tests dEQP-GLES31.functional.compute.shared_var.atomic* dEQP-GLES31.functional.compute.basic.shared_atomic_op* dEQP-GLES31.functional.ssbo.atomic.* Change-Id: I82b54fde3a852d3bd917b1e19680baa1c28fce4d Reviewed-on: https://chromium-review.googlesource.com/765061 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 703671e9 2017-11-08T17:47:18 Unify extension behavior checks Some supportsExtension and isExtensionEnabled checks are now turned into checkCanUseExtension checks. Using checkCanUseExtension is preferable so that warnings are generated correctly when an extension is used and a warn directive is present. isExtensionEnabled is still used in some places where an error message about the extension could be confusing, particularly when a core spec version adds support for something that is also present in an extension. Also make it possible to disable ARB_texture_rectangle extension using an extension directive. ARB_texture_rectangle extension functionality is enabled by default in GLSL when the extension is supported. BUG=angleproject:2238 TEST=angle_unittests Change-Id: I7455293412ff469f54bc7da79df146e7bc127379 Reviewed-on: https://chromium-review.googlesource.com/760737 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho b8ee9dd3 2017-10-30T12:43:27 Validate empty statements in switch statements Even an empty statement like ";" is a statement according to the grammar. They should not be allowed in switch statements before the first case statement, but on the other hand a switch statement that has just an empty statement after the last statement is valid. Now the parser creates AST nodes from empty statements so that we can validate switch statements correctly. However, they are pruned shortly after parsing completes in PruneNoOps, so they don't affect further processing of the AST. BUG=angleproject:2181 TEST=angle_unittests Change-Id: I1085056fc34b146142546fc5f2b7f3124b910ab9 Reviewed-on: https://chromium-review.googlesource.com/743621 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 722bfb51 2017-10-26T17:00:11 Fix detecting duplicate field names in structures Previously field names that were listed in the first declarator list inside a struct declaration were not checked against each other. BUG=angleproject:2204 TEST=angle_unittests Change-Id: Ibf821d45556f6dfe0223dae673644f6795daf4cb Reviewed-on: https://chromium-review.googlesource.com/739825 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 55bc905f 2017-10-25T17:33:06 Always consider type arrayness for atomic counters Atomic counter arrays may be declared with various different syntax - the array size may be declared as a part of the type or as a part of the declarator. Take this into account when determining whether atomic counter offsets overlap. BUG=angleproject:1729 TEST=angle_unittests Change-Id: I7435ded9401c4c1caab22c22d83fd2ad301df768 Reviewed-on: https://chromium-review.googlesource.com/738140 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Qin Jiajia ca68d988 2017-09-18T16:41:56 ES31: Add std430 support for OpenGL backend BUG=angleproject:1920 TEST=angle_unittests Change-Id: Ie8e171abec053c2c5dca93d6e79db534f74520e7 Reviewed-on: https://chromium-review.googlesource.com/737532 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 4ddae359 2017-10-26T16:20:18 Use array_specifier in struct declarator parsing This will make implementing arrays of arrays simpler for struct members as well. Similar refactoring was already done for other types of array declarations. BUG=angleproject:2125 TEST=angle_unittests Change-Id: I0483c3a7c006d37090c7c972cb3d7763d3909c8f Reviewed-on: https://chromium-review.googlesource.com/739824 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 454c34cb 2017-10-25T16:35:56 Accept valid geometry shader inputs regardless of syntax Before, only the following style of declarations were accepted: in float f[]; Now also these styles are accepted: in float[] f; in float f[], g[]; BUG=angleproject:2201 TEST=angle_unittests Change-Id: I0af7d355a5e06a67ceef2d6bd69af7e23c180a04 Reviewed-on: https://chromium-review.googlesource.com/738234 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 55bde916 2017-10-25T13:41:13 Parse array specifier with a separate grammar rule This brings the grammar closer to the GLSL ES 3.10 spec. Some corner cases related to handling unsized arrays are fixed. BUG=angleproject:2125 TEST=angle_unittests, angle_end2end_tests Change-Id: I9bcf87b17b97da0e2ec2954d32037c272fde3080 Reviewed-on: https://chromium-review.googlesource.com/738233 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiawei Shao 8e4b355b 2017-08-30T14:20:58 ES31: Implement Geometry Shader inputs and outputs This patch intends to implement Geometry Shader inputs and outputs in ANGLE GLSL compiler. 1. Only accept arrays as the inputs of a Geometry Shader. 2. Allow unsized arrays as the inputs of a Geometry Shader after a valid input primitive declaration and assign size to them. 3. Implement Geometry Shader outputs. 4. Allow Geometry Shader inputs and outputs using interpolation qualifiers ('flat', 'smooth', 'centroid'). 5. Allow using 'location' layout qualifier on Geometry Shader inputs and outputs. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ia7e250277c61f45c8479437b567c2831ff26b433 Reviewed-on: https://chromium-review.googlesource.com/650211 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev 84aa2dcf 2017-09-11T15:51:02 Add textureGather and textureGatherOffset The patch adds new built-ins and extends the semantic parser to add support for textureGather and textureGatherOffset. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_deqp_gles31_tests.exe --deqp-case=dEQP-GLES31.functional.texture.gather* --deqp-egl-display-type=angle-gl Change-Id: Iaf98c3420fbd61193072fdec8f5a61ac4c574101 Reviewed-on: https://chromium-review.googlesource.com/660124 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 2a1e8f95 2017-07-14T11:49:36 Refer to GLSL extensions through TExtension enum Extensions are now referred to by enum values instead of strings most of the time. This gets rid of unnecessary copying of strings. The code is easier to work with than before as typoing the extension enum names will be caught by the compiler. BUG=angleproject:2147 TEST=angle_unittests Change-Id: Ifa61b9f86ef03211188fc23bc23a5ce4e4d8c390 Reviewed-on: https://chromium-review.googlesource.com/571002 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ec3a9cbb 2017-09-07T12:18:01 Only support GL_OVR_multiview extension variant The WebGL spec proposal was changed so that only GL_OVR_multiview extension name is supported, instead of having two variants OVR_multiview and OVR_multiview2. We're only supporting the WebGL version of the shader extension, so we drop compiler support for GL_OVR_multiview2. Shader restrictions were also removed from the WebGL spec, so no special validation for how ViewID_OVR gets used is needed. Tests that were testing for the shader restrictions are either removed or changed from negative tests to positive tests. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I83f92b879376d41b727b5aca419fd75fb6f53477 Reviewed-on: https://chromium-review.googlesource.com/654608 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho e080387e 2017-08-23T15:30:23 Refactor array element type checks Remove checks that would never fail, and refactor the functions into more self-contained checks. For example, it doesn't make sense to check the qualifier from the part of the type that doesn't contain the qualifier. This prepares for adding the parsing of arrays of arrays. BUG=angleproject:2125 TEST=angle_unittests Change-Id: I1144bee35d2b04c7cb22e2bb7e17307298e35f8c Reviewed-on: https://chromium-review.googlesource.com/629016 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 96f6adfa 2017-08-16T11:18:54 Add support for arrays of arrays in AST processing Data concerning arrays of arrays is added in TType. Parsing arrays of arrays and support for arrays of arrays in TPublicType are still left to be implemented later. ShaderVariable interface for arrays of arrays is also left to be implemented later. We rely on existing test coverage to make sure that arrays of arrays are not accidentally exposed. BUG=angleproject:2125 TEST=angle_unittests, angle_end2end_tests, angle_deqp_gles31_tests Change-Id: Ie17d5ac9b8d33958e9126dc0fb40bf1c81ddeec9 Reviewed-on: https://chromium-review.googlesource.com/616146 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jiawei Shao d8105a03 2017-08-08T09:54:36 ES31: Implement gl_in in Geometry Shader This patch intends to implement geometry shader built-in interface block instance gl_in defined in GL_OES_geometry_shader. 1. Add the definition of gl_in and its interface block gl_PerVertex into the symbol table. 2. Support gl_Position as a member of gl_in. 3. Set the array size of gl_in when a valid input primitive type is known. 4. Add check that it should be a compile error to index gl_in or call length() on gl_in without a valid input primitive declaration. This patch also adds unit tests to cover all these new features. BUG=angleproject:1941 TEST=angle_unittests Change-Id: I8da20c943b29c9ce904834625b396aab6302e1e1 Reviewed-on: https://chromium-review.googlesource.com/605059 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Shao b5cc1198 2017-07-06T10:47:20 ES31: Add Geometry Shader layout qualifiers in GLSL compiler This patch intends to implement Geometry Shader layout qualifiers required in OpenGL ES 3.1 extension GL_OES_geometry_shader in ANGLE GLSL compiler. 1. Add support to the shader type GL_GEOMETRY_SHADER_OES. 2. Implement Geometry Shader layout qualifiers in the GLSL compiler: (1) Add support to OpenGL ES 3.1 extension "GL_OES_geometry_shader". (2) Add validations of the input and output primitive declarations in the Geometry Shader layout declarations. (3) Add 'invocations' and 'max_vertices' support in the Geometry Shader layout declarations 3. Add unit tests to cover all the new features added in this patch. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ie693e11f8a00dab3552626ed63e9336c7fbd3cb8 Reviewed-on: https://chromium-review.googlesource.com/560647 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiajia Qin bc58515e 2017-06-23T15:42:17 ES31: Add 'buffer' qualifier support in shader This change added 'buffer' qualifier support in shader which corresponds to ESSL 3.1 spec, session 4.3.7 'Buffer Variables'. BUG=angleproject:1951 TEST=angle_unittests:BufferVariablesTest Change-Id: I2ecb5317d5ea9d378a60b03f86bdae04dbd89e9f Reviewed-on: https://chromium-review.googlesource.com/534960 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 3ec75686 2017-07-05T17:02:55 Collect AST transform utilities to a separate file Collect static functions that are used to create nodes in AST transformations into a single file. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I6f87422988fa088f2f4b48986e378a2909705cb7
Olli Etuaho 56229f1b 2017-07-10T14:16:33 Remove TIntermediate::addConstantUnion This includes asserts in TConstantUnion to reveal incorrect usage of union - reading a different field of an union that has last been set is undefined behavior in C++. Existing issues with accessing incorrect fields of constant unions are fixed. BUG=angleproject:1490 TEST=angle_unittests Change-Id: Idd6b7a871d73e2928f117a9348c92043612fab82
Olli Etuaho eb7f90fd 2017-07-07T17:25:23 Remove simple Intermediate.h functions Most of the functions were just simple wrappers around node constructors. Dropping this extra redirection makes the code simpler. The fold() functions of node types are simplified, so that if the node can't be folded the pointer to the node itself is returned. This makes the code in ParseContext more straightforward. The few remaining functions in Intermediate are a bit more complex so they should be handled separately, but they'll be removed eventually as well. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I85e11919d1f62358cfba9c011b841e32bc25402f Reviewed-on: https://chromium-review.googlesource.com/563393 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho cce8965d 2017-06-19T16:04:09 Remove most of the remaining logic from glslang.y Move most of the logic in glslang.y to ParseContext. This will make it easier to change the code in the future. Only a few specific bits of logic are kept in glslang.y: * Disabling a parsing rule when a given shading language version is being parsed. This makes it easier to check the grammar against the grammar in the GLSL ES specs. * Scoping calls that need to be paired with another call. It's much easier to check these for correctness when the paired calls are next to each other. BUG=angleproject:911 TEST=angle_unittests Change-Id: I52f42a1fc0f28463ca4b237dc6e88345e5173064 Reviewed-on: https://chromium-review.googlesource.com/539640 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 914b79a6 2017-06-19T16:03:19 Fix parsing GLSL loop conditions that declare a variable Now the variable declaration is included in the AST, so that the loop body may refer to the variable. The variable declaration is placed in a block that wraps the loop. This way we can still only have TIntermTyped loop conditions in the AST, which keeps the code dealing with loops fairly simple and type safe. This change includes reversing the return value of executeInitializer, so that it returns true on success and false on error. This is more in line with other ParseContext member functions. BUG=angleproject:2073 TEST=angle_end2end_tests Change-Id: I5c4ecbf1b438d3fff6d6237c0dcf191e2a19664c Reviewed-on: https://chromium-review.googlesource.com/539639 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
jchen10 4cdac9eb 2017-05-08T11:01:20 ES31: Add atomic counter for GLSL parsing This makes shader compiler support the new basic type 'atomic_uint' and validate its layout qualifiers properly. BUG=angleproject:1729 TEST=angle_unittests:AtomicCounterTest angle_deqp_gles31_tests:dEQP-GLES31.functional.atomic_counter.layout.invalid* angle_deqp_gles31_tests:dEQP-GLES31.functional.debug.negative_coverage.*.atomic* Change-Id: Ia237eadf6ea72314f436a0abbb93a05598e71eba Reviewed-on: https://chromium-review.googlesource.com/500088 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 af713a24 2017-04-19T09:10:56 ES31: Implement binding layout for uniform blocks The binding point of uniform blocks can be specified in shaders with this CL. See spec ESSL 3.10, section 4.4.4, page 58 for more info. dEQP-GLES31.functional.ubo.* still can't completely pass as the missing of arrays-of-arrays feature. Neither can dEQP-GLES31.functional.layout_binding.ubo.* due to the incomplete implementation of program interface APIs. TEST=angle_end2end_tests:UniformBufferTest BUG=angleproject:1442 Change-Id: If95d468fc109834a132b9b817730d3fdc3a615da Reviewed-on: https://chromium-review.googlesource.com/483848 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 95468d17 2017-05-04T11:14:34 Support multiview in ESSL 1.00 shaders Support is added according to the proposal for WEBGL_multiview. When the multiview extension is enabled in an ESSL 1.00 shader, num_views can be specified using a layout qualifier. To support this, enabling the multiview extension makes "layout" a keyword rather than an identifier in ESSL 1.00. The type of gl_ViewID_OVR is also different in case of ESSL 1.00: it has to be a signed integer, since unsigned integers are not supported in ESSL 1.00. Some existing tests for multiview shaders are extended in this patch. The changes make sure that vertex shader "in" qualifier is still allowed in ESSL 3.00 multiview shaders, since this patch adds code to disallow it in ESSL 1.00 multiview shaders. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I65dbbbebabdb24cf0bb647d40aa80cebf713c4f7 Reviewed-on: https://chromium-review.googlesource.com/506088 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho a7ecec38 2017-05-08T17:43:55 GLSL: Simplify constructor parsing Constructor argument checking rules are reorganized to make them easier to understand and constructor node creation is made simpler. This removes usage of constructor op codes from ParseContext. This paves the way for getting rid of constructor op codes entirely, which will remove duplicate information from the AST and simplify lots of code. This refactoring will make adding arrays of arrays slightly easier. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I4053afec55111b629353b4ff7cb0451c1ae3511c Reviewed-on: https://chromium-review.googlesource.com/498767 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
jchen10 cc2a10e9 2017-05-03T14:05:12 Unify opaque type validation in GLSL parsing Refactor separate sampler and image validations into unified opaque type handling. This paves way for adding atomic counter, another new opaque type. BUG=angleproject:1729 Change-Id: I201d28e31c84534db43e656d518650e378bab76c Reviewed-on: https://chromium-review.googlesource.com/493618 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho bb7e5a7c 2017-04-24T10:16:44 GLSL parser: Fix empty declaration qualifier checks The shader validation now does the same checks for qualifier combinations regardless of if a declaration is empty, as is specified. Some of these checks used to be in singleDeclarationErrorCheck, and have now been moved to a new function declarationQualifierErrorCheck. The other parts of singleDeclarationErrorCheck are under a renamed nonEmptyDeclarationErrorCheck. The patch also contains another related cleanup: Unnecessary symbol nodes won't be created for empty declarations any more. BUG=angleproject:2020 TEST=angle_unittests Change-Id: I1c864a5e151c52703926d8c550450b2561bfcbb2 Reviewed-on: https://chromium-review.googlesource.com/493227 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Andrei Volykhin a5527071 2017-03-22T16:46:30 Add support for EXT_YUV_target Add new sampler type "__samplerExternal2DY2YEXT" to sample a YUV texture image and output color value without any color conversion, new additional type to specify color space standard formula and built-in functions for yuv to rgb transformation. Change-Id: I1780650fe84cd75191c1ca1e4118e89d585bfd92 Reviewed-on: https://chromium-review.googlesource.com/454697 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 6ca2b65c 2017-02-19T18:05:10 Implement location layout qualifier for uniforms This is a complete implementation of the uniform location layout qualifier. Uniform location set in the shader is plumbed to shader linking, which does several link-time checks for conflicts and recursively applies the location to struct members. Validate that location is consistent as specified in the table in section 9.2.1 of the ESSL 3.10.4 spec. The location set in the shader overrides the one set via the CHROMIUM_bind_uniform_location API. Location conflicts must be checked even if the uniforms are not statically used. Because of this unused uniforms are now recorded during uniform linking. After linking checks are done, unused uniforms are pruned from the program state. Location is validated against the maximum number of uniform locations at compile time as specified in section 4.4.3 of the ESSL 3.10.4 spec. All dEQP uniform location tests don't yet pass due to unrelated bugs. BUG=angleproject:1442 TEST=angle_end2end_tests, dEQP-GLES31.functional.uniform_location.* Change-Id: I1f968e971f521fbc804b01e1a7c2b4d14f24d20f Reviewed-on: https://chromium-review.googlesource.com/447942 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 4336489f 2017-02-13T16:00:12 Parse binding layout qualifier for opaque types This patch adds binding layout qualifier support for opaque types. Binding layout qualifier on blocks is not yet supported. This includes support for GLSL output and some minor simplification of related functionality in ParseContext. TEST=angle_unittests, dEQP-GLES31.functional.layout_binding.* BUG=angleproject:1442 Change-Id: I53fb505b5a539bccee70613f3969fba81965ae84 Reviewed-on: https://chromium-review.googlesource.com/441586 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho af6fc1b4 2017-01-26T17:45:35 Make aggregate node creation more robust Now aggregate nodes are always built with their return type, op and arguments set. They'll determine their qualifier and precision automatically. This fixes setting of gotPrecisionFromChildren in a few cases. This will also make it easier to split TIntermAggregate further into specialized classes if that is desired. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I1fbe0c75679c517a22d44dfc1ea160ad7a7fdfda Reviewed-on: https://chromium-review.googlesource.com/433468 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 2be2d5ae 2017-01-26T16:34:30 Clean up unary node creation When createUnaryNode() is called, the child node is guaranteed to be non-null. This enables simplifying it. BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ib1d021bbbeab99a6bf1b1be470181e9efbe301c6 Reviewed-on: https://chromium-review.googlesource.com/433467 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 72d1020e 2017-01-19T15:58:30 Refactor function call node creation This makes function call node creation code simpler and more type safe. It also prepares for further simplification by removing usage of TFunction in places where the arguments node is sufficient. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I75d9e059bb32c475487f0be24e40ac0d78012d86 Reviewed-on: https://chromium-review.googlesource.com/433217 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 8ad9e757 2017-01-16T19:55:20 Always store function headers in TIntermFunctionPrototype nodes TIntermFunctionDefinition nodes now have a TIntermFunctionPrototype child that stores the function signature, instead of having a separate type and an aggregate child that stores the parameters. This makes parsing functions simpler, and paves the way for further simplifications of function parsing, like reducing conversions between symbol table structures and AST structures. TIntermAggregate is now only used for function calls. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: Ib56a77b5ef5123b142963a18499690bf37fed987 Reviewed-on: https://chromium-review.googlesource.com/427945 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 16c745a3 2017-01-16T17:02:27 Split TIntermFunctionPrototype from TIntermAggregate Function prototypes now have their own class TIntermFunctionPrototype. It's only used for prototypes, not function parameter lists. TIntermAggregate is still used for parameter lists and function calls. BUGS=angleproject:1490 TEST=angle_unittests Change-Id: I6e246ad00a29c2335bd2ab7f61cf73fe463b74bb Reviewed-on: https://chromium-review.googlesource.com/427944 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 09b04a2f 2016-12-15T13:30:26 Add shader translator support for OVR_multiview The OVR_multiview and OVR_multiview2 extensions add gl_ViewID_OVR to shaders. gl_ViewID_OVR can be translated either as is in GLSL output or as a uniform by setting the SH_TRANSLATE_VIEWID_OVR_AS_UNIFORM compiler flag. If WebGL output is selected, the shaders will be validated according to proposed rules in the WEBGL_multiview spec. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I19ea3a6c8b4edb78be03f1a50a96bfef018870d0 Reviewed-on: https://chromium-review.googlesource.com/422848 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 77ba408a 2016-12-16T12:01:18 Unify Diagnostics interface Use the same kind of interface for reporting preprocessor errors as for reporting regular compiler errors, and make global errors like having too many uniforms also go through Diagnostics. Also don't create std::string objects unnecessarily. Includes cleanups of some dead code related to reporting errors. BUG=angleproject:1670 TEST=angle_unittests Change-Id: I3ee794d32ddeec1826bdf1b76b558f35259f82c0 Reviewed-on: https://chromium-review.googlesource.com/421527 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 4de340ac 2016-12-16T09:32:03 Remove extraInfo parameter from compiler diagnostic functions This makes error messages more consistent. It was not clear what was supposed to go to the extraInfo parameter, and previously it was mostly being misused, resulting in poorly formatted error messages. Sometimes the order of parameters to the diagnostic functions like error() and warning() was wrong altogether. The diagnostics API is simpler when there's only the "reason" and "token" parameters that have clear meaning and that are separated by consistent punctuation in the output. Fixes error messages like "redifinition interface block member" to be grammatically reasonable like the rest of the error messages. For other error messages, punctuation is added to make them clearer. Example: "invalid layout qualifier location requires an argument" is changed to "invalid layout qualifier: location requires an argument". Extra spaces are also removed from the beginning of error messages. BUG=angleproject:1670 BUG=angleproject:911 TEST=angle_unittests Change-Id: Id5fb1a1f2892fad2b796aaef47ffb07e9d79759c Reviewed-on: https://chromium-review.googlesource.com/420789 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho bf4e1b73 2016-12-09T11:30:15 Split TIntermInvariantDeclaration from TIntermAggregate This change is pure refactoring and doesn't fix bugs related to invariant declarations. Invariant declarations are supposed to accept a list of identifiers, but this refactoring keeps the current behavior of only accepting a single identifier in an invariant declaration. When the bug will be fixed, the new TIntermInvariantDeclaration class that now has only a single child node can be changed so that it may have multiple children. TIntermAggregate is still used for function calls, function prototypes and function parameter lists. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I3e22092c87e1c06445fd7e123d9922c2fcb59428 Reviewed-on: https://chromium-review.googlesource.com/419415 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev b8b0122f 2016-11-20T23:25:53 Add compiler support for shared memory The patch adds handling of the 'shared' qualifier in the shader compiler. BUG=angleproject:1442 TEST=angle_unittests Change-Id: Iaa288026af0faf2a30e40495faa6ea1f5ff02323 Reviewed-on: https://chromium-review.googlesource.com/413200 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill d7b1ab58 2016-12-12T14:42:19 Fix up translator style. Using git cl format. BUG=angleproject:650 Change-Id: I7d3f98d2b0dcfb0a8de6c35327db74e55c28d761 Reviewed-on: https://chromium-review.googlesource.com/419059 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 45bcc784 2016-11-07T13:58:48 translator: Scope all classes with "sh". I was seeing an odd problem with our PoolAlloc conflicting with the glslang/Vulkan TIntermNode, so the fix was to move everything to a separate namespace. The bison grammars are also regenerated. No functional changes. BUG=angleproject:1576 Change-Id: I959c7afe4c092f0d458432c07b4dcee4d39513f3 Reviewed-on: https://chromium-review.googlesource.com/408267 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill acb4b81a 2016-11-07T13:50:29 translator: Put ShaderLang APIs in "sh" namespace. Working with glslang in Vulkan means we are static linking libANGLE with functions that have the same name as our translator APIs. We can fix this by scoping our APIs. We don't need to scope the types of the file, since they don't conflict. This will require a follow-up patch to remove the unscoped APIs once we switch over Chromium. We also scope TCompiler and some related classes to avoid multiply defined link errors with glslang. BUG=angleproject:1576 Change-Id: I729b19467d2ff7d374a82044b16dbebdf2dc8f16 Reviewed-on: https://chromium-review.googlesource.com/408337 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 0e3aee3f 2016-10-27T12:56:38 Check precision qualification for all declarations Precision qualification is now checked properly also for declarations that don't have qualifiers. BUG=angleproject:1574 TEST=angle_unittests Change-Id: I3d186df0763e071614c1da9a355a6f6fefdc8091 Reviewed-on: https://chromium-review.googlesource.com/403949 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 13389b66 2016-10-16T11:48:18 Split TIntermDeclaration from TIntermAggregate The new class TIntermDeclaration is now used for struct, interface block and variable declarations. TIntermDeclaration nodes do not have a type - rather the type is stored in each child node. The types may differ in case the declaration is a series of array declarators with mismatching sizes. TIntermAggregate is still used for function calls, function prototypes, function parameter lists and invariant declarations. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I0457188f354481470855f61ac1c878fc2579b1d1 Reviewed-on: https://chromium-review.googlesource.com/400023 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Martin Radev 2cc85b3b 2016-08-05T16:22:53 Add support for images in the compiler The patch adds support for GLSL ES 3.1 image types. Internal format layout qualifiers for images are added. Support for the readonly and writeonly qualifiers are added. The other memory qualifiers are omitted as to make the patch simpler. Tests are added which check for correct and incorrect usage of images, internal format layout and memory qualifiers. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: Ie4d3acb2a195de11b405ad54110a04c4c1de0b7e Reviewed-on: https://chromium-review.googlesource.com/378855 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f0173153 2016-10-17T09:05:03 Forbid shared and packed layouts in WebGL WebGL 2.0 spec section 5.25 specifies this. BUG=angleproject:1542 TEST=WebGL 2 conformance tests Change-Id: Ic5758bc0e767a8e6dd032e42c0a69bcae06381c4 Reviewed-on: https://chromium-review.googlesource.com/399682 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 336b1470 2016-10-05T16:37:55 Split TIntermFunctionDefinition from TIntermAggregate This makes the code easier to understand. Function definition nodes always have just two children, the parameters node and the function body node, so there was no proper reason why they should be aggregate nodes. As a part of this change, intermediate output is modified to print symbol table ids of functions so that debugging function id related functionality will be easier in the future. After this patch, TIntermAggregate is still used for function prototypes, function parameter lists, function calls, variable and invariant declarations and the comma (sequence) operator. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: Ib88b4ca5d21abd5f126836ca5900d0baecabd19e Reviewed-on: https://chromium-review.googlesource.com/394707 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 476197f9 2016-10-11T13:59:08 Clean up TSymbol initialization Now TSymbol objects always get their id when they are constructed. The id cannot be changed after the TSymbol is created. This makes it simpler to insert both mangled and unmangled versions of a function to the symbol table. These can now both share the same TSymbol object, unlike before, when inserting the same symbol twice would have changed its symbol id. This requires changes to function definition parsing: function definition nodes now share any symbol created by previous prototype declarations of the function. The parameters on the symbol get set to the parameters in the function definition header. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I8e600e9b5e5de27d64b85c5042cfd23ff02abe63 Reviewed-on: https://chromium-review.googlesource.com/396838 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 6d40bbdd 2016-09-30T13:49:38 Split TIntermBlock from TIntermAggregate The new TIntermBlock node class replaces TIntermAggregate nodes with the EOpSequence op. It represents the root node of the tree which is a list of declarations and function definitions, and any code blocks that can be denoted by curly braces. These include function and loop bodies, and if-else branches. This change enables a bunch of more compile-time type checking, and makes the AST code easier to understand and less error-prone. The PostProcess step that used to be done to ensure that the root node is TIntermAggregate is removed in favor of making sure that the root node is a TIntermBlock in the glslang.y parsing code. Intermediate output formatting is improved to print the EOpNull error in a clearer way. After this patch, TIntermAggregate is still used for function definitions, function prototypes, function parameter lists, function calls, variable and invariant declarations and the comma (sequence) operator. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: I04044affff979a11577bc1fe75d747e538b799c8 Reviewed-on: https://chromium-review.googlesource.com/393726 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
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>