176b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org//
22b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
376b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org// Use of this source code is governed by a BSD-style license that can be
476b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org// found in the LICENSE file.
576b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org//
676b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org
717732823f9c21bdba9cc51ffaceb545ce3857a8cGeoff Lang#include "compiler/translator/TranslatorESSL.h"
82b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang#include "compiler/translator/TranslatorGLSL.h"
92b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang#include "compiler/translator/TranslatorHLSL.h"
1076b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org
1176b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org//
1276b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org// This function must be provided to create the actual
1376b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org// compile object used by higher level code.  It returns
1476b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org// a subclass of TCompiler.
1576b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org//
165601ea0d66442518d4745bb02b7619485b9d305bzmo@google.comTCompiler* ConstructCompiler(
175601ea0d66442518d4745bb02b7619485b9d305bzmo@google.com    ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
1876b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org{
195601ea0d66442518d4745bb02b7619485b9d305bzmo@google.com    switch (output) {
202b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang    case SH_ESSL_OUTPUT:
215601ea0d66442518d4745bb02b7619485b9d305bzmo@google.com        return new TranslatorESSL(type, spec);
222b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang    case SH_GLSL_OUTPUT:
232b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang        return new TranslatorGLSL(type, spec);
242b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang    case SH_HLSL9_OUTPUT:
252b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang    case SH_HLSL11_OUTPUT:
262b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang        return new TranslatorHLSL(type, spec, output);
272b6008c9d1d7dcb89ae3e7bdf5d697605ff95a6cGeoff Lang    default:
285601ea0d66442518d4745bb02b7619485b9d305bzmo@google.com        return NULL;
295601ea0d66442518d4745bb02b7619485b9d305bzmo@google.com    }
3076b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org}
3176b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org
3276b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org//
3376b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org// Delete the compiler made by ConstructCompiler
3476b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org//
3576b820852b116d79187e5af5457a45065f656bdaalokp@chromium.orgvoid DeleteCompiler(TCompiler* compiler)
3676b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org{
3776b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org    delete compiler;
3876b820852b116d79187e5af5457a45065f656bdaalokp@chromium.org}
39