chromium/third_party/angle/src/compiler/translator/ShaderLang.cpp

//
// Copyright 2002 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

//
// Implement the top-level of interface to the compiler,
// as defined in ShaderLang.h
//

#include "GLSLANG/ShaderLang.h"

#include "common/PackedEnums.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/InitializeDll.h"
#include "compiler/translator/length_limits.h"
#ifdef ANGLE_ENABLE_HLSL
#    include "compiler/translator/hlsl/TranslatorHLSL.h"
#endif  // ANGLE_ENABLE_HLSL
#include "angle_gl.h"
#include "compiler/translator/VariablePacker.h"

namespace sh
{

namespace
{

bool isInitialized =;

//
// This is the platform independent interface between an OGL driver
// and the shading language compiler.
//

template <typename VarT>
const std::vector<VarT> *GetVariableList(const TCompiler *compiler);

template <>
const std::vector<InterfaceBlock> *GetVariableList(const TCompiler *compiler)
{}

TCompiler *GetCompilerFromHandle(ShHandle handle)
{}

template <typename VarT>
const std::vector<VarT> *GetShaderVariables(const ShHandle handle)
{}

#ifdef ANGLE_ENABLE_HLSL
TranslatorHLSL *GetTranslatorHLSLFromHandle(ShHandle handle)
{
    if (!handle)
        return nullptr;
    TShHandleBase *base = static_cast<TShHandleBase *>(handle);
    return base->getAsTranslatorHLSL();
}
#endif  // ANGLE_ENABLE_HLSL

GLenum GetGeometryShaderPrimitiveTypeEnum(sh::TLayoutPrimitiveType primitiveType)
{}

GLenum GetTessellationShaderTypeEnum(sh::TLayoutTessEvaluationType type)
{}

}  // anonymous namespace

//
// Driver must call this first, once, before doing any other compiler operations.
// Subsequent calls to this function are no-op.
//
bool Initialize()
{}

//
// Cleanup symbol tables
//
bool Finalize()
{}

//
// Initialize built-in resources with minimum expected values.
//
void InitBuiltInResources(ShBuiltInResources *resources)
{}

//
// Driver calls these to create and destroy compiler objects.
//
ShHandle ConstructCompiler(sh::GLenum type,
                           ShShaderSpec spec,
                           ShShaderOutput output,
                           const ShBuiltInResources *resources)
{}

void Destruct(ShHandle handle)
{}

ShBuiltInResources GetBuiltInResources(const ShHandle handle)
{}

const std::string &GetBuiltInResourcesString(const ShHandle handle)
{}

//
// Do an actual compile on the given strings.  The result is left
// in the given compile object.
//
// Return:  The return value of ShCompile is really boolean, indicating
// success or failure.
//
bool Compile(const ShHandle handle,
             const char *const shaderStrings[],
             size_t numStrings,
             const ShCompileOptions &compileOptions)
{}

void ClearResults(const ShHandle handle)
{}

int GetShaderVersion(const ShHandle handle)
{}

ShShaderOutput GetShaderOutputType(const ShHandle handle)
{}

//
// Return any compiler log of messages for the application.
//
const std::string &GetInfoLog(const ShHandle handle)
{}

//
// Return any object code.
//
const std::string &GetObjectCode(const ShHandle handle)
{}

//
// Return any object binary code.
//
const BinaryBlob &GetObjectBinaryBlob(const ShHandle handle)
{}

bool GetShaderBinary(const ShHandle handle,
                     const char *const shaderStrings[],
                     size_t numStrings,
                     const ShCompileOptions &compileOptions,
                     ShaderBinaryBlob *const binaryOut)
{}

const std::map<std::string, std::string> *GetNameHashingMap(const ShHandle handle)
{}

const std::vector<ShaderVariable> *GetUniforms(const ShHandle handle)
{}

const std::vector<ShaderVariable> *GetInputVaryings(const ShHandle handle)
{}

const std::vector<ShaderVariable> *GetOutputVaryings(const ShHandle handle)
{}

const std::vector<ShaderVariable> *GetVaryings(const ShHandle handle)
{}

const std::vector<ShaderVariable> *GetAttributes(const ShHandle handle)
{}

const std::vector<ShaderVariable> *GetOutputVariables(const ShHandle handle)
{}

const std::vector<InterfaceBlock> *GetInterfaceBlocks(const ShHandle handle)
{}

const std::vector<InterfaceBlock> *GetUniformBlocks(const ShHandle handle)
{}

const std::vector<InterfaceBlock> *GetShaderStorageBlocks(const ShHandle handle)
{}

WorkGroupSize GetComputeShaderLocalGroupSize(const ShHandle handle)
{}

int GetVertexShaderNumViews(const ShHandle handle)
{}

uint32_t GetShaderSpecConstUsageBits(const ShHandle handle)
{}

bool CheckVariablesWithinPackingLimits(int maxVectors, const std::vector<ShaderVariable> &variables)
{}

bool GetShaderStorageBlockRegister(const ShHandle handle,
                                   const std::string &shaderStorageBlockName,
                                   unsigned int *indexOut)
{}

bool GetUniformBlockRegister(const ShHandle handle,
                             const std::string &uniformBlockName,
                             unsigned int *indexOut)
{}

bool ShouldUniformBlockUseStructuredBuffer(const ShHandle handle,
                                           const std::string &uniformBlockName)
{}

const std::map<std::string, unsigned int> *GetUniformRegisterMap(const ShHandle handle)
{}

const std::set<std::string> *GetSlowCompilingUniformBlockSet(const ShHandle handle)
{}

unsigned int GetReadonlyImage2DRegisterIndex(const ShHandle handle)
{}

unsigned int GetImage2DRegisterIndex(const ShHandle handle)
{}

const std::set<std::string> *GetUsedImage2DFunctionNames(const ShHandle handle)
{}

uint8_t GetClipDistanceArraySize(const ShHandle handle)
{}

uint8_t GetCullDistanceArraySize(const ShHandle handle)
{}

uint32_t GetMetadataFlags(const ShHandle handle)
{}

GLenum GetGeometryShaderInputPrimitiveType(const ShHandle handle)
{}

GLenum GetGeometryShaderOutputPrimitiveType(const ShHandle handle)
{}

int GetGeometryShaderInvocations(const ShHandle handle)
{}

int GetGeometryShaderMaxVertices(const ShHandle handle)
{}

int GetTessControlShaderVertices(const ShHandle handle)
{}

GLenum GetTessGenMode(const ShHandle handle)
{}

GLenum GetTessGenSpacing(const ShHandle handle)
{}

GLenum GetTessGenVertexOrder(const ShHandle handle)
{}

GLenum GetTessGenPointMode(const ShHandle handle)
{}

unsigned int GetShaderSharedMemorySize(const ShHandle handle)
{}

uint32_t GetAdvancedBlendEquations(const ShHandle handle)
{}

// Can't prefix with just _ because then we might introduce a double underscore, which is not safe
// in GLSL (ESSL 3.00.6 section 3.8: All identifiers containing a double underscore are reserved for
// use by the underlying implementation). u is short for user-defined.
const char kUserDefinedNamePrefix[] =;

const char *BlockLayoutTypeToString(BlockLayoutType type)
{}

const char *BlockTypeToString(BlockType type)
{}

const char *InterpolationTypeToString(InterpolationType type)
{}
}  // namespace sh

ShCompileOptions::ShCompileOptions()
{}

ShCompileOptions::ShCompileOptions(const ShCompileOptions &other)
{}
ShCompileOptions &ShCompileOptions::operator=(const ShCompileOptions &other)
{}

ShBuiltInResources::ShBuiltInResources()
{}

ShBuiltInResources::ShBuiltInResources(const ShBuiltInResources &other)
{}
ShBuiltInResources &ShBuiltInResources::operator=(const ShBuiltInResources &other)
{}