John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 1 | // 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 Capens | 5597eef | 2015-01-22 09:33:04 -0500 | [diff] [blame^] | 16 | TranslatorASM::TranslatorASM(glsl::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject)
|
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 17 | {
|
| 18 | }
|
| 19 |
|
Nicolas Capens | 014b9a6 | 2014-10-15 10:28:29 -0400 | [diff] [blame] | 20 | bool TranslatorASM::translate(TIntermNode* root)
|
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 21 | {
|
| 22 | TParseContext& parseContext = *GetGlobalParseContext();
|
Nicolas Capens | 5597eef | 2015-01-22 09:33:04 -0500 | [diff] [blame^] | 23 | glsl::OutputASM outputASM(parseContext, shaderObject);
|
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 24 |
|
| 25 | outputASM.output();
|
Nicolas Capens | 014b9a6 | 2014-10-15 10:28:29 -0400 | [diff] [blame] | 26 |
|
| 27 | return parseContext.numErrors() == 0;
|
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 28 | }
|
| 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 | //
|
| 35 | TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
|
| 36 | {
|
| 37 | return new TranslatorASM(0, type, spec);
|
| 38 | }
|
| 39 |
|
| 40 | //
|
| 41 | // Delete the compiler made by ConstructCompiler
|
| 42 | //
|
| 43 | void DeleteCompiler(TCompiler* compiler)
|
| 44 | {
|
| 45 | delete compiler;
|
| 46 | } |