OSDN Git Service

b518a6cd547bca56ff848f4c262ee9134a78e388
[android-x86/external-swiftshader.git] / src / Radiance / compiler / TranslatorASM.cpp
1 // SwiftShader Software Renderer\r
2 //\r
3 // Copyright(c) 2005-2012 TransGaming Inc.\r
4 //\r
5 // All rights reserved. No part of this software may be copied, distributed, transmitted,\r
6 // transcribed, stored in a retrieval system, translated into any human or computer\r
7 // language by any means, or disclosed to third parties without the explicit written\r
8 // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express\r
9 // or implied, including but not limited to any patent rights, are granted to you.\r
10 //\r
11 \r
12 #include "TranslatorASM.h"\r
13 \r
14 #include "InitializeParseContext.h"\r
15 \r
16 TranslatorASM::TranslatorASM(rad::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject)\r
17 {\r
18 }\r
19 \r
20 bool TranslatorASM::translate(TIntermNode* root)\r
21 {\r
22     TParseContext& parseContext = *GetGlobalParseContext();\r
23     sh::OutputASM outputASM(parseContext, shaderObject);\r
24 \r
25         outputASM.output();\r
26 \r
27         return parseContext.numErrors() == 0;\r
28 }\r
29 \r
30 //\r
31 // This function must be provided to create the actual\r
32 // compile object used by higher level code.  It returns\r
33 // a subclass of TCompiler.\r
34 //\r
35 TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)\r
36 {\r
37     return new TranslatorASM(0, type, spec);\r
38 }\r
39 \r
40 //\r
41 // Delete the compiler made by ConstructCompiler\r
42 //\r
43 void DeleteCompiler(TCompiler* compiler)\r
44 {\r
45     delete compiler;\r
46 }