Commit c54bf507 by alokp@chromium.org

Further cleanup of ShaderLang.h. Removed redundant/unused macros and enum fields.

Review URL: http://codereview.appspot.com/1842046 git-svn-id: https://angleproject.googlecode.com/svn/trunk@349 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 774d7063
...@@ -8,13 +8,6 @@ ...@@ -8,13 +8,6 @@
#include "ResourceLimits.h" #include "ResourceLimits.h"
#ifdef _WIN32
#define C_DECL __cdecl
#else
#define __fastcall
#define C_DECL
#endif
// //
// This is the platform independent interface between an OGL driver // This is the platform independent interface between an OGL driver
// and the shading language compiler. // and the shading language compiler.
...@@ -31,7 +24,7 @@ int ShInitialize(); ...@@ -31,7 +24,7 @@ int ShInitialize();
// //
// Driver should call this at shutdown. // Driver should call this at shutdown.
// //
int __fastcall ShFinalize(); int ShFinalize();
// //
// Types of languages the compiler can consume. // Types of languages the compiler can consume.
// //
...@@ -60,6 +53,11 @@ typedef enum { ...@@ -60,6 +53,11 @@ typedef enum {
EShOptFull, // Optimizations that will take more time EShOptFull, // Optimizations that will take more time
} EShOptimizationLevel; } EShOptimizationLevel;
enum TDebugOptions {
EDebugOpNone = 0x000,
EDebugOpIntermediate = 0x001, // Writes intermediate tree into info-log.
};
// //
// ShHandle held by but opaque to the driver. It is allocated, // ShHandle held by but opaque to the driver. It is allocated,
// managed, and de-allocated by the compiler. It's contents // managed, and de-allocated by the compiler. It's contents
...@@ -98,12 +96,6 @@ int ShCompile( ...@@ -98,12 +96,6 @@ int ShCompile(
const char* ShGetInfoLog(const ShHandle); const char* ShGetInfoLog(const ShHandle);
const char* ShGetObjectCode(const ShHandle); const char* ShGetObjectCode(const ShHandle);
enum TDebugOptions {
EDebugOpNone = 0x000,
EDebugOpIntermediate = 0x001,
EDebugOpObjectCode = 0x002,
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -46,11 +46,12 @@ void GenerateResources(TBuiltInResource& resources) ...@@ -46,11 +46,12 @@ void GenerateResources(TBuiltInResource& resources)
resources.maxDrawBuffers = 1; resources.maxDrawBuffers = 1;
} }
int C_DECL main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
int numCompilers = 0; int numCompilers = 0;
bool compileFailed = false; bool compileFailed = false;
int debugOptions = 0; int debugOptions = 0;
bool writeObjectCode = false;
int i; int i;
ShHandle compilers[EShLangCount]; ShHandle compilers[EShLangCount];
...@@ -63,7 +64,7 @@ int C_DECL main(int argc, char* argv[]) ...@@ -63,7 +64,7 @@ int C_DECL main(int argc, char* argv[])
if (argv[0][0] == '-' || argv[0][0] == '/') { if (argv[0][0] == '-' || argv[0][0] == '/') {
switch (argv[0][1]) { switch (argv[0][1]) {
case 'i': debugOptions |= EDebugOpIntermediate; break; case 'i': debugOptions |= EDebugOpIntermediate; break;
case 'o': debugOptions |= EDebugOpObjectCode; break; case 'o': writeObjectCode = true; break;
default: usage(); return EFailUsage; default: usage(); return EFailUsage;
} }
} else { } else {
...@@ -89,7 +90,7 @@ int C_DECL main(int argc, char* argv[]) ...@@ -89,7 +90,7 @@ int C_DECL main(int argc, char* argv[])
puts(ShGetInfoLog(compilers[i])); puts(ShGetInfoLog(compilers[i]));
LogMsg("END", "COMPILER", i, "INFO LOG"); LogMsg("END", "COMPILER", i, "INFO LOG");
} }
if ((debugOptions & EDebugOpObjectCode) != 0) { if (writeObjectCode) {
for (i = 0; i < numCompilers; ++i) { for (i = 0; i < numCompilers; ++i) {
LogMsg("BEGIN", "COMPILER", i, "OBJ CODE"); LogMsg("BEGIN", "COMPILER", i, "OBJ CODE");
puts(ShGetObjectCode(compilers[i])); puts(ShGetObjectCode(compilers[i]));
......
...@@ -176,8 +176,8 @@ void TParseContext::recover() ...@@ -176,8 +176,8 @@ void TParseContext::recover()
// //
// Used by flex/bison to output all syntax and parsing errors. // Used by flex/bison to output all syntax and parsing errors.
// //
void C_DECL TParseContext::error(TSourceLoc nLine, const char *szReason, const char *szToken, void TParseContext::error(TSourceLoc nLine, const char *szReason, const char *szToken,
const char *szExtraInfoFormat, ...) const char *szExtraInfoFormat, ...)
{ {
char szExtraInfo[400]; char szExtraInfo[400];
va_list marker; va_list marker;
......
...@@ -56,8 +56,8 @@ struct TParseContext { ...@@ -56,8 +56,8 @@ struct TParseContext {
TMap<TString, TBehavior> extensionBehavior; TMap<TString, TBehavior> extensionBehavior;
void initializeExtensionBehavior(); void initializeExtensionBehavior();
void C_DECL error(TSourceLoc, const char *szReason, const char *szToken, void error(TSourceLoc, const char *szReason, const char *szToken,
const char *szExtraInfoFormat, ...); const char *szExtraInfoFormat, ...);
bool reservedErrorCheck(int line, const TString& identifier); bool reservedErrorCheck(int line, const TString& identifier);
void recover(); void recover();
......
...@@ -105,7 +105,7 @@ void ShDestruct(ShHandle handle) ...@@ -105,7 +105,7 @@ void ShDestruct(ShHandle handle)
// //
// Cleanup symbol tables // Cleanup symbol tables
// //
int __fastcall ShFinalize() int ShFinalize()
{ {
if (PerProcessGPA) { if (PerProcessGPA) {
PerProcessGPA->popAll(); PerProcessGPA->popAll();
......
...@@ -278,7 +278,7 @@ void Shader::compileToHLSL(void *compiler) ...@@ -278,7 +278,7 @@ void Shader::compileToHLSL(void *compiler)
resources.maxFragmentUniformVectors = MAX_FRAGMENT_UNIFORM_VECTORS; resources.maxFragmentUniformVectors = MAX_FRAGMENT_UNIFORM_VECTORS;
resources.maxDrawBuffers = MAX_DRAW_BUFFERS; resources.maxDrawBuffers = MAX_DRAW_BUFFERS;
int result = ShCompile(compiler, &mSource, 1, EShOptNone, &resources, EDebugOpObjectCode); int result = ShCompile(compiler, &mSource, 1, EShOptNone, &resources, EDebugOpNone);
const char *obj = ShGetObjectCode(compiler); const char *obj = ShGetObjectCode(compiler);
const char *info = ShGetInfoLog(compiler); const char *info = ShGetInfoLog(compiler);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment