zenilib: zenilib/jni/external/angle/samples/translator/translator.cpp File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Typedefs | Enumerations | Functions | Variables
translator.cpp File Reference
`#include "GLSLANG/ShaderLang.h"`
`#include <assert.h>`
`#include <math.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <vector>`

Go to the source code of this file.

## Typedefs

typedef std::vector< char * > | ShaderSource

## Enumerations

enum | TFailCode { ESuccess = 0, EFailUsage, EFailCompile, EFailCompilerCreate }

## Functions

static bool | CompileFile (char *fileName, ShHandle compiler, int compileOptions)
static ShShaderType | FindShaderType (const char *fileName)
static void | FreeShaderSource (ShaderSource &source)
void | GenerateResources (ShBuiltInResources *resources)
static void | LogMsg (const char *msg, const char *name, const int num, const char *logName)
int | main (int argc, char *argv[])
static void | PrintActiveVariables (ShHandle compiler, ShShaderInfo varType, bool mapLongVariableNames)
static bool | ReadShaderSource (const char *fileName, ShaderSource &source)
static void | usage ()

## Variables

const unsigned int | NUM_SOURCE_STRINGS = 2

## Typedef Documentation

typedef std::vector<char*> ShaderSource

Definition at line 35 of file translator.cpp.

## Enumeration Type Documentation

enum TFailCode

Enumerator
ESuccess |
EFailUsage |
EFailCompile |
EFailCompilerCreate |

Definition at line 19 of file translator.cpp.

## Function Documentation

bool CompileFile | ( | char * | fileName,
|  | ShHandle | compiler,
|  | int | compileOptions
| ) |  |

static

Definition at line 266 of file translator.cpp.

References FreeShaderSource(), ReadShaderSource(), ret, and ShCompile().

Referenced by main().

ShShaderType FindShaderType | ( | const char * | fileName | ) |

static

Definition at line 245 of file translator.cpp.

References assert, SH_FRAGMENT_SHADER, and SH_VERTEX_SHADER.

Referenced by main().

static void FreeShaderSource | ( | ShaderSource & | source | ) |

static

Definition at line 381 of file translator.cpp.

References i.

Referenced by CompileFile().

void GenerateResources | ( | ShBuiltInResources * | resources | ) |

Definition at line 42 of file translator.cpp.

References ShBuiltInResources::MaxCombinedTextureImageUnits, ShBuiltInResources::MaxDrawBuffers, ShBuiltInResources::MaxFragmentUniformVectors, ShBuiltInResources::MaxTextureImageUnits, ShBuiltInResources::MaxVaryingVectors, ShBuiltInResources::MaxVertexAttribs, ShBuiltInResources::MaxVertexTextureImageUnits, ShBuiltInResources::MaxVertexUniformVectors, ShBuiltInResources::OES_EGL_image_external, ShBuiltInResources::OES_standard_derivatives, and ShInitBuiltInResources().

Referenced by main().

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

static

Definition at line 278 of file translator.cpp.

Referenced by main().

int main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Definition at line 59 of file translator.cpp.

References ShBuiltInResources::ARB_texture_rectangle, CompileFile(), EFailCompile, EFailCompilerCreate, EFailUsage, ESuccess, FindShaderType(), free, GenerateResources(), LogMsg(), ShBuiltInResources::OES_EGL_image_external, ShBuiltInResources::OES_standard_derivatives, sort_controllers::output, PrintActiveVariables(), realloc, SH_ACTIVE_ATTRIBUTES, SH_ACTIVE_UNIFORMS, SH_ATTRIBUTES_UNIFORMS, SH_CSS_SHADERS_SPEC, SH_DEPENDENCY_GRAPH, SH_EMULATE_BUILT_IN_FUNCTIONS, SH_ESSL_OUTPUT, SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_GLSL_OUTPUT, SH_HLSL11_OUTPUT, SH_HLSL9_OUTPUT, SH_INFO_LOG_LENGTH, SH_INTERMEDIATE_TREE, SH_MAP_LONG_VARIABLE_NAMES, SH_OBJECT_CODE, SH_OBJECT_CODE_LENGTH, SH_TIMING_RESTRICTIONS, SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX, SH_VERTEX_SHADER, SH_WEBGL_SPEC, ShConstructCompiler(), ShDestruct(), ShFinalize(), ShGetInfo(), ShGetInfoLog(), ShGetObjectCode(), and ShInitialize().

void PrintActiveVariables | ( | ShHandle | compiler,
|  | ShShaderInfo | varType,
|  | bool | mapLongVariableNames
| ) |  |

static

Definition at line 283 of file translator.cpp.

References assert, i, NULL, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_ACTIVE_ATTRIBUTES, SH_ACTIVE_UNIFORM_MAX_LENGTH, SH_ACTIVE_UNIFORMS, SH_BOOL, SH_BOOL_VEC2, SH_BOOL_VEC3, SH_BOOL_VEC4, SH_FLOAT, SH_FLOAT_MAT2, SH_FLOAT_MAT3, SH_FLOAT_MAT4, SH_FLOAT_VEC2, SH_FLOAT_VEC3, SH_FLOAT_VEC4, SH_INT, SH_INT_VEC2, SH_INT_VEC3, SH_INT_VEC4, SH_MAPPED_NAME_MAX_LENGTH, SH_NONE, SH_SAMPLER_2D, SH_SAMPLER_CUBE, SH_SAMPLER_EXTERNAL_OES, ShGetActiveAttrib(), ShGetActiveUniform(), and ShGetInfo().

Referenced by main().

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

static

Definition at line 351 of file translator.cpp.

References int, NUM_SOURCE_STRINGS, and SEEK_END.

Referenced by CompileFile().

static void usage | ( | void |  | ) |

static

## Variable Documentation

const unsigned int NUM_SOURCE_STRINGS = 2

Definition at line 34 of file translator.cpp.

Referenced by ReadShaderSource().