tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DeclareAndInitBuiltinsForInstancedMultiview.h (1952B)


      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 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 selectViewInNvGLSLVertexShader 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 #include "common/angleutils.h"
     33 
     34 namespace sh
     35 {
     36 
     37 class TCompiler;
     38 class TIntermBlock;
     39 class TSymbolTable;
     40 
     41 [[nodiscard]] bool DeclareAndInitBuiltinsForInstancedMultiview(
     42    TCompiler *compiler,
     43    TIntermBlock *root,
     44    unsigned numberOfViews,
     45    GLenum shaderType,
     46    const ShCompileOptions &compileOptions,
     47    ShShaderOutput shaderOutput,
     48    TSymbolTable *symbolTable);
     49 
     50 }  // namespace sh
     51 
     52 #endif  // COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_