src/tests/gl_tests/GLSLTest.cpp


Log

Author Commit Date CI Message
Yunchao He 9550c603 2018-02-13T14:47:05 Code refactoring for end2end tests. This change: 1) uses the new style ANGLE_SKIP_TEST_IF to skip tests. 2) replaces compile-time definition for OSX to skip tests by run-time function IsOSX() to skip tests, in order to align with ANGLE_SKIP_TEST_IF. 3) fixes a couple of typos. BUG=angleproject:2005 Change-Id: I5af77d82257536b9eb79e26afa502f5b91ff6d31 Reviewed-on: https://chromium-review.googlesource.com/915861 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Yunchao He 2f23f35a 2018-02-11T22:11:37 Clean up end2end tests for Intel OSX. BUG=angleproject:2205 BUG=angleproject:2041 BUG=angleproject:2155 Change-Id: I26bcbb63e147787cd342ec80a86d60cf230be4c9 Reviewed-on: https://chromium-review.googlesource.com/913108 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang ed04619a 2018-02-08T14:57:14 Fix typo in bug link. BUG=angleproject:2205 Change-Id: I7ff1c3d0bb380c73c07dad0a30a4a4a19c17e397 Reviewed-on: https://chromium-review.googlesource.com/909577 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 06b95582 2018-02-08T13:48:44 Re-supress VerifyMax*UniformVectors on Ozone Intel. BUG=angleproject:2205 Change-Id: Icff414dc7a521205fd3e39af4652b0fdef1cb900 Reviewed-on: https://chromium-review.googlesource.com/909291 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Yunchao He 8e5ba8bb 2018-02-05T17:52:27 Clean up end2end tests for Intel Linux platform. Removed tests can pass on Intel Linux Desktop (Intel KabyLake, Ubuntu 17.04) with system default mesa and latest upstream mesa. BUG=angleproject:2205 BUG=chromium:680631 Change-Id: Ie3f0f34b9708a7dab81f66d9ec83a469658deee7 Reviewed-on: https://chromium-review.googlesource.com/901382 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 61d5325e 2018-01-31T14:49:24 D3D9: Improve varying packing failure mode. D3D9 has a special limitation on varying packing, where each variable takes up a full register width, and cannot share space with other packed varyings. A bug was counting registers incorrectly on D3D9. Fix this by introducing a new limitation exposed to the ANGLE front-end via the gl::Limitations structure. Now varying packing will fail correctly in the ANGLE linking front-end with a more descriptive error message, as such: "Could not pack varying blah" "Note: Additional non-conformant packing restrictions are enforced on D3D9." Also change the packing so that input built-in variables are counted towards varying limits (e.g. gl_PointSize), except for gl_Position. On D3D9 we don't pack gl_PointSize, since it is used in a special extra PSIZE register. Also update some tests to be more robust. Bug: chromium:804799 Change-Id: I9027266a8b66a28626f038f259bff42ebf09dcd2 Reviewed-on: https://chromium-review.googlesource.com/889898 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao 881b7bfa 2017-12-25T11:18:37 ES31: Refactor link mismatch error log This patch intends to refactor the structure of logging link mismatch errors to meet the new GLES 3.1 program link requirements and support linking program with geometry shader. This patch is mainly focusing on the following 4 issues: 1. There are totally 14 places that log the link mismatch errors in almost same format. 2. A temporary string is created (STRUCT_NAME.FIELD_NAME) before checking a field of a block, which is of no use if link succeeds. 3. LinkValidateVariablesBase needs to know "shaderTypes" if we support geometry shader based on current structure. Since uniforms are checked in the range of the whole program, it is unnecessary to know in which shader a uniform is defined if link succeeds. 4. GLES 3.1 regards varyings with same location but different names as matched, so it isn't enough to log errors only by one name. This patch can solve all these issues by the following 3 changes: 1. Replace "infoLog" and "variableNames" by "mismatchedFieldName" (the complete field name if the mismatch occurs on a field of a struct or block). 2. Use enum LinkMismatchError as the return value of all linkValidate* functions to reflect the detail of the link mismatch error. 3. Log all the link mismatch errors by InfoLog::logLinkMismatch where we can get shader types instead of passing them into linkValidate* functions. BUG=angleproject:1941, angleproject:2144 TEST=angle_end2end_tests Change-Id: I3ed876d61f812cc7a45a6a3c5fec0b4a88b9cc2c Reviewed-on: https://chromium-review.googlesource.com/844215 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Yuly Novikov 4e36db8c 2018-01-19T17:35:33 Skip FindMSBAndFindLSBCornerCases on Android OpenGLES Due to a bug in Adreno N5X Oreo driver BUG=angleproject:2304 Change-Id: I209d9b227557571f45a93aa68a003378e12402a1 Reviewed-on: https://chromium-review.googlesource.com/876995 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Jiawei Shao 02f15239 2017-12-27T10:10:28 Clear error logs when starting a new link process This patch intends to fix a bug in logging link errors. OpenGL ES requires glGetProgramInfoLog return a string that contains information about last link or validation attempt on a program object (GLES 2.0 Chapter 6.1.8, GLES 3.0 Chapter 6.1.12). So all the link error logs should be cleared when a new link process is begun. This patch also removes several redundant allocations of mLazyStream in ProgramD3D::compileProgramExecutables. Calling "<<" on InfoLog objects will initialize its member mLazyStream from heap, so we will skip using "<<" if there is actually nothing to output. BUG=angleproject:2295 TEST=angle_end2end_tests Change-Id: Ib81fffd3d05919a8ebccd9145ff780548ca86a70 Reviewed-on: https://chromium-review.googlesource.com/848324 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho b8cb939f 2017-12-20T14:23:19 Fix tracking variables in folded ternary operators The result of folding a ternary operator may be a TIntermSymbol node where the qualifier doesn't match the qualifier of the variable that the node is referring to. Get the qualifier from the variable instead of directly from TIntermSymbol when collecting variables in CollectVariables or when tracking referenced variables in OutputHLSL. BUG=angleproject:2288 TEST=angle_unittests, angle_end2end_tests Change-Id: If294a7fe9dca50f2ebcea3feff887e72a521d395 Reviewed-on: https://chromium-review.googlesource.com/836893 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 629a6449 2017-12-11T10:55:43 Fix HLSL integer pow workaround The exponent should be rounded prior to casting it to an integer. Also if the exponent has a significant fractional part the expression should not be turned into a multiplication. The previous code failed to check this correctly if the exponent's fractional part was greater than 0.5. The test case is expanded to cover the previously failing cases. BUG=chromium:793115 TEST=angle_end2end_tests Change-Id: Ic72cd6ddc7f3d2495f7c87a3e3cfac5791445e72 Reviewed-on: https://chromium-review.googlesource.com/817299 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7caa80e7 2017-11-14T15:03:14 Edit tests to reference temporary variables The shader translator is intended to prune unreferenced variables in the future. To maintain test coverage when this is done, most tests that used to have unreferenced GLSL locals and globals are edited to use built-ins or reference the necessary variables instead. BUG=angleproject:2166 TEST=angle_unittests, angle_end2end_tests Change-Id: I3964e7a80d52fc04a95f57e73da6095e433095e8 Reviewed-on: https://chromium-review.googlesource.com/768740 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 703671e9 2017-11-08T17:47:18 Unify extension behavior checks Some supportsExtension and isExtensionEnabled checks are now turned into checkCanUseExtension checks. Using checkCanUseExtension is preferable so that warnings are generated correctly when an extension is used and a warn directive is present. isExtensionEnabled is still used in some places where an error message about the extension could be confusing, particularly when a core spec version adds support for something that is also present in an extension. Also make it possible to disable ARB_texture_rectangle extension using an extension directive. ARB_texture_rectangle extension functionality is enabled by default in GLSL when the extension is supported. BUG=angleproject:2238 TEST=angle_unittests Change-Id: I7455293412ff469f54bc7da79df146e7bc127379 Reviewed-on: https://chromium-review.googlesource.com/760737 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 661fc487 2017-10-16T12:17:05 Work around NVIDIA GLSL vector-scalar op bug This adds a new AST transform VectorizeVectorScalarArithmetic. The AST transform works around incorrect handling of certain types of GLSL arithmetic operations by NVIDIA's GL driver. It works around only the most common cases where the bug reproduces, since detecting all the cases would take more sophisticated analysis of the code than what is currently easily implementable in ANGLE. When a float add operator has both vector and scalar operands, the AST transform turns the scalar operand into a vector operand. Example: vec4 f; f += 1.0; gets turned into: vec4 f; f += vec4(1.0); When a vector constructor contains a binary scalar float multiplication or division operation as its only argument, the AST transform turns both operands of the binary operation into vector operands. Example: float f, g; vec4(f * g); gets turned into: float f, g; vec4(vec4(f) * vec4(g)); Another example with compound assignment: float f, g; vec4(f *= g); gets turned into: float f, g; vec4 s0 = vec4(f); (s0 *= g, f = s0.x), s0; This latter transformation only works in case the compound assignment left hand expression doesn't have side effects. BUG=chromium:772651 TEST=angle_end2end_tests Change-Id: I84ec04287793c56a94845a725785439565debdaf Reviewed-on: https://chromium-review.googlesource.com/721321 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho bd3cd506 2017-11-03T15:48:52 Clean up HLSL constructor output Split generating HLSL struct constructors from generating built-in type constructors, as these didn't have much in common. Struct constructors are now only generated when they are needed, as opposed to before, when they were generated on any use of a struct. This changes built-in constructor naming to include "_ctor" and gets rid of having special built-in type names just for constructors. This will make it easier to do changes to constructor output, for example to add constructors for structs in std140 layout. This might be needed to implement SSBOs efficiently. This includes one bug fix for writing out struct declarations for varyings. Also improves const-correctness of accessing structs through TType in general. BUG=angleproject:2218 TEST=angle_unittests, angle_end2end_tests Change-Id: If865fb56f86486b9c4a2c31e016ea16427f4a5fa Reviewed-on: https://chromium-review.googlesource.com/753883 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho c1f14fbe 2017-10-28T19:17:23 Remove empty switch statements from translated shaders The native HLSL compiler does not accept switch statements with an empty statement list. The simplest way to accommodate this is to simply remove them from the AST after parsing and some initial pruning. This is done by the new RemoveEmptySwitchStatements traverser. It preserves init statements of switch statements in case they have side effects. So for example switch(++i) {} gets translated to ++i; BUG=angleproject:2206 TEST=angle_end2end_tests Change-Id: I550a3c9b010a3566016bdfd93344ac30fd860604 Reviewed-on: https://chromium-review.googlesource.com/742922 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f6d242ed 2017-10-12T17:21:06 Wrap switch statements in blocks in HLSL If variables are declared inside a GLSL switch statement, they are scoped until the end of the switch statement. This is not compatible with HLSL rules, where the scoping is until the end of the case. To work around this, wrap switch statements in a block that declares the variables in HLSL. This is done after most other transformations done to the AST are complete, since some of the other transformations may introduce temporary variables. BUG=angleproject:2179 TEST=angle_end2end_tests Change-Id: Id0bb89affe103177fd3d6a6b2f3619b5e1ada0a6 Reviewed-on: https://chromium-review.googlesource.com/716381 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 4bd730c8 2017-10-10T14:14:19 Recognize more non-fallthrough cases in switch/case RemoveSwitchFallThrough now treats cases where break; or return; is nested inside a block as non-fallthrough to avoid unnecessary duplication of code. For example, the case 1 below would previously get treated as fall-through: switch(foo) { case 1: { break; } default: break; } Now RemoveSwitchFallThrough doesn't do anything to this code. BUG=chromium:772695 TEST=angle_end2end_tests Change-Id: Iafab6d8b05c63bcdb5f54834dbc1f41192c31dd4 Reviewed-on: https://chromium-review.googlesource.com/709197 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 923ecef6 2017-10-11T12:01:38 Fix switch statement validation corner cases The grammar needs to generate AST nodes even for no-op statements, since they might be the last statement in a switch statement that is required for switch statement validity. Change the grammar to generate nodes from empty blocks and empty declarations. We also need to do some further processing of the AST. This is because PruneEmptyDeclarations will still remove empty declarations, and at least the NVIDIA driver GLSL compiler doesn't accept some types of no-op statements as the last statement inside a switch statement. So after parsing has finished we do rudimentary dead code elimination to remove dead cases from the end of switch statements. BUG=angleproject:2181 TEST=angle_unittests Change-Id: I586f2e4a3ac2171e65f1f0ccb7a7de220e3cc225 Reviewed-on: https://chromium-review.googlesource.com/712574 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 852fe873 2017-10-10T15:13:59 Fix HLSL for switch statements that don't end in a branch In case the last case inside a switch statement is not terminated in a branch statement, RemoveSwitchFallThrough needs to add it before calling handlePreviousCase. This ensures that all preceding fall-through cases will get a copy of the branch statement and so will not fall through. This also fixes running RemoveSwitchFallThrough so that it's only executed once per each switch statement. The error was not caught by the dEQP tests, so a new ANGLE test is added. BUG=angleproject:2178 TEST=angle_end2end_tests Change-Id: I26b6989aa4d32de2d74cde56d72ee24f61195445 Reviewed-on: https://chromium-review.googlesource.com/709196 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 78507c6e 2017-10-10T15:06:45 Fix statements disappearing from switch statements in HLSL RemoveSwitchFallThrough now correctly records the existence of declaration and swizzle statements inside switch statements. BUG=angleproject:2177 TEST=angle_end2end_tests Change-Id: I1ef83997db7ae510ded002a9568c29272c00c2fe Reviewed-on: https://chromium-review.googlesource.com/709195 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Kai Ninomiya a60d3567 2017-10-02T22:10:28 Re-enable uninitialized-local test that should pass now Follow up to https://crrev.com/c/669642 Bug: angleproject:2041 Change-Id: I27bf4458f5c8be265b757fd5a3ea10f5ffa9e10e Reviewed-on: https://chromium-review.googlesource.com/696764 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho a20af6d7 2017-09-18T13:32:29 Use C++11 raw string literals instead of SHADER_SOURCE macro This is better in many ways: 1. It doesn't confuse clang format 2. \n doesn't need to be included after preprocessor directives like the version directive. 3. It's using built-in functionality instead of something custom. Raw string literals should be the preferred way to include shader source in C++ files going forward. BUG=angleproject:2157 TEST=angle_end2end_tests Change-Id: I8b236a6e2d5c25d920297e5bc5b5b143eddeba1f Reviewed-on: https://chromium-review.googlesource.com/671046 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho bb5a7e29 2017-08-30T13:03:12 Allow length() on arbitrary array expressions This is required to pass some dEQP GLES 3.1 tests for arrays of arrays, and WebGL conformance tests were also recently fixed to require this behavior. The intent of the GLSL ES spec was not to restrict usage of length(). In practice GL drivers don't implement array length() on expressions with side effects correctly in all cases. HLSL doesn't have an array length operator either. Because of this we always remove array length ops from the AST before output. BUG=angleproject:2142 TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests Change-Id: I863a92e83ac5315b013af9a5626348482bad72b3 Reviewed-on: https://chromium-review.googlesource.com/643190 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho a16a84f3 2017-09-12T13:49:18 GLSL: Fix initializing globals declared after main() Initialize globals in a separate function instead of a block in the beginning of main(). This way it works also for globals declared after main(). BUG=chromium:764036 TEST=angle_end2end_tests Change-Id: I2fcbb97d046589301287757dc3dde5471172a3f6 Reviewed-on: https://chromium-review.googlesource.com/663158 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 28839f03 2017-08-15T11:38:16 Fix handling sampler arrays in structs as function arguments on HLSL Some of the code was written under the mistaken assumption that createSamplerSymbols would be splitting sampler arrays in structs into individual samplers. Fix it by adding array dimensions to sampler parameters generated by createSamplerSymbols when necessary. BUG=angleproject:2128 TEST=angle_end2end_tests Change-Id: Ie622c777d78ae65b5629d12e0ae574800c1b78f5 Reviewed-on: https://chromium-review.googlesource.com/614882 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 3860b6c0 2017-07-19T16:17:24 Fix arrays of structs containing samplers as parameters on HLSL In HLSL output, samplers are never passed to functions as arrays, but rather sampler array arguments are expanded into single sampler and/or texture arguments. This applies also when the samplers were inside arrays of structs in the original source. BUG=angleproject:2103 TEST=angle_end2end_tests Change-Id: Ib1fcba0c0ab3da592d15272eb56a03c3e536f349 Reviewed-on: https://chromium-review.googlesource.com/576041 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 06a06f5e 2017-07-12T12:22:15 Fix non statically used fragment input structs on HLSL Add static use information to struct fields that mirrors the static use information on the struct itself. This way dynamically generated HLSL doesn't need special handling for initializing fragment inputs if they are structs. This fixes a problem with the previous code where dynamically generated HLSL ended up trying to initialize structs that are not declared in the HLSL output because they were not being referenced. BUG=angleproject:2104 TEST=angle_end2end_tests Change-Id: I21283ce4fe26515d62d95e61f8155dc9a9b44cf1
Olli Etuaho 088031e6 2017-07-03T15:59:33 HLSL: Disambiguate between struct function parameters Structs with different names but identical members are treated as ambiguous by the native HLSL compiler when looking up user-defined functions. Add the struct name to the function name to work around this limitation. BUG=chromium:731324 TEST=angle_end2end_tests Change-Id: Ie80ac0f1374bc5ac05dfebef3f94e2da7cdfc581 Reviewed-on: https://chromium-review.googlesource.com/558929 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ff526f14 2017-06-30T12:26:54 Fix variable vs. function name conflict in HLSL output GLSL ES spec accepts the case where an initializer of a variable calls a function with the same name as the variable. The HLSL compiler doesn't accept that. Work around this limitation in the HLSL compiler by disambiguating user-defined functions from variables with a different prefix. BUG=angleproject:2095 TEST=angle_end2end_test, angle_unittests Change-Id: I41b32a3fcc6fd4c548e8dc3aa680d1b07fcf8719 Reviewed-on: https://chromium-review.googlesource.com/557872 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 914b79a6 2017-06-19T16:03:19 Fix parsing GLSL loop conditions that declare a variable Now the variable declaration is included in the AST, so that the loop body may refer to the variable. The variable declaration is placed in a block that wraps the loop. This way we can still only have TIntermTyped loop conditions in the AST, which keeps the code dealing with loops fairly simple and type safe. This change includes reversing the return value of executeInitializer, so that it returns true on success and false on error. This is more in line with other ParseContext member functions. BUG=angleproject:2073 TEST=angle_end2end_tests Change-Id: I5c4ecbf1b438d3fff6d6237c0dcf191e2a19664c Reviewed-on: https://chromium-review.googlesource.com/539639 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Geoff Lang bb1e750c 2017-06-05T16:40:09 Validate that structure names match when linking uniforms. GLSL 1.017 4.2.4: Structures must have the same name, sequence of type names, and type definitions, and field names to be considered the same type. TEST=conformance/glsl/misc/shaders-with-uniform-structs BUG=angleproejct:2013 Change-Id: Ieedaaca2d28ef4e1cc0b5480f413ebd513c1dc1f Reviewed-on: https://chromium-review.googlesource.com/524036 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2f348d2a 2017-06-05T10:50:59 Make gl::Compiler reference-counted. This is helpful for implementing program binary caching in ANGLE. in order to maintain the current behaviour in Chrome, we will need to defer shader compilation until link time. Since WebGL allows the app layer to enable and disable extensions explicitly, the app can enable or disable an extension between the calls to glCompileShader and glLinkProgram. Then, if we're deferring shader compilation, we will have to preserve the extension settings at the time of the call to compile, not the current settings at the time of link. Making the compiler reference-counted gives us a pretty simple and robust solution. This also changes the Context class to lazily init the shader compiler. Lazy init prevents any unexpected nulls, and also ensures the releaseShaderCompiler does exactly that: just releases the shader compiler, and does not immediately re-initialize it. BUG=angleproject:2044 Change-Id: I0f0eeb4eb94dc4eee238f92482804a0921c77df0 Reviewed-on: https://chromium-review.googlesource.com/522868 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 0ffc441e 2017-05-19T14:18:55 Initialize uninitialized globals in GLSL output Initializing globals is done by the DeferGlobalInitializers AST transformation, which makes sure that the global variable init proceeds in the correct order. This is important since some global variables may use other uninitialized globals in their initializers. The global variable init is only done in case the WebGL shader spec is being followed. This avoids adding global initializers twice in case the same shader goes through multiple translations, assuming only one of them is a WebGL shader translation. BUG=angleproject:1966 TEST=angle_end2end_tests, WebGL conformance tests Change-Id: Iea701d3ae40edc906abd87303f2aa27fd23bf55a Reviewed-on: https://chromium-review.googlesource.com/509689 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho df7d13eb 2017-05-30T13:53:45 Lift outdated NVIDIA test suppressions Lift some test suppressions for bugs that have been fixed in the NVIDIA driver a good while ago. Also improve code style in some suppressions - prefer IsOSX() and IsLinux() to using ifdefs. BUG=angleproject:1305 TEST=angle_end2end_tests Change-Id: Ia069f5b9696000c901956d2952801d5f5c339a11 Reviewed-on: https://chromium-review.googlesource.com/518168 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 9733ceef 2017-05-11T19:14:35 Initialize uninitialized locals in GLSL output Guarantee that local variables are initialized before they are used in GLSL output. In HLSL output all variables were already being initialized. Locals are initialized using an AST transform. The local variable init can only be run after some simplification of the AST, so that it is able to handle complex cases like: for (int i[2], j = i[0]; i[0] < 3; ++i[0]) { } If we're dealing with ESSL 1.00 which lacks array constructors, in this kind of case the uninitialized array initialization code needs to be hoisted out of the loop init statement, and the code also needs to make sure that j's initializer is run after i is initialized. Another complex case involves nameless structs. This can be an issue also in ESSL 3.00 and above: for (struct { float f; } s; s.f < 1.0; ++s.f) { } Since the struct doesn't have a name, its constructor can not be used. We solve this by initializing the struct members individually, similarly to how arrays are initialized in ESSL 1.00. Initializing local variables is disabled on Mac and Android for now. On Mac, invalid behavior was exposed in the WebGL 2.0 tests when enabling it. On Android, the dEQP test runs failed for an unknown reason. Bugs have been opened to resolve these issues later. BUG=angleproject:1966 TEST=angle_end2end_tests, WebGL conformance tests Change-Id: Ic06927f5b6cc9619bc82c647ee966605cd80bab2 Reviewed-on: https://chromium-review.googlesource.com/504728 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Yunchao He f81ce4a3 2017-04-24T10:49:17 Refactoring: replace NULL by nullptr for pointers (3rd CL). This CL mainly handles passing/returning NULL to/from a function. BUG=angleproject:2001 Change-Id: I34802f792e710e3d7ff697cbe4701dc1bf5ab009 Reviewed-on: https://chromium-review.googlesource.com/485060 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang ba992ab5 2017-04-19T11:18:14 Fix HLSL 3 generation of shaders with texture LOD. BUG=angleproject:2002 Change-Id: If8e6bbaeb5769341f92f05025eafb6a202fec437 Reviewed-on: https://chromium-review.googlesource.com/481680 Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 8162926b 2017-04-19T11:56:01 Never add declarations without children to the AST When block nodes were being created for loop bodies that didn't have braces in the parsed source, the code didn't check if the loop body was a declaration node without children. Always use appendStatement() for adding statements to a block, so that declaration nodes without children don't end up in the AST. Similarly make sure that loop init nodes aren't declarations without children. BUG=chromium:712550 TEST=angle_end2end_tests Change-Id: I5e79b700fe6158fa2422fcf4cd13818b2bd24863 Reviewed-on: https://chromium-review.googlesource.com/481660 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 8aeeed6e 2017-03-15T18:09:26 D3D11: Work around compiler nested sampling bug. We can potentially work around a bug in the HLSL compiler by omitting the const qualifier from some sampling operations. BUG=angleproject:1923 Change-Id: I8a5d119707721e9c19f06be4ad808f87bfcdbee5 Reviewed-on: https://chromium-review.googlesource.com/454938 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 6445ddf8 2017-03-08T19:00:32 end2end_tests: Adds more skips for new tests and testers BUG=angleproject:1924 Change-Id: I3ca25545632c9884eb1a8dba5e8e402b14324f80 Reviewed-on: https://chromium-review.googlesource.com/451877 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho c9da71ff 2017-03-06T16:28:54 Fix translating dynamic indexing of swizzle to HLSL This was broken due to a simple omission in deep copying swizzle AST nodes. It was found that several if not most OpenGL drivers also have some issue related to this, so the end2end test is suppressed on many OpenGL platforms. Intel Windows driver seems to be behaving correctly. BUG=angleproject:1921 TEST=angle_end2end_tests Change-Id: Ieefcedc2f2e36c3d8b607c28e449b696b8ad6892 Reviewed-on: https://chromium-review.googlesource.com/449717 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 61bd9fe1 2017-01-27T14:20:34 Suppress ESSL 3.10 integer math failure on AMD Linux Failure was seen on bots since the test was introduced. BUG=chromium:686105 BUG=angleproject:1730 Change-Id: I60293f17bf5e2498cbfb61f86468c218d58df68d Reviewed-on: https://chromium-review.googlesource.com/434080 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 9250cb24 2017-01-21T10:51:27 Add ESSL 3.10 integer math built-ins This adds built-ins found in ESSL 3.10 section 8.8 Integer functions. This includes constant folding support for functions that may be constant folded, and support for both GLSL and HLSL output. In HLSL several of the functions need to be emulated. The precision qualification for the return value of some of these functions is determined by special rules, that are now part of type promotion for TIntermUnary nodes and determining the type of TIntermAggregate nodes. BUG=angleproject:1730 TEST=angle_unittests TEST=dEQP-GLES31.functional.shaders.builtin_functions.integer.* Change-Id: Ib0056c17671c42b6496c2f0ef059b99f8f25c122 Reviewed-on: https://chromium-review.googlesource.com/431310 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
Olli Etuaho 8f6eb2ad 2017-01-12T17:04:58 HLSL output: Fix nested dynamic indexing in an l-value This fixes cases where a matrix is indexed and then the resulting vector is indexed in the same expression inside an l-value. BUG=angleproject:1672 TEST=angle_end2end_tests Change-Id: Ia0593d75da67e0aa582003e1c381f2a1c89f948c Reviewed-on: https://chromium-review.googlesource.com/427938 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Zhenyao Mo 1a256721 2017-01-12T11:52:57 Skip two unittests on Linux/Intel. BUG=680631 TEST=angle_end2end_tests on Linux/Intel Change-Id: I0823b5accc1c1962d7b498bf74d58edcc6971133 Reviewed-on: https://chromium-review.googlesource.com/427285 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 192745a7 2016-12-22T15:58:21 Add varying packing validation for WebGL. This CL moves the varying packing from the D3D layer up to Program. This is necessary for WebGL validation, and gives us consistency for the various back-ends. There may be some additional cleanup work on the VaryingPacking class, because it does some work that is D3D- specific. WebGL requires strict varying packing. Instead of allowing success unconditionally, it's an explicit error to succeed to pack a set of varyings that the sample algorithm would fail to pack. Introduce a new packing mode option to the varying packing class to handle this different packing style, while keeping our old more relaxed packing method for ES code. BUG=angleproject:1675 Change-Id: I674ae685ba573cc2ad7d9dfb7441efa8cb2d55fc Reviewed-on: https://chromium-review.googlesource.com/423254 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill e1faacb1 2016-12-13T12:42:14 Don't use logging macros in end2end_tests. Macros like ASSERT and UNREACHABLE call gl::trace, which at some point we might want to use to call the angle Platform logging code. Standalone tests won't easily have access to the platform, so for now just log errors in other ways. This also corrects some logic in GLSLTest which was calling internal methods in libANGLE when it didn't have to. BUG=angleproject:1660 Change-Id: Idecbd97f2de7916b35bd78f5b7cd02b156ea100d Reviewed-on: https://chromium-review.googlesource.com/419134 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho da9fb093 2016-12-09T17:32:29 Work around atan(y, x) bug on NVIDIA atan(y, x) is not always returning expected results on NVIDIA OpenGL drivers between versions 367 and 375. Work around this by emulating atan(y, x) using the regular atan(x) function. A fix to the driver is expected in a future release. It is most convenient to implement the vector atan(y, x) functions by using the scalar atan(y, x) function. Support for simple dependencies between emulated functions is added to BuiltInFunctionEmulator. In the current implementation one function is allowed to have at most one other function as its dependency. BUG=chromium:672380 TEST=angle_end2end_tests Change-Id: I9eba8b0b7979c7c7eaed353b264932e41830beb1 Reviewed-on: https://chromium-review.googlesource.com/419016 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 36fd100d 2016-12-08T11:30:44 GLSLTest: test interaction of declaration splitting with other passes In TranslatorHLSL a number of AST simplifications are done, that must happen in a precise order for things to be correct: - First for-loops must be split - Then multideclarations must be split - Finally comma operators must be split This adds tests for interaction between this passes to make sure they are done in the right order. BUG=668028 Change-Id: I306915b51011bb5467d117352becfd60cbe77be4 Reviewed-on: https://chromium-review.googlesource.com/417989 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Qiankun Miao f52fe93d 2016-12-07T13:39:15 Work around unary minus operator float issue on Intel Mac 10.11 Result of -float is wrong on Intel Mac 10.11 drivers. Replace -float with 0.0 - float to work around this issue. BUG=308366 BUG=672380 Change-Id: I53bc2eda7259fff5805bec39896fc7b7a6eaf665 Reviewed-on: https://chromium-review.googlesource.com/417169 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 56a2f95f 2016-12-08T12:16:27 Output infinity and NaN literals correctly in shaders Previously infinity and NaN resulting from constant folding would be clamped to finite 32-bit float range when they were written in shader output. Now they are written as a bit pattern in case the shader version allows it. This does not guarantee that NaNs work, but this is fine, since ESSL 3.00.6 spec has very loose requirements when it comes to NaNs. BUG=angleproject:1654 TEST=angle_end2end_tests Change-Id: I9997000beeaa8ed22523c22d5cf6929cdfc93f60 Reviewed-on: https://chromium-review.googlesource.com/417301 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2ad1c490 2016-12-07T14:46:18 D3D: Fix overflow in varying packing. Also add a more robust set of unit tests for this internal class. Because the GL spec allows for succeess when packing any set of varyings, it's impossible to write negative end to end tests. This CL also rewrites our disabled varying packing GLSL tests as unit tests. BUG=angleproject:1296 BUG=angleproject:1638 Change-Id: I78153742517d5c72ddb13ff59dc44ddc4af42fc2 Reviewed-on: https://chromium-review.googlesource.com/415555 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 1be4d493 2016-09-27T11:15:38 Fix handling integer overflow in constant folding Integer operations that overflow are defined to wrap in the ESSL 3.00.6 spec. Constant folding that happens inside the shader translator should also follow the wrapping rules. The new implementations of wrapping integer addition and subtraction use unsigned integers to perform calculations. Unsigned integers are defined to implement arithmetic in modulo 2^n in the C++ spec. This behavior is also leveraged to implement wrapping unsigned integer multiplication. The implementation of wrapping signed integer multiplication is slightly trickier. The operands are casted to a wider type to perform the multiplication in a way that doesn't overflow, and then the result is truncated and casted back to the narrower integer type. Incorrect tests that expected errors to be generated from integer overflow in constant folding are removed. BUG=chromium:637050 TEST=angle_unittests Change-Id: I0de7e25881d254803455fbf22907c192f49d09ff Reviewed-on: https://chromium-review.googlesource.com/390252 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang 28a97ee1 2016-09-22T13:01:26 Generate unique HLSL texture function names for external textures. Because 2D and external textures have the same HLSL texture type, they were generating texture functions with the same name. This causes conflicts when both 2D and external textures are used in the same shader. BUG=angleproject:1534 BUG=645532 Change-Id: I4b324014b7d9b4851d358730cf4e31fc8461584c Reviewed-on: https://chromium-review.googlesource.com/388551 Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 44ebf6b4 2016-09-22T13:00:02 ConstantUnion: Error on undefined shift. BUG=chromium:648135 Change-Id: I41581f63af650564a0f61c1baeeb38017c8513ed Reviewed-on: https://chromium-review.googlesource.com/387470 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei-Shao e292e902 2016-09-07T10:49:01 Workaround the unary minus operator issue on Intel On some Intel D3D drivers, evaluating unary minor operator on an integer variable may get wrong answer in vertex shader. This patch works around this bug by replacing -(int) with ~(int)+1 on Windows Intel. BUG=chromium:644033 Change-Id: I0af719e84d618a33f25bcb33bde0c381fb462a31 Reviewed-on: https://chromium-review.googlesource.com/381675 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5db69f57 2016-09-15T12:47:32 Add robust math to constant folding. Previously our multiplication and other operators could do overflows, which can lead to security bugs. BUG=chromium:637050 Change-Id: Icee22a87909e205b71bda1c5bc1627fcf5e26e90 Reviewed-on: https://chromium-review.googlesource.com/382678 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 509e4560 2016-08-25T14:55:44 compiler: Work around a HLSL compiler aliasing opt bug. BUG=angleproject:1448 Change-Id: I7d5bcbd100069152cea0cb03bc4fa6af1044460b Reviewed-on: https://chromium-review.googlesource.com/376020 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho ab481645 2016-08-26T12:09:10 Fix splitting nested sequence operators Make sure that only one sequence operator is split on one iteration of SplitSequenceOperator. This prevents multiple successive PostVisit calls to nested sequence operator nodes from adding duplicate nodes to the AST. The sequence operators are split starting from the outermost one to preserve execution order. Note that the shader translator somewhat unexpectedly generates nested sequence operators in the AST when there is a sequence operator with more than two operands, so this bug ended up affecting shaders in the wild. The code around parsing sequence operators could be clarified separately. BUG=638313 TEST=angle_end2end_tests Change-Id: Ic6400a484ceff0c790c2290f7b4b80980f87cd88 Reviewed-on: https://chromium-review.googlesource.com/376678 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 666f65a1 2016-08-26T01:34:37 Revert "Revert "Cover vector dynamic indexing case in SplitSequenceOperator"" This reverts commit d2f59bb6dda4f3548e158a09540829f9ff56bba4. Change-Id: If2842bce17a0c085e2bc913ff120083fbe90497c Reviewed-on: https://chromium-review.googlesource.com/376189 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d2f59bb6 2016-08-17T11:50:52 Revert "Cover vector dynamic indexing case in SplitSequenceOperator" This CL was causing inverted rendering in a WebGL application. This reverts commit 7da9850643f55335a13a4663d226c73d0ac4d3b1. Vectors or matrices that are dynamically indexed as a part of an l-value generate new statements in the RemoveDynamicIndexing AST transformation step. SplitSequenceOperator needs to detect this case and split the sequence operator before statements are generated from its operands to ensure the correct order of execution. BUG=angleproject:1341 TEST=angle_end2end_tests Change-Id: I854f8cce2d46107afa62f48edf3d32c6d5c97eda Reviewed-on: https://chromium-review.googlesource.com/371643 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6c9503ec 2016-08-16T14:06:32 D3D11: Improve integer pow workaround. A slight bug in the problem case detection applied the workaround overly-broadly. Also included a much more thorough test. BUG=angleproject:851 Change-Id: I5c09d67eee3622c144401769af85958f23b60c57 Reviewed-on: https://chromium-review.googlesource.com/371380 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5655b849 2016-08-02T11:00:07 D3D11: Fix integer pow workaround for nested pows. For some nested pow expressions, queueing two node replacements in the same tree traversal would mangle tree, resulting in invalid code. Fix this by iterating over the tree until no replacements are found, and doing one replacement each iteration. BUG=angleproject:851 Change-Id: Ie08ab23f4bfe3d5f32726856afc61ff1f3d6c789 Reviewed-on: https://chromium-review.googlesource.com/365400 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c9bde926 2016-07-24T17:58:50 D3D11: Allow gl_PointCoord when not rendering points. ANGLE D3D11 uses a geometry shader to expand points into quads. This led to an edge case with gl_PointCoord. When the user references gl_PointCoord in the fragment shader but renders with GL_TRIANGLES or other non-point primitives, gl_PointCoord is undefined, but ANGLE would produce a link error. This would break some very odd edge-case shaders (e.g. a shader that is used with both points and triangles). We can fix this by simply adding a dummy PointCoord value to our vertex shader is all cases. If the user renders points, we ignore the PointCoord value passed to the geometry shader. If they render tris or lines and use PointCoord, the shader signatures will match, and PointCoord will even have a sane value of (0.5, 0.5). BUG=angleproject:1380 Change-Id: I322155cd3801d0241cabc9bb639a5aaa502831b3 Reviewed-on: https://chromium-review.googlesource.com/362779 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 1048e43f 2016-07-23T18:51:28 D3D: Work around HLSL integer pow folding bug. BUG=angleproject:851 Change-Id: I68a47b8343a29e42c0a69ca3f2a6cb5054d03782 Reviewed-on: https://chromium-review.googlesource.com/362775 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 156d7197 2016-07-21T16:11:00 HLSL: Insert return statements into functions that are missing them. It's allowed to not have all code paths return a value in ESSL but the HLSL compiler detects this and generates an error. Work around this by adding dummy return statements at the end of each function that doesn't have one. TEST=deqp/data/gles2/shaders/functions.html BUG=angleproject:1015 BUG=478572 Change-Id: I2913f90f0994d4caf25cc43b16b9fc4e9efb19a5 Reviewed-on: https://chromium-review.googlesource.com/362085 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 7da98506 2016-07-20T18:45:09 Cover vector dynamic indexing case in SplitSequenceOperator Vectors or matrices that are dynamically indexed as a part of an l-value generate new statements in the RemoveDynamicIndexing AST transformation step. SplitSequenceOperator needs to detect this case and split the sequence operator before statements are generated from its operands to ensure the correct order of execution. BUG=angleproject:1341 TEST=angle_end2end_tests Change-Id: I84e41a59c88fb5d0111669cab60312b930531a22 Reviewed-on: https://chromium-review.googlesource.com/361695 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho e1d199bb 2016-07-19T17:14:27 Split sequence operator when necessary Split sequence operators if some of their operands generate statements in subsequent AST transformations to guarantee the right order of execution. For now, this is supported for expressions that return arrays and unfolded short-circuiting operators, which is enough to get WebGL 2 tests passing. A trickier corner case with dynamic indexing of vectors as an l-value is left to be addressed later. BUG=angleproject:1341 TEST=angle_end2end_tests, WebGL 2 conformance test: conformance2/glsl3/array-in-complex-expression.html Change-Id: I9301edd3366be7607a8aa4c42a5ec13928749e10 Reviewed-on: https://chromium-review.googlesource.com/361694 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez b00dcee4 2016-07-11T17:42:58 TranslatorGLSL/ESSL: Output #pragma before #extension The Intel Mesa driver considers the #pragma directive to be a non-preprocessor token which makes shaders fail compilation. The relevant blurb from the spec is: "the extension directives must occur before any non-preprocessor tokens" BUG=627417 Change-Id: Ic22cff49a9f9c1fe5d140302581ca7b36688732c Reviewed-on: https://chromium-review.googlesource.com/359621 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Corentin Wallez 419bfc91 2016-06-28T10:54:45 On Desktop GL, require index-constant sampler array indexing BUG=598924 Change-Id: If97dbaa782595997b815c70d14f079e0f0c3d82a Reviewed-on: https://chromium-review.googlesource.com/356710 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Yuly Novikov 41db2245 2016-06-25T00:14:28 Skip GLSLTest_ES3.InitGlobalArrayWithArrayIndexing on Adreno Android GLES Due to Adreno compilation failure of two arrays in single line declaration. BUG=angleproject:1428 TEST=GLSLTest_ES3.InitGlobalArrayWithArrayIndexing Change-Id: I05d7c6b3a0eef8c879edf4d9cf24cdec0a2a403c Reviewed-on: https://chromium-review.googlesource.com/356217 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez c7f59d02 2016-06-20T10:12:08 Suppress a Wintel/OpenGL failure on a new test. BUG=angleproject:1388 Change-Id: I4d346ca3c6914e56055aa6492d9d013634a1b9ad Reviewed-on: https://chromium-review.googlesource.com/353693 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yuly Novikov a1f6dc95 2016-06-15T23:27:04 Varying invariance must match between shaders in ESSL 1.00 While in ESSL 3.00 invariant is allowed only for out varyings. Verify that, and update test expectations. BUG=angleproject:1293 TEST=GLSLTest*.Invariant* Change-Id: I5cab6c68f2b94ea2179719119668d905fe7a9b3d Reviewed-on: https://chromium-review.googlesource.com/352743 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Yuly Novikov cfa48d37 2016-06-15T22:14:36 Shader versions must match. Per GLSL_ES_Specification_3.00.4 paragraph 3.3 Version Declaration: "Shaders declaring version 3.00 of the shading language cannot be linked with shaders declaring version 1.00." BUG=angleproject:1361 TEST=GLSLTest_ES3.VersionMismatch Change-Id: Icee672b798dcdb41a189e4a6459c4e643daf1fa6 Reviewed-on: https://chromium-review.googlesource.com/353182 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Olli Etuaho d4f4c11b 2016-04-15T15:11:24 Fix deferring global array initialization The initial implementation of DeferGlobalInitializers did not take HLSL corner cases into account. In particular, in case there was a const-qualified array variable with an initializer that contained elements that weren't constant folded, initialization would not be deferred and the global scope of HLSL output would contain a call to angle_construct_into_*(). On the other hand, deferring global initializers was also done in cases where it wasn't necessary. Initializers of non-const qualified array variables that could be written as HLSL literals by HLSL output were unnecessarily deferred. This patch fixes both of these issues: Now all global initializers are potential candidates for deferral instead of just those where the symbol has the EvqGlobal qualifier, and initializers that are constructors taking only constant unions as parameters are not unnecessarily deferred. BUG=angleproject:1205 BUG=541551 TEST=angle_end2end_tests Change-Id: I4027059e0e5f39c8a5a48b5c97a3fceaac6b6f8a Reviewed-on: https://chromium-review.googlesource.com/339201 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 9a9c0484 2016-04-12T10:36:25 Lexer: Error out on invalid field start. When parsing something like x.} the following would happen: - Parsing "." the lexer would move to the FIELDS start condition - Parsing } the lexer wouldn't find any <FIELDS> rule matching - The parser would fall back to <*>. that was asserted unreachable. The fix is to add a <FIELDS>. rule to catch bad field starts BUG=angleproject:1352 Change-Id: I262d2b9ef5f7346c19ae5e19a173e24f40f2f600 Reviewed-on: https://chromium-review.googlesource.com/338222 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho be59c2fb 2016-03-07T11:32:34 Fix ambiguous function call issues in HLSL output D3D compiler can't resolve between these overloaded functions: float4 vec4(float2x2 x0); float4 vec4(float4 x0); Include the parameter types in the function name to disambiguate between overloaded user-defined functions and constructors, like this: float4 vec4_float2x2(float2x2 x0); float4 vec4_float4(float4 x0); This is only done for float2x2 and float4 parameters, other parameter types like float2x3 vs. float3x2 don't need this. BUG=angleproject:1099 BUG=angleproject:1030 TEST=angle_end2end_tests, dEQP-GLES3.functional.attribute_location.* (10 more tests pass), dEQP-GLES2.functional.attribute_location.* Change-Id: Ief047d41b0adbc238393c3c13cb29771cbb83d58 Reviewed-on: https://chromium-review.googlesource.com/329882 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 518b9fab 2016-03-02T11:26:02 Suppress some failing end2end_tests on Intel. BUG=589851 Change-Id: Ia580cee30e6842aaddb4683025f425166f0f6120 Reviewed-on: https://chromium-review.googlesource.com/329735 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill f09bf669 2016-03-02T11:26:01 Revert "Suppress some failing end2end_tests on Intel." This reverts commit 7208f6994cf7d810c2226965362aad43d2a66f53. Still some failures on Intel, requires a slightly different solution. BUG=589851 Change-Id: I6ac6599249e9e0f6319c917e04734cd48ca9274d Reviewed-on: https://chromium-review.googlesource.com/329734 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7208f699 2016-02-29T10:47:35 Suppress some failing end2end_tests on Intel. BUG=589851 Change-Id: I91588014784a8a9b75389aeb596923458c30d80a Reviewed-on: https://chromium-review.googlesource.com/329427 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 5103f4c0 2016-01-26T11:40:18 Supress AMD OpenGL failures in angle_end2end_tests. BUG=angleproject:1291 Change-Id: I4fc8cc152bb5ef18fff78bf312a14691e9de0243 Reviewed-on: https://chromium-review.googlesource.com/324030 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 69accbd1 2016-01-25T16:22:32 Supress Mac OpenGL AMD angle_end2end_test failures. BUG=angleproject:1291 Change-Id: I7fe6a6203c71c893dad97d6e9bc8272164d44f58 Reviewed-on: https://chromium-review.googlesource.com/323790 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang e0cc2a4a 2016-01-20T10:58:17 Enable all angle_end2end_tests targeting OpenGL and OpenGL ES backends. Added failure supressions and filed bugs for failing tests. BUG=angleproject:1145 BUG=angleproject:1289 BUG=angleproject:1291 BUG=angleproject:1292 BUG=angleproject:1293 BUG=angleproject:1296 Change-Id: Ida78ba855500fe8a6ce6154d43ee01520330e3b1 Reviewed-on: https://chromium-review.googlesource.com/322695 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill 9fc3682c 2015-11-18T13:08:07 D3D: Rework varying packing code. In D3D we pack varyings by making a register map, and using the recommended GLSL ES algorithm to reserve register space. We use this map to assign row and column slots to each varying and then produce a semantic index value. The existing scheme had a number of bugs, and was failing several angle_end2end_tests. The new design cleans up the code somewhat and uses a different counting scheme for the semantic indexes: just sort the varyings in packing order and use a simple incrementing semantic index per varying. In SM4+, the HLSL compiler sorts and packs the varyings correctly itself, and in SM3, handle the cases we don't support by returning an error instead of a D3D compiler link error. Also refactor how we store varying information for TF Feedback/ StreamOut. Only store the necessary D3D information, instead of extra information like the name and type. This fixes several tests in GLSLTest/*. This also will allow us to fix interpolation qualifier packing and the structure packing in HLSL, which seems to work differently than the rest of the varying types. BUG=angleproject:1202 TEST=bots,dEQP-GLES3.functional.transform_feedback.* Change-Id: Ie5bfbb4f71d8bf97f39115fc46d2e61b131df639 Reviewed-on: https://chromium-review.googlesource.com/311241 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Austin Kinross 7a3e8e24 2015-10-08T15:50:06 Don't include samplers in uniform vector count validation Change-Id: Id2820643b70d3266c82eb10a5f05d3a5886e9323 Reviewed-on: https://chromium-review.googlesource.com/304871 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Austin Kinross <aukinros@microsoft.com>
Corentin Wallez f0ca9a0c 2015-09-14T11:53:10 Remove the usage of some c++11 library features That were causing compilation error in Chromium Mac builds BUG=angleproject:891 Change-Id: I45777451b300928e8c8d232a5b7ecffa7f1c3cbe Reviewed-on: https://chromium-review.googlesource.com/299721 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Cooper Partin 69f9b2c8 2015-08-20T13:25:41 Fixed GL_MAX_VERTEX_UNIFORM_VECTORS and GL_MAX_FRAGMENT_UNIFORM_VECTORS to report accurate maximum value. Change-Id: Ic581e1ef0c6be2bf1ff0092b373b3c480b6fbd8a Reviewed-on: https://chromium-review.googlesource.com/294755 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Cooper Partin <coopp@microsoft.com> Tryjob-Request: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 814a54dd 2015-08-27T16:23:09 Force index/loop validation on the D3D9 backend D3D9 shader models have limited support for looping, so the Appendix A index/loop limitations are necessary. This is consistent with applying the limitations on D3D9_3 feature level and lower of the D3D11 backend too. Also, when the limitations are not in place, a workaround for dynamic indexing of vectors and matrices will be applied. This workaround does not work on the D3D9 backend, as demonstrated with some WebGL conformance failures caused by it in Chrome on D3D9. BUG=525188 TEST=angle_end2end_tests Change-Id: I6411594f067f2740f55d7560427026b23b15dac7 Reviewed-on: https://chromium-review.googlesource.com/296940 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Cooper Partin a5ef8d89 2015-08-19T14:52:21 Enabled loop indexing validation for fragment shaders compiled using renderers configured for FL9_3 and below. BUG=angleproject:1130 Change-Id: I2b5d7091c394565354b14fbf9297276dce8d92a5 Reviewed-on: https://chromium-review.googlesource.com/294733 Tested-by: Cooper Partin <coopp@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Cooper Partin 4d61f7ed 2015-08-12T10:56:50 Reland Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data' Additional warnings found with more testing and added C4267 warning disable only for angle_libpng BUG=angleproject:1120 Change-Id: Ic403dcff5a8018056fa51a8c408e64207f3362eb Reviewed-on: https://chromium-review.googlesource.com/293028 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Austin Kinross 02df796f 2015-07-01T10:03:42 Centralize renderer limitations for non-conformant renderers Some renderer configurations (e.g. D3D11 Feature Level 9_3) have some limitations and aren't quite conformant. This change generates errors when applications hit these limitations, and informs developers that they must work around them. BUG=angleproject:1055 Change-Id: I6a4a9e5cc71288ca366a54c769ca0eb82e79a7f7 Reviewed-on: https://chromium-review.googlesource.com/282814 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang dd323e95 2015-06-09T15:16:31 Only run tests that the current hardware can support. For each config, determine if a context can be created at test instantiation time. This allows skipping of ES3 tests when the hardware does not support ES3. Updated the perf_tests to use the EGLPlatformParameters struct so that they can be filtered in the same way. Change-Id: If664604b057cec4005eb4b63bebd83cd4964b7b2 Reviewed-on: https://chromium-review.googlesource.com/276460 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 08a8438f 2015-05-20T14:08:07 Remove un-needed swapBuffers calls in the tests. If a glReadPixels is done after a swapBuffers, it's results are often undefined. bug=angleproject:967 Change-Id: I4a99ca47624347ecbc0a5c084e93b997c92e1b31 Reviewed-on: https://chromium-review.googlesource.com/272423 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Corentin Wallez d3970de4 2015-05-14T11:07:48 Move ANGLETest back in test_utils, leaving a proxy header for Chromium BUG=angleproject:892 Change-Id: Ibd494813be87e996096077d6e208cc92461b8f49 Reviewed-on: https://chromium-review.googlesource.com/271154 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho b0c645e2 2015-05-12T14:25:36 Validate global initializer qualifiers Allow only constants, other globals, temporaries, and uniforms to be used in global variable initialization for now. The spec limits global variable initialization further to only constant expressions, but fully implementing this has a too large compatibility cost for ESSL 1.00, so implement it only partially. In the case of ESSL 3.00 we can use stricter validation, since there's no legacy to worry about. Resubmitting the change, since the previous version neglected to remove incorrect GLSL tests. TEST=angle_unittests, WebGL conformance tests, angle_end2end_tests BUG=angleproject:988 Change-Id: I1bb3b8dc305689a90eadfe8cc7705e5ac3829e03 Reviewed-on: https://chromium-review.googlesource.com/270651 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez ac3ab882 2015-05-12T13:31:28 Temporarily move back ANGLETest in end2end_tests This path needs to a Chrome change before it can change. BUG=angleproject:892 Change-Id: I549737383b9720a2e7d83ee5e3145d71716f04cb Reviewed-on: https://chromium-review.googlesource.com/270457 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 973402fd 2015-05-11T13:42:22 Compile end2end tests on Linux BUG=angleproject:892 Change-Id: Id4a9ddc35ae9600080e743c77476d36743a3e646 Reviewed-on: https://chromium-review.googlesource.com/270199 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/270412
Jamie Madill e45b7458 2015-05-12T15:46:28 Revert "Compile end2end tests on Linux" Build errors in Chromium: ninja: Entering directory `C:\b\build\slave\GPU_Win_Builder\build\src\out\Release' ninja: error: '../../gpu/egl_tests/EGLQueryContextTest.cpp', needed by 'obj/gpu/egl_tests/angle_end2end_tests.EGLQueryContextTest.obj', missing and no known rule to make it This reverts commit be39156b10bf56686b03b274046e51ef156283fc. Change-Id: I931295f16cad096e94baac9811ea2396a4182848 Reviewed-on: https://chromium-review.googlesource.com/270347 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>