Home | History | Annotate | Download | only in compiler
      1 //
      2 // Copyright (c) 2002-2010 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 
      7 #include "compiler/TranslatorESSL.h"
      8 #include "compiler/TranslatorGLSL.h"
      9 #include "compiler/TranslatorHLSL.h"
     10 
     11 //
     12 // This function must be provided to create the actual
     13 // compile object used by higher level code.  It returns
     14 // a subclass of TCompiler.
     15 //
     16 TCompiler* ConstructCompiler(
     17     ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
     18 {
     19     switch (output) {
     20       case SH_ESSL_OUTPUT:
     21         return new TranslatorESSL(type, spec);
     22       case SH_GLSL_OUTPUT:
     23         return new TranslatorGLSL(type, spec);
     24       case SH_HLSL9_OUTPUT:
     25       case SH_HLSL11_OUTPUT:
     26         return new TranslatorHLSL(type, spec, output);
     27       default:
     28         return NULL;
     29     }
     30 }
     31 
     32 //
     33 // Delete the compiler made by ConstructCompiler
     34 //
     35 void DeleteCompiler(TCompiler* compiler)
     36 {
     37     delete compiler;
     38 }
     39