src/tests/compiler_tests/ShaderValidation_test.cpp


Log

Author Commit Date CI Message
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 37d96cce 2017-07-11T14:14:03 Fix accepting arrays as array indices Previously, arrays were being incorrectly accepted as array indices. This was because the isScalar() check only checked that the type was not a vector or matrix, but still returned true for scalar arrays. This patch changes the isScalar() check so that it returns false for arrays. This makes usage of the term "scalar" more consistent in the shader translator. Most of the code using isScalar() was compatible with this change. Code in util.cpp that used to assume that isScalar() doesn't care about arrayness is refactored to work with the new behavior. BUG=angleproject:2102 TEST=angle_unittests Change-Id: I2a7f4c30fca7917d1099d0400efe3de859338b2a
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 d7cd4ae5 2017-07-06T15:52:49 Check that function declarations don't use a reserved name Reserved function names are now caught if the function is just declared without being called in the shader source. Actually, function calls don't need to be checked for reserved names, since that just generates a redundant error message if function declarations are being checked. Includes some cleanup of ParseContext::checkIsNotReserved. It doesn't need special handling of built-in symbols, as they are never passed to the function. BUG=chromium:739448 TEST=angle_unittests Change-Id: I7115e1a7509626b5109b5c054c0704b0c3c19c58 Reviewed-on: https://chromium-review.googlesource.com/561457 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Shao 77891c0a 2017-06-23T16:30:17 Fix wrong assignment of maxUniformVectors in GLSL compiler This patch intends to fix a bug in ANGLE GLSL compiler. In TCompiler::Init(resources), we should initialize maxUniformVectors by resource.maxComputeUniformComponents / 4 when we attempt to initialize a compiler for compute shader instead of resource.maxFragmentUniformVectors. BUG=angleproject:2083 Change-Id: I4901f71ef5ac4f5770e2d5f8ee21786fcf19fbca Reviewed-on: https://chromium-review.googlesource.com/545190 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 487b63ab 2017-05-23T15:55:09 Disallow structs as scalar/vector constructor arguments The spec isn't very explicit about disallowing this, but conversions from structs are not among the conversion constructors or specified in any other way either. BUG=angleproject:2036 TEST=angle_unittests Change-Id: I23f2ceda1d1348cec0d3bba38a7a013275ff84eb Reviewed-on: https://chromium-review.googlesource.com/514002 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 9405005f 2017-05-08T14:17:44 Disallow interface blocks in arithmetic expressions Interface blocks were mistakenly being allowed in some types of unary, binary and ternary expressions, when they should not have been. BUG=angleproject:2030 TEST=angle_unittests Change-Id: Ie75833ee208e1b7fef8f77fa91b90da278bc6498 Reviewed-on: https://chromium-review.googlesource.com/500269 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
jchen10 b4cf5656 2017-05-05T18:51:17 Validate opaque operands against binary operators Add checks that opaque operands can only be used with array indexing and field section, as mentioned in ESSL 3.10 section 4.1.7. BUG=angleproject:2028 Change-Id: I41b7f10785bf712dfc999f85ebff925341c51911 Reviewed-on: https://chromium-review.googlesource.com/497767 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
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>
Olli Etuaho 193c0950 2017-05-02T15:51:47 Fix assert when attempting to create a void array node TIntermTyped::CreateZero can be reached with a void array type in an error case. Handle this gracefully instead of asserting. Also remove an assert that wasn't really checking anything in CreateZero. type.isScalar() || type.isVector() || type.isMatrix() can only be false in case of a struct, and struct type was being checked in the condition on the line above. BUG=chromium:717385 TEST=angle_unittests Change-Id: Iff0811d18d399d7b32b2b46deea5df172412eb8c Reviewed-on: https://chromium-review.googlesource.com/492887 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 485eefdd 2017-02-14T17:40:06 Fix checking image memory access Checks for image memory access used to assume that image nodes are symbol nodes, but they can also be array indexing nodes. In invalid shaders struct indexing nodes of an image type may also appear after error recovery. TEST=angle_unittests, dEQP-GLES31.functional.layout_binding.* BUG=angleproject:1442 Change-Id: Ib45728d38485cb78c594e080f3decec1233a0046 Reviewed-on: https://chromium-review.googlesource.com/442764 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 34bf2d93 2017-02-06T13:40:59 translator: Fix ASSERT in array init corner case. This ASSERT was benign and can be turned into an error check. The pattern in question is to initialize an array with another array as the first argument, but dereferencing the array with "." instead of "[]". This would trip up our error handling. BUG=chromium:662702 Change-Id: Ie0e44af7b9d1a66cad03cefae9bf931f8e216cd9 Reviewed-on: https://chromium-review.googlesource.com/437599 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 17a5c062 2017-01-22T15:20:53 IntermTyped::CreateZero: handle non-basictypes CreateZero is called in ParseContext so it should handle types which don't necessarily make sense to call it with. BUG=chromium:680961 Change-Id: I8627850e49eb9a4f4ecde61ca2d68371ea6a8dd6 Reviewed-on: https://chromium-review.googlesource.com/431001 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 78d13744 2017-01-18T13:06:10 Validate main() prototype declarations with incorrect parameters Instead of just validating definitions of main(), do the validation for all function headers for functions named "main", including headers in prototype declarations. BUG=angleproject:1712 TEST=angle_unittests Change-Id: Ia34a2a756e1cc27b241b27e8c01c6ef09bffba71 Reviewed-on: https://chromium-review.googlesource.com/430010 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7e735e48 2017-01-12T15:42:01 Change remaining compile-time folding errors to warnings The GLES working group has decided to amend the spec so that implementations are not allowed to generate compile errors on undefined values detected at compile time. Change the remaining folding errors to warnings to follow the newly clarified rules. The end2end_tests covering this are removed, since they're redundant with the more efficient unit test. BUG=angleproject:1703 TEST=angle_unittests Change-Id: I97d2fd532dbe5733581bdc4aa40a5d7d3734fc0d Reviewed-on: https://chromium-review.googlesource.com/427799 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
JiangYizhou 4021932f 2016-12-09T09:50:51 translator: Add ES3.1 multisample texture support. Implement shader objects, [iu]sampler2DMS, textureSize(gsampler2DMS). as well as texelFetch(gsampler2DMS,P,sample) for the glsl. BUG=angleproject:1590 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I781023f7bec34ad0264af69f34bb182b50bd1fbd Reviewed-on: https://chromium-review.googlesource.com/423175 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev d7c5b0aa 2016-07-27T14:04:43 Add support for barriers in the compiler The patch adds support for barriers in vertex, fragment and compute shaders. BUG:angleproject:1442 TEST:angle_unittests Change-Id: Ic85c3337911851a93a3f56bd935774181600eddd Reviewed-on: https://chromium-review.googlesource.com/380641 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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 842f23f8 2016-12-19T22:37:36 Rename MalformedShaderTest to ShaderValidationTest Lots of these tests aren't actually testing malformed shaders, so the name was misleading. ShaderValidationTest reflects the content of the tests better. Some test classes that needlessly used different API spec versions are also merged. BUG=angleproject:1673 TEST=angle_unittests Change-Id: Ib842af153a09d3887f9bb857709fd0cd29bcc9c4 Reviewed-on: https://chromium-review.googlesource.com/422368 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>