blob: c041e05f7258a87f1818494b4dc3ab5ef883a51f [file] [log] [blame]
John Bauman66b8ab22014-05-06 15:57:45 -04001// SwiftShader Software Renderer
2//
3// Copyright(c) 2005-2012 TransGaming Inc.
4//
5// All rights reserved. No part of this software may be copied, distributed, transmitted,
6// transcribed, stored in a retrieval system, translated into any human or computer
7// language by any means, or disclosed to third parties without the explicit written
8// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
9// or implied, including but not limited to any patent rights, are granted to you.
10//
11
12#include "TranslatorASM.h"
13
14#include "InitializeParseContext.h"
15
Nicolas Capens5597eef2015-01-22 09:33:04 -050016TranslatorASM::TranslatorASM(glsl::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject)
John Bauman66b8ab22014-05-06 15:57:45 -040017{
18}
19
Nicolas Capens014b9a62014-10-15 10:28:29 -040020bool TranslatorASM::translate(TIntermNode* root)
John Bauman66b8ab22014-05-06 15:57:45 -040021{
22 TParseContext& parseContext = *GetGlobalParseContext();
Nicolas Capens5597eef2015-01-22 09:33:04 -050023 glsl::OutputASM outputASM(parseContext, shaderObject);
John Bauman66b8ab22014-05-06 15:57:45 -040024
25 outputASM.output();
Nicolas Capens014b9a62014-10-15 10:28:29 -040026
27 return parseContext.numErrors() == 0;
John Bauman66b8ab22014-05-06 15:57:45 -040028}
29
30//
31// This function must be provided to create the actual
32// compile object used by higher level code. It returns
33// a subclass of TCompiler.
34//
35TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
36{
37 return new TranslatorASM(0, type, spec);
38}
39
40//
41// Delete the compiler made by ConstructCompiler
42//
43void DeleteCompiler(TCompiler* compiler)
44{
45 delete compiler;
46}