blob: 71056f429782bccab9ceae493690157af9bec19e [file] [log] [blame]
alokp@chromium.org76b82082010-03-24 17:59:39 +00001//
Geoff Lang2b6008c2013-10-08 10:44:05 -04002// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
alokp@chromium.org76b82082010-03-24 17:59:39 +00003// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
Geoff Lang17732822013-08-29 13:46:49 -04007#include "compiler/translator/TranslatorESSL.h"
Geoff Lang2b6008c2013-10-08 10:44:05 -04008#include "compiler/translator/TranslatorGLSL.h"
9#include "compiler/translator/TranslatorHLSL.h"
alokp@chromium.org76b82082010-03-24 17:59:39 +000010
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//
zmo@google.com5601ea02011-06-10 18:23:25 +000016TCompiler* ConstructCompiler(
Jamie Madill183bde52014-07-02 15:31:19 -040017 sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
alokp@chromium.org76b82082010-03-24 17:59:39 +000018{
zmo@google.com5601ea02011-06-10 18:23:25 +000019 switch (output) {
Geoff Lang2b6008c2013-10-08 10:44:05 -040020 case SH_ESSL_OUTPUT:
zmo@google.com5601ea02011-06-10 18:23:25 +000021 return new TranslatorESSL(type, spec);
Geoff Lang2b6008c2013-10-08 10:44:05 -040022 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:
zmo@google.com5601ea02011-06-10 18:23:25 +000028 return NULL;
29 }
alokp@chromium.org76b82082010-03-24 17:59:39 +000030}
31
32//
33// Delete the compiler made by ConstructCompiler
34//
35void DeleteCompiler(TCompiler* compiler)
36{
37 delete compiler;
38}