chromium/third_party/angle/samples/shader_translator/shader_translator.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.
//

#include "GLSLANG/ShaderLang.h"

#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <vector>
#include "angle_gl.h"

#if defined(ANGLE_ENABLE_VULKAN)
// SPIR-V tools include for disassembly.
#    include <spirv-tools/libspirv.hpp>
#endif

//
// Return codes from main.
//
enum TFailCode
{};

static void usage();
static sh::GLenum FindShaderType(const char *fileName);
static bool CompileFile(char *fileName, ShHandle compiler, const ShCompileOptions &compileOptions);
static void LogMsg(const char *msg, const char *name, const int num, const char *logName);
static void PrintVariable(const std::string &prefix, size_t index, const sh::ShaderVariable &var);
static void PrintActiveVariables(ShHandle compiler);

// If NUM_SOURCE_STRINGS is set to a value > 1, the input file data is
// broken into that many chunks. This will affect file/line numbering in
// the preprocessor.
const unsigned int NUM_SOURCE_STRINGS =;
ShaderSource;
static bool ReadShaderSource(const char *fileName, ShaderSource &source);
static void FreeShaderSource(ShaderSource &source);

static bool ParseGLSLOutputVersion(const std::string &, ShShaderOutput *outResult);
static bool ParseIntValue(const std::string &, int emptyDefault, int *outValue);

static void PrintSpirv(const sh::BinaryBlob &blob);

//
// Set up the per compile resources
//
void GenerateResources(ShBuiltInResources *resources)
{}

int main(int argc, char *argv[])
{}

//
//   print usage to stdout
//
void usage()
{}

//
//   Deduce the shader type from the filename.  Files must end in one of the
//   following extensions:
//
//   .frag*    = fragment shader
//   .vert*    = vertex shader
//   .comp*    = compute shader
//   .geom*    = geometry shader
//   .tcs*     = tessellation control shader
//   .tes*     = tessellation evaluation shader
//
sh::GLenum FindShaderType(const char *fileName)
{}

//
//   Read a file's data into a string, and compile it using sh::Compile
//
bool CompileFile(char *fileName, ShHandle compiler, const ShCompileOptions &compileOptions)
{}

void LogMsg(const char *msg, const char *name, const int num, const char *logName)
{}

void PrintVariable(const std::string &prefix, size_t index, const sh::ShaderVariable &var)
{}

static void PrintActiveVariables(ShHandle compiler)
{}

static bool ReadShaderSource(const char *fileName, ShaderSource &source)
{}

static void FreeShaderSource(ShaderSource &source)
{}

static bool ParseGLSLOutputVersion(const std::string &num, ShShaderOutput *outResult)
{}

static bool ParseIntValue(const std::string &num, int emptyDefault, int *outValue)
{}

static void PrintSpirv(const sh::BinaryBlob &blob)
{}