src/tests/compiler_tests/DebugShaderPrecision_test.cpp


Log

Author Commit Date CI Message
Jamie Madill 273175cd 2019-09-24T08:44:09 Fix Regex in DebugShaderPrecisionTest. One regex had an extra parenthesis. Also confirms that we can use raw string literals to produce more readable regexes. Bug: angleproject:3162 Change-Id: I82e6bc622a8fa3d9f6424c53cb7dcb4dddde368a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1821938 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
shrekshao 7964101c 2019-07-09T09:07:32 Fix regex parenthesis missing escaping backslash Bug: angleproject:3668 Change-Id: Iaf529a5a50d1ab040f016fae0ea9bd3129a8fd6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1692625 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
shrekshao be3d2d98 2019-06-25T17:52:17 More HLSL tests with regex Replace some more HLSL hardcoded unique id tests suffix with regex Bug: angleproject:3551 Change-Id: I4ed54092f9b2dda27702ba9412959ec3fb93a455 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1677408 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
shrekshao b937093e 2019-06-21T11:02:17 HLSL tests with regex HLSL adds a unique id suffix to user defined variable and these numbers are currently hardcoded in tests. It could easily fail if new tokens are added to angle builtin variables. Introduce C++11 regex feature into the foundInHLSLCode to avoid over strict tests. Bug: angleproject:3551 Change-Id: Ia3052afec667a7ac11198be31b5c1d03c856a723 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1670581 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shrek Shao <shrekshao@google.com>
Natasha Lee 75d577fb 2019-02-04T16:28:28 Fixed Bug where array initialized with same name of previously declared variable fails on DirectX. Combined user defined variables with their unique ids to avoid overwriting same name variables of different scope. Bug: angleproject:2126 Change-Id: If9ad9e48f629d83b105d43ee28a50b8176d0e0a1 Reviewed-on: https://chromium-review.googlesource.com/c/1456484 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Olli Etuaho 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 c634a637 2017-05-18T14:09:49 Remove webgl_ prefix from emulated function names The prefix is unnecessary now that user-defined names are prefixed in both GLSL and HLSL output. Removing the prefix makes compiler output a bit simpler to read. BUG=angleproject:2038 TEST=angle_unittests Change-Id: I9ffc508f50d6146a2d85798875c88e2c385b83fe Reviewed-on: https://chromium-review.googlesource.com/508730 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 855d964b 2017-05-17T14:05:06 Prefix user-defined names in GLSL output Now user-defined names are prefixed by _u in GLSL output in case name hashing is not on. Internal names such as names of temporary variables created in AST transformations are written out as such. This makes handling of internal function names and internal variable names consistent. It also removes the possibility of name conflicts between user-defined names and internal names in case name hashing is not on. In the same vein, it makes it safe to use GLSL reserved words that are not reserved in ESSL as variable names in case name hashing is not on. This also makes the GLSL output more consistent with how names are handled in HLSL output. Name hashing code is shared between VariableInfo and OutputGLSLBase to ensure names are handled consistently in both. The name that's used in the shader source for a given interface variable is written out to ShaderVariable::mappedName. An exception needs to be made for identifiers close to the length limit, since adding any prefix would take them over the limit. But they can be just written out as such, since we don't have any builtins or ANGLE internal variables that have as long names and could create a conflict. BUG=angleproject:2139 BUG=angleproject:2038 TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests Change-Id: Id6ed052c4fab2d091227dc9a3668083053b67a38 Reviewed-on: https://chromium-review.googlesource.com/507647 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 a22aa4ed 2017-05-24T18:17:23 Mark some internal functions as not having side effects Precision emulation rounding function calls and vector/matrix dynamic indexing function calls now get a flag that indicates that running the function body does not have side effects. This avoids triggering asserts in OutputHLSL when these internal function calls end up on the right hand side of a non-unfolded logical operator. BUG=chromium:724870 TEST=angle_unittests Change-Id: Id1a2b6b744f6a04c6cdb86a8f4109ccc12bc70b9 Reviewed-on: https://chromium-review.googlesource.com/516705 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 19ecebe7 2017-05-24T16:44:42 Fix compound assignment precision emulation Precision emulation for compound assignment used to set the wrong type for the compound assignment nodes, which could cause an assert to trigger. The wrong rounding function was also being called in the lowp rounded compound assignment function. BUG=chromium:699479 TEST=angle_unittests Change-Id: I60b4cb3bf1830e8249511c13037348bb2423e5b9 Reviewed-on: https://chromium-review.googlesource.com/514045 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7854d861 2017-05-09T14:29:15 EmulatePrecision: Round constructor args only when needed Constructor arguments don't need to be rounded if the constructor result will be rounded to the same precision. This will make precision emulated shaders slightly faster to execute in some cases. BUG=angleproject:874 TEST=angle_unittests Change-Id: I4220cd2289c97dcf5b7a25a4cbdd18487947c2d2 Reviewed-on: https://chromium-review.googlesource.com/500288 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 45bcc784 2016-11-07T13:58:48 translator: Scope all classes with "sh". I was seeing an odd problem with our PoolAlloc conflicting with the glslang/Vulkan TIntermNode, so the fix was to move everything to a separate namespace. The bison grammars are also regenerated. No functional changes. BUG=angleproject:1576 Change-Id: I959c7afe4c092f0d458432c07b4dcee4d39513f3 Reviewed-on: https://chromium-review.googlesource.com/408267 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill acb4b81a 2016-11-07T13:50:29 translator: Put ShaderLang APIs in "sh" namespace. Working with glslang in Vulkan means we are static linking libANGLE with functions that have the same name as our translator APIs. We can fix this by scoping our APIs. We don't need to scope the types of the file, since they don't conflict. This will require a follow-up patch to remove the unscoped APIs once we switch over Chromium. We also scope TCompiler and some related classes to avoid multiply defined link errors with glslang. BUG=angleproject:1576 Change-Id: I729b19467d2ff7d374a82044b16dbebdf2dc8f16 Reviewed-on: https://chromium-review.googlesource.com/408337 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d569619d 2016-10-06T11:09:24 translator: Fail compilation if precision emu unsupported. The fuzzer uncovered a case where we were trying to emulate precision on HLSL 3.0, causing an ASSERT crash. BUG=chromium:653276 Change-Id: I2e666a1ff4f605541e25f04264146063559cb835 Reviewed-on: https://chromium-review.googlesource.com/394237 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho b741c761 2016-06-29T15:49:22 Support precision emulation on HLSL Re-submit with missing virtual destructor and angle::NonCopyable added. Add precision emulation support to HLSL 4.1 output. This makes it possible for developers to test their shaders for precision issues easily on Chrome on Windows without having to use the GL backend. The patch has been verified with Chrome on Windows to reproduce some precision bugs in real-world WebGL content, including old versions of the babylon.js library. The EmulatePrecision AST transformation still relies on writing out raw shader code for the rounding functions, with raw HLSL code added alongside pre-existing GLSL and ESSL code. In some ways it would be nicer to do the EmulatePrecision step as a pure AST transformation, but on the other hand the raw code is much more readable and easier to optimize. To better support multiple output languages in EmulatePrecision, add a RoundingHelperWriter class that has different subclasses for writing the rounding functions in different languages. The unit tests are expanded to cover the HLSL output of precision emulation. The parts of the tests that require the HLSL output are only active on Windows where ANGLE_ENABLE_HLSL define is added to the unit tests. Putting the HLSL tests in an entirely separate file is a worse alternative, since it would require either a lot of code duplication or add a lot of boilerplate to the individual tests. BUG=angleproject:1437 TEST=angle_unittests Change-Id: I47d501037c206f4bd8b976d3acab9b21c717084c Reviewed-on: https://chromium-review.googlesource.com/360152 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3fdaf6f2 2016-07-13T15:07:41 Revert "Support precision emulation on HLSL" Forgot to add virtual destructors. BUG=angleproject:1437 This reverts commit a42e8b2cb9d0857f53c0490b5be3bf25b4e1f827. Change-Id: If33fecfeca9947deedf4668c64dbadf25a5dc5eb Reviewed-on: https://chromium-review.googlesource.com/360122 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho a42e8b2c 2016-06-29T15:49:22 Support precision emulation on HLSL Add precision emulation support to HLSL 4.1 output. This makes it possible for developers to test their shaders for precision issues easily on Chrome on Windows without having to use the GL backend. The patch has been verified with Chrome on Windows to reproduce some precision bugs in real-world WebGL content, including old versions of the babylon.js library. The EmulatePrecision AST transformation still relies on writing out raw shader code for the rounding functions, with raw HLSL code added alongside pre-existing GLSL and ESSL code. In some ways it would be nicer to do the EmulatePrecision step as a pure AST transformation, but on the other hand the raw code is much more readable and easier to optimize. To better support multiple output languages in EmulatePrecision, add a RoundingHelperWriter class that has different subclasses for writing the rounding functions in different languages. The unit tests are expanded to cover the HLSL output of precision emulation. The parts of the tests that require the HLSL output are only active on Windows where ANGLE_ENABLE_HLSL define is added to the unit tests. Putting the HLSL tests in an entirely separate file is a worse alternative, since it would require either a lot of code duplication or add a lot of boilerplate to the individual tests. BUG=angleproject:1437 TEST=angle_unittests Change-Id: Ia4ba0374cd415908f16f34752321af1cb93525a5 Reviewed-on: https://chromium-review.googlesource.com/358473 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 61b81acf 2016-06-28T14:15:20 Support non-square matrices in precision emulation In case the shader version is greater than ESSL 1.00, the precision emulation needs to output rounding functions for non-square matrix types. Writing emulated compound assignment functions for non-square matrices already had most of the code in place before this change. New compound assignment operators like >>= don't need floating point precision emulation in ESSL 3.00, since all of them only operate on integers. BUG=angleproject:1434 TEST=angle_unittests Change-Id: I4678f511edf4f9f744fe23bb8d7dab4387f07f20 Reviewed-on: https://chromium-review.googlesource.com/358472 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 10fcd9be 2016-06-30T12:24:09 Add a helper class for compiler string matching tests The MatchOutputCodeTest class makes it easier to implement tests that do string matching on compiler output. Inheriting test classes set the compiler settings, tests then call compile() with the shader string and can call foundInCode() to check if the output code contains a given string. Various compiler unit tests that already did string matching are refactored to make use of this new helper class. Some tests now use SH_GLES3_SPEC instead of SH_GLES2_SPEC - this should not have a significant impact on test coverage. Some compileTestShader function variants that are now unused can be removed from the code. BUG=angleproject:1430 TEST=angle_unittests Change-Id: I1fd3529d5a1c6ab192f95ace800cf162604e68e7 Reviewed-on: https://chromium-review.googlesource.com/357800 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 217fe6ec 2015-08-05T13:25:08 Detect when built-in modf requires an l-value in AST traversal This fixes an omission that out parameter tracking had inherited from EmulatePrecision. Accurate tracking of when values are written is required for converting dynamic indexing of vectors and matrices to function calls. A new test covering this is added to angle_unittests. TEST=angle_unittests BUG=angleproject:1116 Change-Id: I05c5fd60355117d0053b84110748ae221375a790 Reviewed-on: https://chromium-review.googlesource.com/290562 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 8afe1e1b 2015-08-05T18:00:01 Track that indices of l-values are not required to be l-values In an expression like a[ind]++, a[ind] is required to be an l-value but ind is not. Reset the l-value required flags before traversing the index of an indexing operation, so that this is accurately tracked. After the index has been traversed, the previous state of the l-value required flags is restored. New tests are added to angle_unittests cover this functionality. TEST=angle_unittests BUG=angleproject:1116 Change-Id: I8929ec01e85e672c83ef7d385e455b7df8682f4b Reviewed-on: https://chromium-review.googlesource.com/290561 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7adfb184 2015-06-09T15:49:41 Refactor common compiler test functionality into helper functions Refactor translating a ESSL shader string into a target language so that compiler initialization and cleanup code can be reused between test classes. BUG=angleproject:817 TEST=angle_unittests Change-Id: Idb229dceb9e17b13ed6ad2a68ab55ed5c968780e Reviewed-on: https://chromium-review.googlesource.com/275814 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ecbfc5c6 2015-03-23T15:15:59 Fix formatting in compiler tests Remove extraneous semicolons and fix indentation in a couple of places. TEST=angle_unittests Change-Id: Iaa51eb50990c0435f41dfd346ec161216cd8d372 Reviewed-on: https://chromium-review.googlesource.com/261823 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 559a2e8c 2015-03-16T17:25:51 Move the ANGLE tests project to src/ *re-re-land with fix for Chrome's angle tests* BUG=angleproject:945 Change-Id: I3c64e2edc776c299791440f65f22450855eb6dfa Reviewed-on: https://chromium-review.googlesource.com/260448 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 96e3f556 2015-03-16T21:24:20 Revert "Move the ANGLE tests project to src/" Still causing build issues on Chrome. This reverts commit 64a3b2a92fe3bbd28972638e6759fae0b98d81b9. Change-Id: I8d40fe3dfd0a877343357153a02b8ef66d571c64 Reviewed-on: https://chromium-review.googlesource.com/260425 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 64a3b2a9 2015-03-16T11:00:20 Move the ANGLE tests project to src/ *re-land with fix for Chromium build* BUG=angleproject:945 Change-Id: I82bff1760e681987fb26e479734aa62fb845898a Reviewed-on: https://chromium-review.googlesource.com/260362 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 5491fe66 2015-03-16T17:56:18 Revert "Move the ANGLE tests project to src/" Causing build break in Chromium. This reverts commit 71c2d85c4af2f6cb213d4f3e15f0ae16b63790f3. Change-Id: Iedf001c1f4c60a759f69009610fbce978d193d17 Reviewed-on: https://chromium-review.googlesource.com/260370 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 71c2d85c 2015-03-16T10:47:04 Move the ANGLE tests project to src/ BUG=angleproject:945 Change-Id: I2eb44ac43f65b916ddd838d39e6aae62580d7fa0 Reviewed-on: https://chromium-review.googlesource.com/258903 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org>