src/compiler


Log

Author Commit Date CI Message
Olli Etuaho 792a41d1 2015-12-15T12:39:16 Fix missing newline from "Missing main()" error message Change-Id: Id28e20097fc2c66117c688425c73df731afecbe3 Reviewed-on: https://chromium-review.googlesource.com/318431 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 91dec84c 2015-12-08T15:18:08 Extend the CallDAG info log to report undefined functions BUG=angleproject:784 Change-Id: If5073a91bc4f47ade27c242d6966306600029f33 Reviewed-on: https://chromium-review.googlesource.com/316870 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez e678b66c 2015-12-07T15:54:17 TDependencyGraph: use range-base for loops instead of iterators No functional changes intended. BUG=angleproject:591 Change-Id: Ieccf0b792766be86a3533e5324ce6f83ee508ad5 Reviewed-on: https://chromium-review.googlesource.com/316601 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 0469479f 2015-12-07T15:52:05 Compiler: remove dead code in limitExpressionComplexity TGraphTraverser is a class that does nothing by itself so the for loop was a noop statement and has been for at least two years (since 17732823f9c2, didn't check earlier). BUG=angleproject:591 Change-Id: I1919059fcb8987c2f043a71fed6223e16bc014d8 Reviewed-on: https://chromium-review.googlesource.com/316600 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 700ad289 2015-12-07T15:57:47 Don't crash when calling ShConstructCompiler with a wrong output BUG=angleproject:446 Change-Id: Ic1c326f79105950e5c3eb8724eba12fca187a2ec Reviewed-on: https://chromium-review.googlesource.com/316610 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Austin Kinross 0998fe96 2015-12-11T11:31:38 Fix Clang 3.7 build issue in VS 2015 Update 1 VS 2015 Update 1 adds support for 'Clang 3.7 with Microsoft CodeGen'. This fixes these errors when using Clang 3.7 in VS2015: compiler\translator\ASTMetadataHLSL.cpp(69,10): error : 'visitLoop' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] compiler\translator\ASTMetadataHLSL.cpp(75,10): error : 'visitSelection' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] compiler\translator\ASTMetadataHLSL.cpp(336,10): error : 'visitLoop' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] Change-Id: Ia9c3029eb2966132827596b55ad9afce34b6f19c Reviewed-on: https://chromium-review.googlesource.com/317732 Tryjob-Request: Austin Kinross <aukinros@microsoft.com> Tested-by: Austin Kinross <aukinros@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 8e89866d 2015-12-11T12:24:21 Remove redundant index integer check from ValidateLimitations Non-integer indices are already rejected in the parser, so the ValidateLimitations pass doesn't need to check for them. ESSL 1.00 spec is not actually terribly clear about whether the parser should do this check, but the language grammar in the spec only has indexing with "integer_expression" so it seems like ANGLE's interpretation of only allowing indexing with integers is correct. ESSL 3.00 makes this restriction explicitly clear in section 5.7. BUG=angleproject:1254 TEST=angle_unittests Change-Id: I02b2a6f4d9fa7801a98df63ed21bc990e1585eb8 Reviewed-on: https://chromium-review.googlesource.com/317741 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 8a76dcc7 2015-12-10T20:25:12 Don't try to apply ForLoopUnroll to loops it can't handle ForLoopUnroll should only mark loops that fit the limitations in ESSL 1.00 Appendix A. BUG=angleproject:1253 TEST=angle_unittests, WebGL conformance tests Change-Id: I00b0a7d29cd42efea9611d020aa1f873ac04773f Reviewed-on: https://chromium-review.googlesource.com/317551 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho d561057f 2015-12-10T19:42:09 Fix ValidateLimitations for folded non-constant expressions ANGLE recently gained the ability to constant fold some expressions that are not constant expressions. ValidateLimitations should continue to recognize all cases where an expression is not a constant expression. BUG=angleproject:851 TEST=angle_unittests Change-Id: I8ad0552a59213cdd6af9a220ffd672be9752271d Reviewed-on: https://chromium-review.googlesource.com/317281 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 6c9b2ae9 2015-12-08T13:43:11 Revert "D3D11: Use clamp wrap mode for Integer textures." dEQP-GLES3 texture failures: http://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20dEQP%20%28NVIDIA%29/builds/4510/steps/angle_deqp_gles3_tests/logs/stdio dEQP-GLES3.functional.shaders.texture_functions.texture.isampler* dEQP-GLES3.functional.shaders.texture_functions.texture.usampler* BUG=angleproject:1244 This reverts commit 7a6a1ffeb275a8b565701305c8b42857ff2bf0b0. Change-Id: I0e25e7aed0e0d78015d5b8f5a7b9a81e0a5fca4e Reviewed-on: https://chromium-review.googlesource.com/316641 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8c46ab11 2015-12-07T16:39:19 OutputHLSL: Avoid using info sink stack as much as possible. Due to how the traversers work, it might not be trivial to avoid the info sink stack entirely, but minimize its use to keep the code as functional as possible. BUG=angleproject:958 Change-Id: I354313f10f496feea7c6a6f167b0617aeadbe5b0 Reviewed-on: https://chromium-review.googlesource.com/316412 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7a6a1ffe 2015-12-07T16:32:58 D3D11: Use clamp wrap mode for Integer textures. Until we can support all wrap modes for int textures, use a correct clamping scheme. This fixes several dEQP GLES3 FBO tests. This shuffles some of the tests in functional.texture.units since it hard-codes a different behaviour for all wrap modes, ignoring the sampler setting. BUG=angleproject:1244 TEST=dEQP-GLES3.functional.texture.* Change-Id: Ic7e89a111728dfb18821534996bf5b9a5ad172b6 Reviewed-on: https://chromium-review.googlesource.com/313997 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill adf825b3 2015-12-07T09:20:05 Move TType::getCompleteString to Types.cpp. Probably left over from previous refactoring. BUG=angleproject:1247 Change-Id: Ieb4b60ae9f724248f92ae77d23e4bdd8c5d9265a Reviewed-on: https://chromium-review.googlesource.com/316400 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8d9f35f1 2015-11-24T16:10:20 Re-land "D3D11: Fix Integer Texture Cube mip mapping." We were missing both the correct SRV parameter, as well as the full computation of the mip level in the HLSL. Re-land makes the mip computation only happen with implicit sampling. Before it would confuse the LOD0 computation. BUG=angleproject:1208 TEST=dEQP-GLES3.functional.texture.* Change-Id: I4b579033afe5cd1aca1f2d017e48a74c7fc324cc Reviewed-on: https://chromium-review.googlesource.com/314330 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 183d7e24 2015-11-20T15:59:09 Remove predefined precision qualifiers from ESSL3 samplers New sampler types in ESSL3 should not have default precision qualifiers. This is specified in ESSL 3.00.4 section 4.5.4. BUG=angleproject:1222 TEST=angle_unittests Change-Id: I9c8e7a5fbb4278db80de79bcaeebaf23e64242a0 Reviewed-on: https://chromium-review.googlesource.com/312048 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>
Jamie Madill ee322723 2015-11-24T20:42:48 Revert "D3D11: Fix Integer Texture Cube mip mapping." 2 tests failed: dEQP_GLES3.Default/functional_shaders_texture_functions_texture_isamplercube_vertex (c:\b\build\slave\gpu_win_builder\build\src\third_party\angle\src\tests\deqp_support\angle_deqp_gtest.cpp:234) dEQP_GLES3.Default/functional_shaders_texture_functions_texture_usamplercube_vertex (c:\b\build\slave\gpu_win_builder\build\src\third_party\angle\src\tests\deqp_support\angle_deqp_gtest.cpp:234) BUG=angleproject:1208 This reverts commit 5778557fe99e300f245a7bfc2200f6b0179e3fbf. Change-Id: I6f7441bdbfbf937680b0d572645edee8ece649a1 Reviewed-on: https://chromium-review.googlesource.com/314301 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5778557f 2015-11-23T09:37:44 D3D11: Fix Integer Texture Cube mip mapping. We were missing both the correct SRV parameter, as well as the full computation of the mip level in the HLSL. BUG=angleproject:1208 Change-Id: I345b1e0895495654de3863c4ebcc395d9b7371b9 Reviewed-on: https://chromium-review.googlesource.com/312060 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 0980e29d 2015-11-20T14:57:34 Don't accept default precision for uint Default precision can only be specified for float, int and sampler types. Default precision for int also applies to uint and uvec declarations. BUG=angleproject:1221 TEST=angle_unittests Change-Id: I31fdcde80da16e2ea8771838f7c1a6ab4e478194 Reviewed-on: https://chromium-review.googlesource.com/313314 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 e8e4debc 2015-11-18T17:15:38 Fix invalid generated sampling functions in HLSL output In some generated shaders, "levels" would be read before it is assigned by GetDimensions when clamping mip level to valid range. Fix these cases. BUG=angleproject:1092 TEST=dEQP-GLES3.functional.shaders.texture_functions.* (12 tests start passing) Change-Id: I9fce8d378606738e5172673d222bce7968e26789 Reviewed-on: https://chromium-review.googlesource.com/312022 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3e960463 2015-11-12T15:58:39 Detect when gl_FragData is indexed with != 0 in WebGL 2.0 WebGL 2.0 explicitly specifies it to be an error when gl_FragData is indexed with anything else than constant zero in spec section 'GLSL ES 1.00 Fragment Shader Output'. This doesn't apply to WebGL 1.0 or GLES. dEQP-GLES2.functional.shaders.fragdata* test that dynamic indexing of gl_FragData is allowed. TEST=angle_unittests BUG=angleproject:1210 Change-Id: Ib401242e7867f5e7943456b059dd8e24dc404098 Reviewed-on: https://chromium-review.googlesource.com/312045 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho bd163f6a 2015-11-13T12:15:38 Fix parsing structure definitions in place of constructors The shader parser used to accept structure definitions in place of constructors, which is invalid GLSL. This patch fixes that. BUG=angleproject:939 TEST=angle_unittests Change-Id: Ibcf502160e91c19e693e9427b548a399d83e2a71 Reviewed-on: https://chromium-review.googlesource.com/312032 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 40d9edf1 2015-11-12T17:30:34 Fix structure comparison constant folding objectSize() will return the size of all data in the structure, and simply iterating over the data will work for determining whether two structures are equal. The earlier complex and broken approach where the structure was traversed recursively is not needed. BUG=angleproject:1211 TEST=angle_unittests Change-Id: I0e5c5ccbb767d44ef6acb0f1f25f27dfc42866e1 Reviewed-on: https://chromium-review.googlesource.com/312490 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 5c0e023c 2015-11-11T15:55:59 Qualify stored constant union data with const This prevents accidentally changing data that may be shared between multiple TIntermConstantUnion nodes. Besides making the code less prone to bugs in general, this will make it easier to implement constant folding of array constructors. BUG=541551 TEST=angle_unittests, WebGL conformance tests Change-Id: I4f3059f70b841d9dd0cf20fea4d37684da9cd47e Reviewed-on: https://chromium-review.googlesource.com/312440 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 36b0514a 2015-11-12T13:10:42 Fix ESSL3 indexing corner cases Indexing interface blocks or fragment outputs with a non-constant expression is not valid even if ANGLE has been able to constant fold the expression. BUG=angleproject:1210 TEST=angle_unittests Change-Id: I2ccb67871b682976a31b8de306053b9b28c06437 Reviewed-on: https://chromium-review.googlesource.com/312044 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 6218c80b 2015-11-09T11:14:47 Revert "Revert "renderergl_utils: Require explicit location qualifier for OpenGLES3"" This reverts commit 45a7d64fd84a7cb292ff71890a61f8d2b7609aa4. Change-Id: I7f94609fc7cf14220d98c61e73a13311d3cc4ecd Reviewed-on: https://chromium-review.googlesource.com/311245 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 3fed4306 2015-11-02T12:26:02 Unfold short-circuiting operators in loop conditions correctly Sometimes short-circuiting operators need to be unfolded to if statements. If the unfolded operator is inside a loop condition or expression, it needs to be evaluated repeatedly inside the loop. Add logic to UnfoldShortCircuitToIf that can move or copy the unfolded part of loop conditions or expressions to inside the loop. The exact changes that need to be done depend on the type of the loop. For loops may require also moving the initializer to outside the loop. The unfolded expression inside a loop condition or expression is moved or copied to inside the loop on the first traversal of the loop node, and unfolding to if is deferred until a second traversal. This keeps the code relatively simple. BUG=angleproject:1167 TEST=WebGL 2 conformance tests, dEQP-GLES2.functional.shaders.*select_iteration_count* Change-Id: Ieffc0ea858186054378d387dca9aa64a5fa95137 Reviewed-on: https://chromium-review.googlesource.com/310230 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Zhenyao Mo <zmo@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 18b9deb4 2015-11-05T12:14:50 Support writing initializers using HLSL literal syntax Instead of using constructor functions to initialize variables, it is better to use literal initializer syntax provided by HLSL when it is possible. This way shader complexity is reduced and constant array initialization doesn't have to go through as many AST transformations. Before this patch, vec4 initialization would result in the following kind of HLSL: float4 f = float4(1.0, 2.0, 3.0, 4.0); After this patch, it will be: float4 f = {1.0, 2.0, 3.0, 4.0}; Before this patch, vec2 array initialization would result in the following kind of HLSL: float2 f[2] = {0, 0, 0, 0}; angle_construct_into_2_float2(f, float2(1.0, 2.0), float2(3.0, 4.0)); After this patch, it will be: float2 f[2] = {1.0, 2.0, 3.0, 4.0}; BUG=angleproject:1094 BUG=541551 TEST=WebGL conformance tests Change-Id: I9816a8d95a2cba3964922f6b561862d478da6145 Reviewed-on: https://chromium-review.googlesource.com/311160 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 0e39f492 2015-11-09T13:16:41 Revert "Revert "Revert "renderergl_utils: Require explicit location qualifier for OpenGLES3""" This reverts commit 24db86441d148eb6a497b70c015296422ab48470.
Corentin Wallez 24db8644 2015-11-09T11:14:47 Revert "Revert "renderergl_utils: Require explicit location qualifier for OpenGLES3"" This reverts commit 45a7d64fd84a7cb292ff71890a61f8d2b7609aa4. Change-Id: I2a8212c7507a7566baca200ed938d9e00f7103c2
Jeff Muizelaar dbfdca8f 2015-11-06T12:46:30 Hash interface block names and field names. BUG=544853 Change-Id: I4ca77ed87c15a168c696c15f2438ad21c00985f6 Reviewed-on: https://chromium-review.googlesource.com/310271 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 45a7d64f 2015-11-06T16:19:21 Revert "renderergl_utils: Require explicit location qualifier for OpenGLES3" Causes angle_end2end_tests failures on Mac This reverts commit d63243f5be2ac7d8dafa6aea5b23e036074af397. Change-Id: Idf25d7fe9f4162813a4fc67927191747f660fceb Reviewed-on: https://chromium-review.googlesource.com/311041 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez d63243f5 2015-10-29T14:23:37 renderergl_utils: Require explicit location qualifier for OpenGLES3 BUG=525930 Change-Id: I591308078c5a392a527291419567a11241a8be17 Reviewed-on: https://chromium-review.googlesource.com/309636 Tested-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 91dbc188 2015-06-17T16:19:29 Enable needed extensions in generated GLSL shaders and call them when possible. reland: use the defined preprocessor function. BUG=angleproject:1044 Change-Id: I6171708a2d55ec085ba2c598a1a863779842da6c Reviewed-on: https://chromium-review.googlesource.com/311270 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 15200047 2015-11-04T16:56:31 Fix issues in comma operator parsing Always qualify comma operator result with EvqTemporary in ESSL3, as specified. Also, it is possible that in the future some expressions are qualified as EvqConst but they'd still have side effects, in which case discarding them when they're the left operand of the comma operator would be wrong. This would be the case if ANGLE allowed "(a = b).length()" for example. For this reason it is better to check whether the left node has side effects, rather than check its const qualification, and only discard it if it doesn't. Also, Intermediate::addComma() never returns null, so there's no need to check the result. BUG=angleproject:1201 TEST=WebGL conformance tests conformance/glsl/misc/sequence-operator-returns-constant.html conformance2/glsl3/sequence-operator-returns-non-constant.html Change-Id: Ibfbd92baa4910b14c0dc8f8a3c3008440d191cd6 Reviewed-on: https://chromium-review.googlesource.com/311171 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
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 cdeafd20 2015-11-05T14:59:18 Fix missing init when parsing storage qualifier fails When parsing a storage qualifier results in an error, the parser should not leave the type uninitialized. Otherwise after recovering from the error the parsed value could contain uninitialized memory, which could cause flaky asserts in further parsing. TEST=dEQP-GLES2.functional.shaders.functions.* BUG=angleproject:1200 Change-Id: Ia3add76df243898e35fee97d01555b953cff8379 Reviewed-on: https://chromium-review.googlesource.com/311140 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang e7fcf1e3 2015-11-05T21:23:53 Revert "Enable needed extensions in generated GLSL shaders and call them when possible." This reverts commit 233b334213c1a4853e81f71ba90aa223b2a68dce. Change-Id: Id99024b736324ad030ce63c5d0baae32b6d7f54b Reviewed-on: https://chromium-review.googlesource.com/311181 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 233b3342 2015-06-17T16:19:29 Enable needed extensions in generated GLSL shaders and call them when possible. BUG=angleproject:1044 Change-Id: Ife94d2258fb912974aa97484a0e30f289dd96734 Reviewed-on: https://chromium-review.googlesource.com/278324 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho b1edc4f5 2015-11-02T17:20:03 Accept const array initialization in shader parsing Array constructors are not folded, unlike all other constant expressions. Change initializer parsing path so that it accepts constant initializers whether they are folded or not. Some parts need to be adapted to work with expressions that are qualified as constant but that are not necessarily folded: 1. Identifier parsing 2. Indexing parsing 3. Field selection parsing 4. HLSL output for variable declarations 5. Determining unary operator result type 6. Determining binary operator result type 7. Determining built-in function call result type 8. Determining ternary operator result type Corner cases that are not supported yet: 1. Using array constructors inside case labels 2. Using array constructors inside array size expressions 3. Detecting when a negative constant expression containing an array constructor is used to index an array In these cases being able to constant fold the expression is essential to validating that the code is correct, so they require a more sophisticated solution. For now we keep the old code that rejects the shader if ANGLE hasn't been able to constant fold the case label or array size. In case of indexing an array with a negative constant expression containing an array constructor, ANGLE will simply treat it as a non-constant expression. BUG=541551 BUG=angleproject:1094 TEST=dEQP-GLES3.functional.shaders.constant_expressions.* (all pass), angle_unittests Change-Id: I0cbc47afd1651a4dece3d68acf7ec72a01fdf047 Reviewed-on: https://chromium-review.googlesource.com/310231 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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 5d91dda9 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-re-relanding after clang warning fix. Re-re-landing with fix to setting qualifiers on generated nodes. The previous version failed when a uniform was indexed, because it would set the uniform qualifier on some of the generated nodes and that interfered with the operation of UniformsHLSL. Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I9f6d7c7ecda8ac4dc3c30b39e15a9a0b5381c5a8 Reviewed-on: https://chromium-review.googlesource.com/310010 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill a5f64de7 2015-10-30T12:31:00 Revert "Remove dynamic indexing of matrices and vectors in HLSL" Failing build on Clang-win: ..\..\third_party\angle\src\compiler\translator\RemoveDynamicIndexing.cpp(128,43) : error: expected '(' for function-style cast or type construction fieldType.setPrimarySize(unsigned char(indexedType.getRows())); ~~~~~~~~ ^ BUG=angleproject:1116 This reverts commit 7535b761dd4740c8e76b888d7c58c7cbeefd2083. Change-Id: I7b502e3dcd45e17b7ed88fec18be702614d9ac65 Reviewed-on: https://chromium-review.googlesource.com/309772 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho f541f529 2015-10-13T12:21:01 Fix parsing integers larger than 0x7FFFFFFF Parsing should accept all values between 0 and 0xFFFFFFFF as specified in ESSL 3.00 section 4.1.3. When a signed literal is parsed, it's interpreted as if it specifies the bit pattern of a two's complement integer. For example, parsing "0xFFFFFFFF" results in -1. Decimal literals behave the same way, so for example parsing "3000000000" results in -1294967296. This change affects parsing of literals in ESSL 1.00 as well. In ESSL 3.00, an out-of-range integer literal now generates a compiler error. Unit tests are added based on examples in the ESSL 3.00 spec and one example in GLSL 4.5 spec that ESSL should match. BUG=541550 TEST=angle_unittests Change-Id: I82f8ef5cfa2881019a3f80d77ff99707d61c000d Reviewed-on: https://chromium-review.googlesource.com/305420 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@google.com>
Olli Etuaho ae69d7e1 2015-10-07T17:19:50 Output layout qualifiers in GLSL output Output layout qualifiers for vertex shader attributes and fragment shader outputs. This applies both to ESSL output and GLSL output. If the source shader is in ESSL1, the code has no effect since there's no layout information in the AST. BUG=525930 TEST=angle_unittests, angle_end2end_tests Change-Id: I48b3aa56116c15d11599b030eed4c45be2c8fc7e Reviewed-on: https://chromium-review.googlesource.com/304550 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 7535b761 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-re-landing with fix to setting qualifiers on generated nodes. The previous version failed when a uniform was indexed, because it would set the uniform qualifier on some of the generated nodes and that interfered with the operation of UniformsHLSL. Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I16119f9092360fb72798f9550a6f4d3cfffdc92f Reviewed-on: https://chromium-review.googlesource.com/308790 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill b066669d 2015-10-26T10:38:18 Revert "Remove dynamic indexing of matrices and vectors in HLSL" This reverts commit 3766a40d6fda7e7190514ab7838a3f37169d863f. This CL was causing crashes in UniformHLSL.cpp, where an internal uniform "base" was attempted to be declared in HLSL. Was crashing on an external WebGL 3D canvas page (http://www.taccgl.org/?dbg=t). BUG=546686 Original commit message: Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I1d4b2e3888e91af7d5eebf743d12778698b6b903 Reviewed-on: https://chromium-review.googlesource.com/308770 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@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 2f6ddf31 2015-09-22T16:10:07 Allow double underscore in macro names Double underscore is allowed according to GLSL ES 3.10, and based on Khronos discussions the intent is that this should also apply to older specs. The dEQP tests also check this, and WebGL tests that check the opposite were recently removed. The error is changed into a warning. BUG=angleproject:989 TEST=angle_unittests dEQP-GLES3.functional.shaders.preprocessor.* (2 tests start passing) dEQP-GLES2.functional.shaders.preprocessor.* (2 tests start passing) Change-Id: I582c01b4adc8fc416354351e02b776f2cc602408 Reviewed-on: https://chromium-review.googlesource.com/300965 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho b3fbd867 2015-09-30T17:55:02 Fix setting const qualifier on indexing expression Resubmitting now that separate fix for updating mangled names of types has been merged. A unit test is added to make sure that the same regression doesn't happen again. Previously, constness of indexing expressions did not take the index expression into account. Now constness correctly takes into account both the base expression and the index expression. Setting the type of expressions that index arrays is also simplified. BUG=angleproject:1170 TEST=angle_unittests Change-Id: Ie9b6aaee8185b945c03657b13d9513cc55cd2a9f Reviewed-on: https://chromium-review.googlesource.com/303601 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho b12531c9 2015-10-05T14:40:40 Invalidate mangled name of TType if the type is changed Sometimes, the mangled name of a type is already generated when the type is still being changed. For example, this could happen when the type of A[i] is generated by copying the type of A (already mangled) and calling clearArrayness() on the copy. Make sure that the mangled name gets updated if the type is changed by clearing the mangled name when something affecting it is changed. BUG=angleproject:1170 BUG=538692 TEST=angle_unittests Change-Id: I9dfacea653f56536e1573a6dbf60ff21da7cc5ab Reviewed-on: https://chromium-review.googlesource.com/303846 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Christopher Cameron 7e921616 2015-10-01T14:00:04 Add texture2DRect -> texture conversion for OpenGL core profile BUG=534114 Change-Id: If0e1557a2399436b1b160407ced2d265f42df5f0 Reviewed-on: https://chromium-review.googlesource.com/303761 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: ccameron chromium <ccameron@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 5f579b1b 2015-08-14T17:44:43 Improve handling of internal function calls Many parts of the shader translator that deal with function calls have been written without internal function calls in mind. Fix some of these so that they can handle internal function calls. -Fix TLValueTrackingTraverser handling a shader where there are an internal and non-internal function of the same name. -Maintain internalness when shallow copying function calls in SeparateExpressionReturningArrays and ArrayReturnValueToOutParameter AST transformations. -Output function internalness in intermOut. BUG=angleproject:1116 TEST=angle_unittests Change-Id: Ic65e2803062b807651f1b3952409face6aceb780 Reviewed-on: https://chromium-review.googlesource.com/303353 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill e623bd46 2015-10-02T19:14:15 Revert "Fix setting const qualifier on indexing expression" Failing to compile shaders which are used in some layout_tests, see http://crbug.com/538692 for logs and bad shaders. We should diagnose if the shaders are faulty or if there's a bug in this CL and take appropriate action, but first priority is to get the tests running again. BUG=538692 BUG=angleproject:1170 This reverts commit 16a79cd169420cdf0254964b1bac9dd9964a8119. Change-Id: Iea14c58d87041bcf5ba645b7076ba0936dea6b9d Reviewed-on: https://chromium-review.googlesource.com/303794 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 16a79cd1 2015-09-30T17:55:02 Fix setting const qualifier on indexing expression Previously, constness of indexing expressions did not take the index expression into account. Now constness correctly takes into account both the base expression and the index expression. Setting the type of expressions that index arrays is also simplified. BUG=angleproject:1170 TEST=angle_unittests Change-Id: Ie2d122020cc252655ab0eea96886b9f85931b80a Reviewed-on: https://chromium-review.googlesource.com/303350 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Corentin Wallez d4b5054d 2015-09-28T12:19:26 compiler: Rewrite do-while loops as while loops This works around a Mac driver shader compiler bug that makes many do-while loops cause GPU-hangs when ran. BUG=angleproject:891 Change-Id: I29828d6ea9e887ad0ed0c577f1deb41fb632a900 Reviewed-on: https://chromium-review.googlesource.com/302465 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Kimmo Kinnunen 5f0246ca 2015-07-22T10:30:35 Implement gl_FragDepth for GLES SL 3.0 Makes it an error to access gl_FragDepthEXT in #version 300 es shader. TODO: Lacks the feature to make "#extension GL_EXT_frag_depth : require" an error for #version 300 es. Reland of: https://chromium-review.googlesource.com/#/c/287570 BUG=angleproject:1102 TEST=angle_unittest Change-Id: I064d918d65f37539cb1e14f12173ca5591a4ea3f Reviewed-on: https://chromium-review.googlesource.com/301711 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Corentin Wallez 7258e30c 2015-09-22T10:40:24 TOutputGLSLBase::visitLoop clarify the function slightly Since only for loops can be unrolled, handle each type of loop only once. This improvement was going to be part of a do-while workaround for Mac that will instead be done at the AST level. BUG=angleproject:891 Change-Id: Ic8ecf41aa6d9abd7a01c2230e908c85152f52b62 Reviewed-on: https://chromium-review.googlesource.com/302332 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 2d58f7a2 2015-09-28T10:44:55 RewriteElseBlocks.cpp: add missing override Change-Id: Ic98de554cabffabd3cdd58b2a44a554cb2c3cd53 Reviewed-on: https://chromium-review.googlesource.com/302464 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
hendrikw 75782629 2015-09-25T11:28:50 Fix possible compiler errors on linux Change-Id: Ifc45446c749690eddc406f66f144304262f04664 Reviewed-on: https://chromium-review.googlesource.com/302478 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 247374cb 2015-09-09T15:07:24 Allow limited form of expressions in #line directives Reuse ExpressionParser that's also used for parsing preprocessor conditionals to parse line and file numbers in #line directives. According to recent Khronos discussions, the intent of the spec is that expressions in #line directives should be interpreted similarly to expressions in conditional directives, so reusing ExpressionParser is a natural way to implement this. This enables simple math operators operating on integers. There are a few unclear corner cases, but this approach is enough to support practical use cases and pass the dEQP tests. Valid line directives have one of the following forms: #line line-expression #line line-expression file-expression ExpressionParser is first run to parse the line-expression. In ambiguous cases the ExpressionParser consumes as much of the line as possible to form line-expression. Then, if end-of-line hasn't been reached, file-expression is parsed by running ExpressionParser again. As an example of an ambiguous case: #line 1 + 2 This could alternatively be interpreted to mean line-expression "1" and file-expression "+ 2" where + is the unary + operator, but ANGLE now interprets it to mean line-expression "1 + 2". Because of these ambiguous cases, a bison grammar that would parse multiple expressions on the same line couldn't be easily constructed, so this solution where ExpressionParser is run twice was chosen instead. The problematic corner cases are: - ExpressionParser uses 64-bit integers internally for evaluating the expression's value. It's possible to interpret the ESSL3 spec so that 32-bit integer wraparound behavior would be required also for #line directive expressions. - It's unclear whether the defined operator can be used in #line expressions. In this patch it is disabled. Hoping for further clarification from Khronos. - It's unclear how short-circuiting should affect the parsing of undefined identifiers in #line expressions. Now it's consistent with #if expressions (undefined identifiers are OK if they're short-circuited). dEQP expectations are updated for preprocessor tests, including ones not affected specifically by this change. BUG=angleproject:989 TEST=angle_unittests, dEQP-GLES3.functional.shaders.preprocessor.* (4 start passing), dEQP-GLES2.functional.shaders.preprocessor.* (4 start passing) Change-Id: I55c5bf75857da5de855cc600d3603ee19399f328 Reviewed-on: https://chromium-review.googlesource.com/300964 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3187a38e 2015-09-09T12:00:12 Make preprocessor ExpressionParser only lex what it can parse This cleans up ExpressionParser so that the lexer only consumes one extra token in case the parser finishes. The parser will also finish with YYACCEPT once it has parsed a complete expression. This will make the preprocessor to generate a more informative unexpected token error instead of a syntax error if there are extra tokens after #if. This will also enable reusing ExpressionParser for parsing expressions in line directives. The format for a line directive that specifies both line and file numbers is as follows: #if line-expression file_expression ExpressionParser will need to be run twice for each line: first to parse line-expression and then to parse file-expression. For that reason, it is essential that ExpressionParser for line-expression stops before consuming more than one token of file-expression. BUG=angleproject:989 TEST=angle_unittests, dEQP-GLES3.functional.shaders.preprocessor.* Change-Id: I0bb92f733c18891eeddbc61e7c5bebdf1003559a Reviewed-on: https://chromium-review.googlesource.com/300962 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 261f5379 2015-09-18T10:34:31 Support parsing defined operator generated by macro expansion dEQP tests enforce that the defined operator should be parsed even when it is generated as a result of macro expansion, even though this is undefined according to the C++ preprocessor spec. Implement support for this by putting the parsing for the defined operator inside MacroExpander. The operator gets processed right after it is generated by macro expansion. Parsing the defined operator is toggled with a boolean according to the context where MacroExpander is used. BUG=angleproject:989 TEST=angle_unittests, dEQP-GLES3.functional.shaders.preprocessor.* - 2 tests start passing: dEQP-GLES3.functional.shaders.preprocessor.conditional_inclusion.basic_2* Change-Id: I780e63bd4558253657d898685d62339017564a06 Reviewed-on: https://chromium-review.googlesource.com/300970 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 62d31cb6 2015-09-11T13:25:51 Re^6-land "Move Uniform and UBO info to the gl::Program layer." This data was previously stored entirely in the Impl level. Move as much as possible to the GL level, using a read-only view in the Impl level. Some information in D3D-specific, and should be stored separately in the Impl. This patch has a lot of refactoring that splits the D3D and GL info, and moves as much validation as possible to the GL layer, where it is shared between the back-ends. Re-land with fix for dEQP unused uniforms. The fix involves storing a local copy of all uniform data in the GL layer. This will also let us validate sampler indexes during draw calls at the GL layer. Re-re-land with a fix for multiply defined symbols on Clang. Re-re-re-land with a fix for boolean uniforms and Uniform{1234}f. Re^4-land with a fix for boolean uniform arrays and UBO uniforms. Re^5-land with a fix for a test warning on Linux. Re^6-land with a fix for transposed matrix uniform arrays. BUG=angleproject:1123 TEST=end2end_tests, bots, dEQP GLES3.ubo and GLES2.uniform_api Change-Id: Ie6fcde1c16eb05d67191b629338b88302a2563f5 Reviewed-on: https://chromium-review.googlesource.com/298971 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill fb53603c 2015-09-11T13:19:49 Revert "Re^5-land "Move Uniform and UBO info to the gl::Program layer."" Failing dEQP-GLES3.functional.uniform_api.random.22 and 23: There's a bug with arrays of tranpsosed matrix uniforms. BUG=angleproject:1123 This reverts commit 78d356929bd0441d81e2dd8a63130cd6788e2fde. Change-Id: If39b5908af39671dfe98965e6a1ba77fd18ea8fc Reviewed-on: https://chromium-review.googlesource.com/299320 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 78d35692 2015-09-11T08:32:51 Re^5-land "Move Uniform and UBO info to the gl::Program layer." This data was previously stored entirely in the Impl level. Move as much as possible to the GL level, using a read-only view in the Impl level. Some information in D3D-specific, and should be stored separately in the Impl. This patch has a lot of refactoring that splits the D3D and GL info, and moves as much validation as possible to the GL layer, where it is shared between the back-ends. Re-land with fix for dEQP unused uniforms. The fix involves storing a local copy of all uniform data in the GL layer. This will also let us validate sampler indexes during draw calls at the GL layer. Re-re-land with a fix for multiply defined symbols on Clang. Re-re-re-land with a fix for boolean uniforms and Uniform{1234}f. Re^4-land with a fix for boolean uniform arrays and UBO uniforms. Re^5-land with a fix for a test warning on Linux. BUG=angleproject:1123 TEST=end2end_tests, bots, dEQP GLES3.ubo and GLES2.uniform_api Change-Id: I03afcd446d9e74573c4d4c712ed7407b91d8001c Reviewed-on: https://chromium-review.googlesource.com/299180 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill a2eb02c9 2015-09-11T12:31:41 Revert "Re^4-land "Move Uniform and UBO info to the gl::Program layer."" Test has a warning on Linux: In file included from ../../third_party/angle/src/tests/test_utils/ANGLETest.h:13: ../../testing/gtest/include/gtest/gtest.h:1392:16: error: comparison of integers of different signs: 'const int' and 'const unsigned int' [-Werror,-Wsign-compare] if (expected == actual) { ~~~~~~~~ ^ ~~~~~~ ../../testing/gtest/include/gtest/gtest.h:1422:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned int>' requested here return CmpHelperEQ(expected_expression, actual_expression, expected, ^ ../../third_party/angle/src/tests/gl_tests/UniformBufferTest.cpp:357:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<int, unsigned int>' requested here EXPECT_EQ(GL_FLOAT, type); ^ BUG=angleproject:1123 This reverts commit 2ae1ee6161c24aab065190b1528f6195e80e34d0. Change-Id: Ic3dabea54068377d1f2c5f722ba52966cf1a0491 Reviewed-on: https://chromium-review.googlesource.com/299170 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2ae1ee61 2015-09-10T10:04:24 Re^4-land "Move Uniform and UBO info to the gl::Program layer." This data was previously stored entirely in the Impl level. Move as much as possible to the GL level, using a read-only view in the Impl level. Some information in D3D-specific, and should be stored separately in the Impl. This patch has a lot of refactoring that splits the D3D and GL info, and moves as much validation as possible to the GL layer, where it is shared between the back-ends. Re-land with fix for dEQP unused uniforms. The fix involves storing a local copy of all uniform data in the GL layer. This will also let us validate sampler indexes during draw calls at the GL layer. Re-re-land with a fix for multiply defined symbols on Clang. Re-re-re-land with a fix for boolean uniforms and Uniform{1234}f. Re^4-land with a fix for boolean uniform arrays and UBO uniforms. BUG=angleproject:1123 TEST=end2end_tests, bots, dEQP GLES3.ubo and GLES2.uniform_api Change-Id: I4c9f5ed31b81380507bef7981f97086d642801ae Reviewed-on: https://chromium-review.googlesource.com/298451 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 86f8dd7c 2015-08-12T12:37:48 Implement a minimal EGL -> CGL backend This succesfully renders HelloTriangle and some samples but fails on a lot of tests. In particular it doesn't handle resizing the window and doesn't have depth or stencil buffers. BUG=angleproject:891 Change-Id: I16356471b470f764acb38e8dd3589e9c0129829d Reviewed-on: https://chromium-review.googlesource.com/290770 Tested-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Zhenyao Mo 54c311fc 2015-09-09T15:37:31 win clang build fix BUG= TEST=win clang bots build Change-Id: I802be2e72a884e50cf13120d3cd9c76a8f8eb86f Reviewed-on: https://chromium-review.googlesource.com/298253 Tested-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 61b8dd97 2015-09-09T19:04:04 Revert "Re-re-re-land "Move Uniform and UBO info to the gl::Program layer."" Seems to be failing the dEQP-GLES2.functional.uniform_api tests relating to boolean arrays. BUG=angleproject:1123 This reverts commit 892a6a4b17b35e89898be8b4605c1ee595d3ae13. Change-Id: Ifc4ce3ca806ef88a02ac6f693334ac37ce098a88 Reviewed-on: https://chromium-review.googlesource.com/298520 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 892a6a4b 2015-09-09T10:17:15 Re-re-re-land "Move Uniform and UBO info to the gl::Program layer." This data was previously stored entirely in the Impl level. Move as much as possible to the GL level, using a read-only view in the Impl level. Some information in D3D-specific, and should be stored separately in the Impl. This patch has a lot of refactoring that splits the D3D and GL info, and moves as much validation as possible to the GL layer, where it is shared between the back-ends. Re-land with fix for dEQP unused uniforms. The fix involves storing a local copy of all uniform data in the GL layer. This will also let us validate sampler indexes during draw calls at the GL layer. Re-re-land with a fix for multiply defined symbols on Clang. Re-re-re-land with a fix for boolean uniforms and Uniform{1234}f. BUG=angleproject:1123 TEST=end2end_tests,Canary WebGL (D3D11/GL), dEQP-GLES2+3.functional.uniform_api Change-Id: Ia40820a5ce2f34ec2d27648b1dc940a8955e9999 Reviewed-on: https://chromium-review.googlesource.com/298440 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho e6432c85 2015-09-08T14:21:38 Fix preprocessor macro replacement list location According to the dEQP tests, a macro replacement list generated by a function-like macro invocation should get its location from the closing parenthesis of the invocation. The tests check this by using __LINE__ in a macro with a multi-line invocation. It's not quite clear from the spec that the enforced behavior is expected as opposed to the replacement list getting its location from the macro name, but a minor correction to the preprocessor makes the dEQP tests pass. Newlines in the preprocessor unit tests are generated according to the source locations in the token list produced by the preprocessor, so the expectations of a few tests also need to be updated. BUG=angleproject:989 TEST=dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.* (2 start passing with this change), angle_unittests Change-Id: I4cc9da09bd0985310a05ebf6def680916a46308a Reviewed-on: https://chromium-review.googlesource.com/297990 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill b654f659 2015-09-08T20:40:00 Revert "Re-re-land "Move Uniform and UBO info to the gl::Program layer."" Failes the gles2_conform_test: GLES2ConformTest.GL2Tests_glGetUniform_input_run Possibly also WebGL failures, will investigate. BUG=angleproject:1123 This reverts commit 10750cb936288d8dd09d49fadd592904c06c56f9. Change-Id: I1ae59325e1831589019bc5a27ffc2091d3994a65 Reviewed-on: https://chromium-review.googlesource.com/298200 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 10750cb9 2015-09-04T14:23:52 Re-re-land "Move Uniform and UBO info to the gl::Program layer." This data was previously stored entirely in the Impl level. Move as much as possible to the GL level, using a read-only view in the Impl level. Some information in D3D-specific, and should be stored separately in the Impl. This patch has a lot of refactoring that splits the D3D and GL info, and moves as much validation as possible to the GL layer, where it is shared between the back-ends. Re-land with fix for dEQP unused uniforms. The fix involves storing a local copy of all uniform data in the GL layer. This will also let us validate sampler indexes during draw calls at the GL layer. Re-re-land with a fix for multiply defined symbols on Clang. BUG=angleproject:1123 TEST=end2end_tests,Canary WebGL (D3D11/GL), dEQP-GLES2+3.functional.uniform_api Change-Id: I7b55e4964fbe64e0106c37928c894146937a2476 Reviewed-on: https://chromium-review.googlesource.com/298110 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2119dd05 2015-09-08T19:30:37 Revert "Re-land "Move Uniform and UBO info to the gl::Program layer."" Problems with multiply defined symbols in the Linux builder. BUG=angleproject:1123 This reverts commit ff1abe63c3d8af28e9755c8d0c95b2aeca27a0d9. Change-Id: Ifcb2ad885d0841c128ffd69afb6594e37eba17fc Reviewed-on: https://chromium-review.googlesource.com/298100 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill ff1abe63 2015-09-04T14:23:52 Re-land "Move Uniform and UBO info to the gl::Program layer." This data was previously stored entirely in the Impl level. Move as much as possible to the GL level, using a read-only view in the Impl level. Some information in D3D-specific, and should be stored separately in the Impl. This patch has a lot of refactoring that splits the D3D and GL info, and moves as much validation as possible to the GL layer, where it is shared between the back-ends. Re-land with fix for dEQP unused uniforms. The fix involves storing a local copy of all uniform data in the GL layer. This will also let us validate sampler indexes during draw calls at the GL layer. BUG=angleproject:1123 TEST=end2end_tests,Canary WebGL (D3D11/GL), dEQP-GLES2+3.functional.uniform_api Change-Id: I9074c057c2c67d4d3221ec11c5556a26e07c7ceb Reviewed-on: https://chromium-review.googlesource.com/297070 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 809ec546 2015-08-26T14:30:57 Don't evaluate short-circuited preprocessor expressions Resubmit with clang build issue fixed. The result of a short-circuited operation is now either 0 or 1. ESSL 3.00 spec section 3.4 mentions that the second operand in a logical && or || preprocessor operation is evaluated only if the first operand doesn't short-circuit the expression. The non-evaluated part of a preprocessor expression may also have undefined identifiers. Make the expression parser follow the spec by ignoring errors that are generated inside short-circuited expressions. This includes undefined identifiers and divide by zero. BUG=angleproject:347 TEST=dEQP-GLES3.functional.shaders.preprocessor.undefined_identifiers.* angle_unittests Change-Id: I4163f96ec46d40ac859ffb39d91b89490041e44d Reviewed-on: https://chromium-review.googlesource.com/297252 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9a1b49f7 2015-09-08T14:32:26 Revert "Don't evaluate short-circuited preprocessor expressions" Build break on Clang: FAILED: /b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/angle/src/compiler/preprocessor/preprocessor.ExpressionParser.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=245965-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DDCHECK_ALWAYS_ON=1 -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DUSE_BROWSER_SPELLCHECKER=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_SERVICE_DISCOVERY=1 -DENABLE_WIFI_BOOTSTRAPPING=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DSAFE_BROWSING_SERVICE -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -Igen -isysroot /Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -O2 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof -mmacosx-version-min=10.6 -arch x86_64 -Wendif-labels -Wno-unused-parameter -Wno-missing-field-initializers -Wno-selector-type-mismatch -Wpartial-availability -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-unused-function -Wno-unused-variable -std=c++11 -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -fno-threadsafe-statics -Xclang -load -Xclang /b/build/slave/GPU_Mac_Builder/build/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -fcolor-diagnostics -fno-strict-aliasing -c ../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp -o obj/third_party/angle/src/compiler/preprocessor/preprocessor.ExpressionParser.o ../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1372:35: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] (yyval) = (yyvsp[-3]) || 0; ^ ~ ../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1372:35: note: use '|' for a bitwise operation (yyval) = (yyvsp[-3]) || 0; ^~ | ../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1406:35: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand] (yyval) = (yyvsp[-3]) && 0; ^ ~ ../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1406:35: note: use '&' for a bitwise operation (yyval) = (yyvsp[-3]) && 0; ^~ & ../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1406:35: note: remove constant to silence this warning (yyval) = (yyvsp[-3]) && 0; ~^~~~ BUG=angleproject:347 This reverts commit 6ffe613518482b966b913013c51221ce06ca7c33. Change-Id: I6d81666cca573f320bfb1164a6c794b6f75f7463 Reviewed-on: https://chromium-review.googlesource.com/298020 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 6ffe6135 2015-08-26T14:30:57 Don't evaluate short-circuited preprocessor expressions ESSL 3.00 spec section 3.4 mentions that the second operand in a logical && or || preprocessor operation is evaluated only if the first operand doesn't short-circuit the expression. The non-evaluated part of a preprocessor expression may also have undefined identifiers. Make the expression parser follow the spec by ignoring errors that are generated inside short-circuited expressions. This includes undefined identifiers and divide by zero. BUG=angleproject:347 TEST=dEQP-GLES3.functional.shaders.preprocessor.undefined_identifiers.* angle_unittests Change-Id: Ieed02a71298af838f784a5d1197d4f4a9ba0e3c8 Reviewed-on: https://chromium-review.googlesource.com/295033 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3766a40d 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I66a5e5a8d7f4267da0045f1cc2ba6b0dc7eb3f5d Reviewed-on: https://chromium-review.googlesource.com/296671 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Geoff Lang bdcc54a4 2015-09-02T13:09:48 Support writing interface blocks in OutputGLSL. BUG=angleproject:882 BUG=angleproject:1149 Change-Id: Iea0b1d0bc586ec9517a06793386c91890b7a5115 Reviewed-on: https://chromium-review.googlesource.com/297086 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang d8edb518 2015-09-02T11:52:56 Allow OutputGLSL to write non-square matrices. Fixes assertion failures when ShaderGL fails to compile the generated shaders. BUG=angleproject:882 BUG=angleproject:1149 Change-Id: Ib7c23a54bdb81852864d792f29c89644084859a3 Reviewed-on: https://chromium-review.googlesource.com/297085 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 6e36042f 2015-09-02T15:54:36 Implement translation of EOpIndexDirectInterfaceBlock in OutputGLSL. BUG=angleproject:882 BUG=angleproject:1149 Change-Id: I5e0808dd3576339aa87aade3a349586d01b28f74 Reviewed-on: https://chromium-review.googlesource.com/297087 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill a0a9e12d 2015-09-02T15:54:30 translator: Add sh::OutputVariable type. This replaces the dual-use of sh::Attribute, which can be a bit confusing to people expecting a literal output variable. Currently not used in Chromium, so should be safe to land. BUG=angleproject:1146 Change-Id: I436f2bc9dc4ddc3709369cb2baa344c6b13a21a2 Reviewed-on: https://chromium-review.googlesource.com/296683 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 48705cad 2015-09-02T20:40:51 Revert "Move Uniform and UBO info to the gl::Program layer." Seems to be failing dEQP-GLES2.functional.uniform_api.value.unused_uniforms.* on Linux (possibly Win as well) BUG=angleproject:1123 This reverts commit 54f882c9167b1aff5b3700187a2048bd886e8b17. Change-Id: I7dbbf40aae8dd9ebd35895df0dd338a3b6b9cc96 Reviewed-on: https://chromium-review.googlesource.com/297051 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 54f882c9 2015-09-02T14:33:48 Move Uniform and UBO info to the gl::Program layer. This data was previously stored entirely in the Impl level. Move as much as possible to the GL level, using a read-only view in the Impl level. Some information in D3D-specific, and should be stored separately in the Impl. This patch has a lot of refactoring that splits the D3D and GL info, and moves as much validation as possible to the GL layer, where it is shared between the back-ends. BUG=angleproject:1123 TEST=end2end_tests,Canary WebGL (D3D11/GL), dEQP-GLES2+3.functional.uniform_api Change-Id: I8b7e1380a61590a46ccee646a47ffe9bda287f6b Reviewed-on: https://chromium-review.googlesource.com/295124 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 477b243b 2015-08-31T10:41:16 Change the FLATTEN heuristic to "ifs with a loop with a gradient" This heuristic makes more sense than the previous "ifs with a discontinuous loop" as the reason we need to flatten is that we need gradients to be in branchless code. Change the UnrollFlatten test accordingly. Tested with: - the WebGL CTS - dev.miaumiau.cat/rayTracer "Skull Demo" - THe turbulenz engine GPU particle demo - Lots of ShaderToy Samples (inc. Volcanic, Metropolis and Hierarchical Voronoi) - Google Maps Earth mode - Lots of Chrome experiments - madebyevan.com/webgl-water BUG=524297 Change-Id: Iaa727036fffcfde3952716a1ef33b6ee0546b69d Reviewed-on: https://chromium-review.googlesource.com/296442 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 80ecac9e 2015-08-25T15:37:48 Remove unused mOptimize/mDebug flags from TIntermAggregate These flags were written but they were never read. TEST=compile BUG=angleproject:1116 Change-Id: I41e3e89f13861ebda4828c76c753ca17c74c4358 Reviewed-on: https://chromium-review.googlesource.com/294931 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 384f1fdd 2015-08-26T16:27:07 Fix a warning on Linux BUG= Change-Id: I5c4f5df14321644d7ac42af6059400ae43d0fe4d Reviewed-on: https://chromium-review.googlesource.com/295721 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tryjob-Request: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 3c192a78 2015-08-26T20:32:53 Revert "Remove dynamic indexing of matrices and vectors in HLSL" Seems to be failing a WebGL/ES2 CTS test in D3D9: conformance/ogles/GL/mat3/mat3_001_to_006 BUG=angleproject:1116 BUG=525188 This reverts commit 83f3411da456faac8570892e3dd7d76edf4095e5. Change-Id: Ic186f51240dbdd96ccab3f5470329cdc9727c618 Reviewed-on: https://chromium-review.googlesource.com/295730 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 83f3411d 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I024722ef4ca1e14d5ad47fdc540397e18858bed6 Reviewed-on: https://chromium-review.googlesource.com/290515 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d7a25243 2015-08-18T13:49:45 Add deep copying support for typed AST nodes Resubmit with inconsistent override warnings fixed. Removing dynamic indexing of vectors and matrices will require copying the indexed nodes in case they are written. Any type of l-value node that doesn't have side effects may need to be copied. Add a copying function for all typed node classes so that this copying can be performed. Private copy constructors are used to implement the deepCopy function in order to make maintenance easier. With copy constructors, each subclass only needs to take care of copying its own members, and not the base class members, which reduces the possibility of errors. Copy constructors are disabled for all node classes that don't support deep copying by inheriting TIntermNode from angle::NonCopyable. Assignment operator is disabled for all node classes through inheriting angle::NonCopyable. This applies also to classes that now get the private copy constructor. Explicit copy constructor and assignment operator declarations are added to some classes which show up in node member variables to make code clearer. BUG=angleproject:1116 TEST=angle_unittests Change-Id: I7964976f5dac7dfd745b8c6612ca06fb01d271c4 Reviewed-on: https://chromium-review.googlesource.com/295080 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 4dfe8094 2015-08-21T17:44:35 Always collect variables when generating HLSL HLSL output needs uniform information generated by the collectVariables() step to be able to write uniform registers. Tested manually by compiling a shader with a uniform with shader_translator. BUG=angleproject:1132 Change-Id: I91d19b5fa789b7b33cf76a654ffbbd17d279db01 Reviewed-on: https://chromium-review.googlesource.com/294962 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Corentin Wallez e5a1f271 2015-08-21T02:58:25 Use override in all the places where it is possible This will avoid -Winconsistent-overrides in the future. Done using the -Wsuggest-override warning of GCC 5.1 BUG= Change-Id: I707a649dc368f5dd1e139fd144370abcac0b6263 Reviewed-on: https://chromium-review.googlesource.com/294920 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez b5d61dac 2015-08-20T13:43:02 Revert "Add deep copying support for typed AST nodes" This reverts commit d0d59aa4cbce2da92deaa0f4021dfed8885e8d01 and commit 760379532b02ae039790f1e8f1c89e03481aab4b To be fixed will be the newline at the end of IntermNode_tests.cpp and the -Winconsistent-missing-override BUG= Change-Id: I57693bdff01f9e3f03b2fbb5dc53fa21e68c2789 Reviewed-on: https://chromium-review.googlesource.com/294820 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho a7b6db7f 2015-08-19T14:26:30 Only apply Appendix A limitations to ESSL 1.00 shaders ESSL 1.00 specifies a set of minimum functionality, and ANGLE automatically checks that WebGL shaders stay within this minimum functionality. However, this should only apply to ESSL 1.00. ESSL 3.00 shaders compiled for WebGL 2.0 should not be subject to these restrictions, since there is no similar spec for minimum functionality for ESSL 3.00. In case a non-WebGL based shader spec is used, the restrictions can be toggled from outside by specifying the SH_VALIDATE_LOOP_INDEXING flag, same as before this patch. BUG=angleproject:1116 TEST=WebGL 2 conformance tests Change-Id: Idaec0fb4c7c85cd72020d0b23112fddb1b020571 Reviewed-on: https://chromium-review.googlesource.com/293933 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>