src/tests/compiler_tests/WEBGL_multiview_test.cpp


Log

Author Commit Date CI Message
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 da41ac69 2018-07-19T16:45:32 Fix decorating ViewID_OVR in HLSL output ViewID_OVR should not be decorated in HLSL output since it is an internal variable. Make sure that DecorateVariableIfNeeded() is used for varyings instead of just Decorate() so that the internalness is checked correctly and ViewID_OVR doesn't get decorated. This avoids possible name conflicts between the internal ViewID_OVR and any user-defined variables named ViewID_OVR. BUG=angleproject:2062 TEST=angle_end2end_tests, angle_unittests Change-Id: I9ed9876d4b2c760e7a11b0b270a2190993e840e5 Reviewed-on: https://chromium-review.googlesource.com/1143398 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho c26214de 2018-03-16T10:43:11 Move AST utilities to a subdirectory Move AST related utilities to compiler/translator/tree_util. BUG=angleproject:2409 TEST=angle_unittests Change-Id: I7567c2f6f2710292029263257c7ac26e2a144ac8 Reviewed-on: https://chromium-review.googlesource.com/966032 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jiawei Shao e41df655 2018-02-09T14:31:39 ES31: Add shader version check for CS and GS This patch adds the missing check on the shader version for compute and geometry shaders, which can fix a bug that ANGLE GLSL compiler doesn't report a compile error when compiling an empty compute or geometry shader in version 100 or 300. This patch also updates the original compiler tests on the check of shader version. In these tests, the compile errors are all caused by illegal layouts instead of shader versions, which is against the purpose of the tests. This patch also fixes an incorrect case that used an empty compute shader in version 300. BUG=angleproject:1442, angleproject:1941 TEST=angle_unittests Change-Id: Ic26bb8eb312dbc0cec6a879997d0ae7a2e625a0f Reviewed-on: https://chromium-review.googlesource.com/910715 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho fbb1c792 2018-01-19T16:26:59 Store symbol names as a ImmutableString This will enable compile-time initialization of built-in symbols as well as reducing copying strings. Most of the code that deals with names is changed to use ImmutableString where it makes sense to avoid conversions. The lexer/parser now allocate const char pointers into pool memory instead of allocating TStrings. These are then converted to ImmutableString upon entering TParseContext. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: I244d6271ea1ecf7150d4f89dfa388a7745a1150c Reviewed-on: https://chromium-review.googlesource.com/881561 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 8b5e8fdb 2017-12-15T14:59:15 Replace remaining usage of TName with TSymbol TName used to contain just a subset of the information stored in TSymbol. It makes more sense to use TSymbol directly instead of converting it to TName. This also improves type safety a bit by making some functions only take in TVariable or TFunction instead of the more generic TName. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Icb46923c25d33ebbbbc06ddc487da25957dda771 Reviewed-on: https://chromium-review.googlesource.com/829143 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ebe13bb1 2017-12-11T13:32:44 Remove SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM Instanced multiview is fully implemented and performs much better than broadcasting draw calls on the CPU. There's no need to maintain translating ViewID_OVR to a uniform. BUG=angleproject:2267 TEST=angle_unittests Change-Id: If3a8fa573f37b7926c052aecfcd4271f266751dc Reviewed-on: https://chromium-review.googlesource.com/819417 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho fdb400d7 2017-12-01T15:12:36 Test multiview extension warning Ensure that a warning is generated if the shader tries to set a global layout qualifier. Since a num_views layout qualifier is the only valid global layout qualifier in GLSL ES 1.00, it's sufficient that checkCanUseExtension() that generates the warning is called for "num_views" specifically. Parsing "layout" or "in" storage qualifier may use the simpler isExtensionEnabled() check that doesn't generate a warning. BUG=angleproject:2238 TEST=angle_unittests Change-Id: I19caff7be9cb4f53c581b5f5526b7cade08469d6 Reviewed-on: https://chromium-review.googlesource.com/803577 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 18841310 2017-11-28T12:48:47 Clean up MatchOutputCodeTest usage It's cleaner to use a generic function to test that a sequence of strings is found in a specific order rather than fetching and comparing string locations in test case code. Also make sure that string occurrences can't overlap when looking for a specific number of occurrences of the same string. TEST=angle_unittests Change-Id: I8ca66c73c7aaa5be8469ded466f51d97a36c801b Reviewed-on: https://chromium-review.googlesource.com/793041 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
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 ec3a9cbb 2017-09-07T12:18:01 Only support GL_OVR_multiview extension variant The WebGL spec proposal was changed so that only GL_OVR_multiview extension name is supported, instead of having two variants OVR_multiview and OVR_multiview2. We're only supporting the WebGL version of the shader extension, so we drop compiler support for GL_OVR_multiview2. Shader restrictions were also removed from the WebGL spec, so no special validation for how ViewID_OVR gets used is needed. Tests that were testing for the shader restrictions are either removed or changed from negative tests to positive tests. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I83f92b879376d41b727b5aca419fd75fb6f53477 Reviewed-on: https://chromium-review.googlesource.com/654608 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev 15c3406a 2017-09-07T17:10:09 Restructure InstanceID initialization to fix HLSL warning This patch casts gl_InstanceID to uint before doing division by the number of views to circumvent the HLSL compiler's warning on performance degradation. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I326530ee112f34f82becdec5239edd5054c4104f Reviewed-on: https://chromium-review.googlesource.com/655298 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
Martin Radev 4e619f58 2017-08-09T11:50:06 Add branch for viewport or layer selection in VS The patch extends the behavior of SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER so that either the viewport or layer is selected based on the value of the internal uniform variable MultiviewRenderPath. BUG=angleproject:2062 TEST=angle_end2end_tests TEST=angle_unittests Change-Id: Ia311b12b1fed642dac78eba8732e2535242f34fd Reviewed-on: https://chromium-review.googlesource.com/615260 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev c39a19aa 2017-07-07T18:52:09 Select viewport index in the GLSL/ESSL vertex shader The patch enables viewport selection for multiview rendering in the GLSL/ESSL vertex shader through the use of the GL_NV_viewport_array2 extension. The AST is modified only for GLSL and ESSL to include the viewport selection expression after ViewID_OVR's initialization. BUG=angleproject:2062 TEST=angle_unittests Change-Id: Iee05bb5a4b687ed53ddbdd466f1572227b1f0cde
Martin Radev 7ef89a42 2017-07-05T14:23:06 Expose ViewID_OVR impostor in the fragment shader The OVR_multiview specification states that gl_ViewID_OVR is visible at each pipeline stage. Previously to this patch the ViewID_OVR impostor was declared only in the vertex shader and occurrences of gl_ViewID_OVR in the fragment shader were not being handled. The patch addresses the issue by declaring the ViewID_OVR variable as a vertex output in the vertex shader and as a fragment input in the fragment shader. BUG=angleproject:2062 TEST=angle_unittests Change-Id: I895953e81d3632d9bb873e8ac081fdf36f63f6b7 Reviewed-on: https://chromium-review.googlesource.com/559337 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho cccf2b00 2017-07-05T14:50:54 Reorganize AST traversal utility code Define TIntermTraverser and TIntermLValueTrackingTraverser in a separate header file. hash() function is moved out from TIntermTraverser as it is not related to the core functionality of traversing and transforming ASTs. Also reorganize some traversers to follow common conventions: - Intermediate output is now in OutputTree.h/.cpp - Max tree depth check is now in IsASTDepthBelowLimit.h/.cpp BUG=angleproject:1490 TEST=angle_unittests Change-Id: Id4968aa9d4e24d0c5bac90dc147fc9f310de0184 Reviewed-on: https://chromium-review.googlesource.com/559531 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev 115fc55e 2017-07-05T17:11:06 Populate gl_InstanceID attribute information explicitly While compiling ESSL1 shaders, with the compiler having both SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW and SH_VARIABLES set, variable collection terminates with an assertion failure. The reason behind this is that SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW adds gl_InstanceID to the AST to initialize the multiview builtins, but the variable collection pass cannot find gl_InstanceID information in the symbol table because the builtin is only available in ESSL 3.00 and greater. To address this the patch populates the gl_InstanceID attribute information explicitly in the variable collection pass instead of retrieving it from the symbol table. BUG=angleproject:2062 TEST=angle_unittests Change-Id: I5ecb9967ebe6658e956d17a2637090f9b685ef33 Reviewed-on: https://chromium-review.googlesource.com/559669 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev 0cdf3683 2017-07-05T14:02:08 Do not propagate OVR_multiview extension directive The patch fixes the bug of having the OVR_multiview extension directive being outputted by the ESSL translator whenever the SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW option is enabled. The directive should not be outputted because the extension is emulated through that option. BUG=angleproject:2062 TEST=angle_unittests Change-Id: I95d0a651ace6db42d496de08e774ec7ceca4c197 Reviewed-on: https://chromium-review.googlesource.com/558981 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev 69056a1e 2017-05-18T11:14:50 Declare and initialize ViewID_OVR and InstanceID The patch modifies the vertex shader's AST to declare and initialize the global variables ViewID_OVR and InstanceID. Every occurrence of gl_ViewID_OVR gets replaced by ViewID_OVR and initialized in main with a value dependent on gl_InstanceID and the number of views. To guarantee correct results for instanced rendering, each occurrence of gl_InstanceID is replaced with InstanceID and initialized similarly. BUG=angleproject:2062 TEST=angle_unittests Change-Id: I48be688605b5af869bc370758e70ccc209ea4419 Reviewed-on: https://chromium-review.googlesource.com/548596 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 95468d17 2017-05-04T11:14:34 Support multiview in ESSL 1.00 shaders Support is added according to the proposal for WEBGL_multiview. When the multiview extension is enabled in an ESSL 1.00 shader, num_views can be specified using a layout qualifier. To support this, enabling the multiview extension makes "layout" a keyword rather than an identifier in ESSL 1.00. The type of gl_ViewID_OVR is also different in case of ESSL 1.00: it has to be a signed integer, since unsigned integers are not supported in ESSL 1.00. Some existing tests for multiview shaders are extended in this patch. The changes make sure that vertex shader "in" qualifier is still allowed in ESSL 3.00 multiview shaders, since this patch adds code to disallow it in ESSL 1.00 multiview shaders. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I65dbbbebabdb24cf0bb647d40aa80cebf713c4f7 Reviewed-on: https://chromium-review.googlesource.com/506088 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 7142f6ce 2017-05-05T17:07:26 Prevent using gl_ViewID_OVR as an l-value It's a shader input and as such should not be writable. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I05cb5c63b7272dfa6e80cad57385da02504e4d8f Reviewed-on: https://chromium-review.googlesource.com/497408 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 1d9dcc24 2017-01-19T11:25:32 Make AST path always include the current node being traversed AST traversers tend to sometimes call traverse() functions manually during PreVisit. Change TIntermTraverser so that even if this happens, all the nodes are automatically added to the traversal path, instead of having to add them manually in each individual AST traverser. This also makes calling getParentNode() return the correct node during InVisit. This does cause the same node being added to the traversal path twice in some cases, where nodes are repeatedly traversed, like in OutputHLSL, but this should not have adverse side effects. The more common case is that the traverse() function is called on the children of the node being currently traversed. This fixes a bug in OVR_multiview validation, which did not previously call incrementDepth and decrementDepth when it should have. BUG=angleproject:1725 TEST=angle_unittests, angle_end2end_tests Change-Id: I6ae762eef760509ebe853eefa37dac28c16e7a9b Reviewed-on: https://chromium-review.googlesource.com/430732 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 2f90a9b5 2017-01-10T12:27:56 Fix shader support of OVR_multiview Fix up incorrect capitalization of gl_ViewID_OVR in a few places. Also add extension macro test to compiler unit tests. BUG=angleproject:1669 TEST=angle_unittests Change-Id: Ia7fdd747ad08355cdc149db9e2e7911c2e673af5 Reviewed-on: https://chromium-review.googlesource.com/425851 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 09b04a2f 2016-12-15T13:30:26 Add shader translator support for OVR_multiview The OVR_multiview and OVR_multiview2 extensions add gl_ViewID_OVR to shaders. gl_ViewID_OVR can be translated either as is in GLSL output or as a uniform by setting the SH_TRANSLATE_VIEWID_OVR_AS_UNIFORM compiler flag. If WebGL output is selected, the shaders will be validated according to proposed rules in the WEBGL_multiview spec. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I19ea3a6c8b4edb78be03f1a50a96bfef018870d0 Reviewed-on: https://chromium-review.googlesource.com/422848 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>