src/tests/compiler_tests/DebugShaderPrecision_test.cpp


Log

Author Commit Date CI Message
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>