1 // 2 // Copyright 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 with the same qualifier. 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 selectViewInNvGLSLVertexShader option is 17 // enabled, the expression 18 // gl_Layer = int(ViewID_OVR) + multiviewBaseViewLayerIndex; 19 // is added after ViewID and InstanceID are initialized. Also, multiviewBaseViewLayerIndex is added 20 // as a uniform. 21 // 22 23 #ifndef COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ 24 #define COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ 25 26 #include "GLSLANG/ShaderLang.h" 27 #include "angle_gl.h" 28 #include "common/angleutils.h" 29 30 namespace sh 31 { 32 33 class TCompiler; 34 class TIntermBlock; 35 class TSymbolTable; 36 37 [[nodiscard]] bool DeclareAndInitBuiltinsForInstancedMultiview( 38 TCompiler *compiler, 39 TIntermBlock *root, 40 unsigned numberOfViews, 41 GLenum shaderType, 42 const ShCompileOptions &compileOptions, 43 ShShaderOutput shaderOutput, 44 TSymbolTable *symbolTable); 45 46 } // namespace sh 47 48 #endif // COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ 49