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 @@
#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
// and the shading language compiler.
......@@ -31,7 +24,7 @@ int ShInitialize();
//
// Driver should call this at shutdown.
//
int __fastcall ShFinalize();
int ShFinalize();
//
// Types of languages the compiler can consume.
//
......@@ -60,6 +53,11 @@ typedef enum {
EShOptFull, // Optimizations that will take more time
} EShOptimizationLevel;
enum TDebugOptions {
EDebugOpNone = 0x000,
EDebugOpIntermediate = 0x001, // Writes intermediate tree into info-log.
};
//
// ShHandle held by but opaque to the driver. It is allocated,
// managed, and de-allocated by the compiler. It's contents
......@@ -98,12 +96,6 @@ int ShCompile(
const char* ShGetInfoLog(const ShHandle);
const char* ShGetObjectCode(const ShHandle);
enum TDebugOptions {
EDebugOpNone = 0x000,
EDebugOpIntermediate = 0x001,
EDebugOpObjectCode = 0x002,
};
#ifdef __cplusplus
}
#endif
......
......@@ -46,11 +46,12 @@ void GenerateResources(TBuiltInResource& resources)
resources.maxDrawBuffers = 1;
}
int C_DECL main(int argc, char* argv[])
int main(int argc, char* argv[])
{
int numCompilers = 0;
bool compileFailed = false;
int debugOptions = 0;
bool writeObjectCode = false;
int i;
ShHandle compilers[EShLangCount];
......@@ -63,7 +64,7 @@ int C_DECL main(int argc, char* argv[])
if (argv[0][0] == '-' || argv[0][0] == '/') {
switch (argv[0][1]) {
case 'i': debugOptions |= EDebugOpIntermediate; break;
case 'o': debugOptions |= EDebugOpObjectCode; break;
case 'o': writeObjectCode = true; break;
default: usage(); return EFailUsage;
}
} else {
......@@ -89,7 +90,7 @@ int C_DECL main(int argc, char* argv[])
puts(ShGetInfoLog(compilers[i]));
LogMsg("END", "COMPILER", i, "INFO LOG");
}
if ((debugOptions & EDebugOpObjectCode) != 0) {
if (writeObjectCode) {
for (i = 0; i < numCompilers; ++i) {
LogMsg("BEGIN", "COMPILER", i, "OBJ CODE");
puts(ShGetObjectCode(compilers[i]));
......
......@@ -176,8 +176,8 @@ void TParseContext::recover()
//
// Used by flex/bison to output all syntax and parsing errors.
//
void C_DECL TParseContext::error(TSourceLoc nLine, const char *szReason, const char *szToken,
const char *szExtraInfoFormat, ...)
void TParseContext::error(TSourceLoc nLine, const char *szReason, const char *szToken,
const char *szExtraInfoFormat, ...)
{
char szExtraInfo[400];
va_list marker;
......
......@@ -56,8 +56,8 @@ struct TParseContext {
TMap<TString, TBehavior> extensionBehavior;
void initializeExtensionBehavior();
void C_DECL error(TSourceLoc, const char *szReason, const char *szToken,
const char *szExtraInfoFormat, ...);
void error(TSourceLoc, const char *szReason, const char *szToken,
const char *szExtraInfoFormat, ...);
bool reservedErrorCheck(int line, const TString& identifier);
void recover();
......
......@@ -105,7 +105,7 @@ void ShDestruct(ShHandle handle)
//
// Cleanup symbol tables
//
int __fastcall ShFinalize()
int ShFinalize()
{
if (PerProcessGPA) {
PerProcessGPA->popAll();
......
......@@ -278,7 +278,7 @@ void Shader::compileToHLSL(void *compiler)
resources.maxFragmentUniformVectors = MAX_FRAGMENT_UNIFORM_VECTORS;
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 *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