alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 1 | // |
Geoff Lang | 2b6008c | 2013-10-08 10:44:05 -0400 | [diff] [blame] | 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
Geoff Lang | 1773282 | 2013-08-29 13:46:49 -0400 | [diff] [blame] | 7 | #include "compiler/translator/TranslatorESSL.h" |
Geoff Lang | 2b6008c | 2013-10-08 10:44:05 -0400 | [diff] [blame] | 8 | #include "compiler/translator/TranslatorGLSL.h" |
| 9 | #include "compiler/translator/TranslatorHLSL.h" |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 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 | // |
zmo@google.com | 5601ea0 | 2011-06-10 18:23:25 +0000 | [diff] [blame] | 16 | TCompiler* ConstructCompiler( |
Jamie Madill | 183bde5 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 17 | sh::GLenum type, ShShaderSpec spec, ShShaderOutput output) |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 18 | { |
zmo@google.com | 5601ea0 | 2011-06-10 18:23:25 +0000 | [diff] [blame] | 19 | switch (output) { |
Geoff Lang | 2b6008c | 2013-10-08 10:44:05 -0400 | [diff] [blame] | 20 | case SH_ESSL_OUTPUT: |
zmo@google.com | 5601ea0 | 2011-06-10 18:23:25 +0000 | [diff] [blame] | 21 | return new TranslatorESSL(type, spec); |
Geoff Lang | 2b6008c | 2013-10-08 10:44:05 -0400 | [diff] [blame] | 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: |
zmo@google.com | 5601ea0 | 2011-06-10 18:23:25 +0000 | [diff] [blame] | 28 | return NULL; |
| 29 | } |
alokp@chromium.org | 76b8208 | 2010-03-24 17:59:39 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | // |
| 33 | // Delete the compiler made by ConstructCompiler |
| 34 | // |
| 35 | void DeleteCompiler(TCompiler* compiler) |
| 36 | { |
| 37 | delete compiler; |
| 38 | } |