src/tests/compiler_tests/WEBGL_multiview_test.cpp


Log

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