1 | // |
2 | // Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. |
3 | // Use of this source code is governed by a BSD-style license that can be |
4 | // found in the LICENSE file. |
5 | // |
6 | // Regardless of the shader type, the following AST transformations are applied: |
7 | // - Add declaration of View_ID_OVR. |
8 | // - Replace every occurrence of gl_ViewID_OVR with ViewID_OVR, mark ViewID_OVR as internal and |
9 | // declare it as a flat varying. |
10 | // |
11 | // If the shader type is a vertex shader, the following AST transformations are applied: |
12 | // - Replace every occurrence of gl_InstanceID with InstanceID, mark InstanceID as internal and set |
13 | // its qualifier to EvqTemporary. |
14 | // - Add initializers of ViewID_OVR and InstanceID to the beginning of the body of main. The pass |
15 | // should be executed before any variables get collected so that usage of gl_InstanceID is recorded. |
16 | // - If the output is ESSL or GLSL and the SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER option is |
17 | // enabled, the expression |
18 | // "if (multiviewBaseViewLayerIndex < 0) { |
19 | // gl_ViewportIndex = int(ViewID_OVR); |
20 | // } else { |
21 | // gl_Layer = int(ViewID_OVR) + multiviewBaseViewLayerIndex; |
22 | // }" |
23 | // is added after ViewID and InstanceID are initialized. Also, MultiviewRenderPath is added as a |
24 | // uniform. |
25 | // |
26 | |
27 | #ifndef COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ |
28 | #define COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ |
29 | |
30 | #include "GLSLANG/ShaderLang.h" |
31 | #include "angle_gl.h" |
32 | |
33 | namespace sh |
34 | { |
35 | |
36 | class TIntermBlock; |
37 | class TSymbolTable; |
38 | |
39 | void DeclareAndInitBuiltinsForInstancedMultiview(TIntermBlock *root, |
40 | unsigned numberOfViews, |
41 | GLenum shaderType, |
42 | ShCompileOptions compileOptions, |
43 | ShShaderOutput shaderOutput, |
44 | TSymbolTable *symbolTable); |
45 | |
46 | } // namespace sh |
47 | |
48 | #endif // COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ |