Bring up to date with VS 10 express.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@19945 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
a0af473a8b
commit
200b2734d7
15 changed files with 96 additions and 77 deletions
|
|
@ -728,41 +728,42 @@ void TBuiltIns::initialize(const TBuiltInResource &resources)
|
|||
// Implementation dependent constants. The example values below
|
||||
// are the minimum values allowed for these maximums.
|
||||
//
|
||||
char builtInConstant[80];
|
||||
sprintf(builtInConstant, "const int gl_MaxLights = %d;", resources.maxLights); // GL 1.0
|
||||
const int maxSize = 80;
|
||||
char builtInConstant[maxSize];
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxLights = %d;", resources.maxLights); // GL 1.0
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxClipPlanes = %d;", resources.maxClipPlanes); // GL 1.0
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxClipPlanes = %d;", resources.maxClipPlanes); // GL 1.0
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxTextureUnits = %d;", resources.maxTextureUnits); // GL 1.2
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxTextureUnits = %d;", resources.maxTextureUnits); // GL 1.2
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxTextureCoords = %d;", resources.maxTextureCoords); // ARB_fragment_program
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxTextureCoords = %d;", resources.maxTextureCoords); // ARB_fragment_program
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs); // ARB_vertex_shader
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs); // ARB_vertex_shader
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxVertexUniformComponents = %d;", resources.maxVertexUniformComponents); // ARB_vertex_shader
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxVertexUniformComponents = %d;", resources.maxVertexUniformComponents); // ARB_vertex_shader
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxVaryingFloats = %d;", resources.maxVaryingFloats); // ARB_vertex_shader
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxVaryingFloats = %d;", resources.maxVaryingFloats); // ARB_vertex_shader
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits); // ARB_vertex_shader
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits); // ARB_vertex_shader
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits); // ARB_vertex_shader
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits); // ARB_vertex_shader
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits); // ARB_fragment_shader
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits); // ARB_fragment_shader
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents); // ARB_fragment_shader
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents); // ARB_fragment_shader
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
sprintf(builtInConstant, "const int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers); // proposed ARB_draw_buffers
|
||||
sprintf_s(builtInConstant, maxSize, "const int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers); // proposed ARB_draw_buffers
|
||||
s.append(TString(builtInConstant));
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -203,12 +203,13 @@ void TParseContext::recover()
|
|||
void C_DECL TParseContext::error(TSourceLoc nLine, const char *szReason, const char *szToken,
|
||||
const char *szExtraInfoFormat, ...)
|
||||
{
|
||||
char szExtraInfo[400];
|
||||
const int maxSize = 400;
|
||||
char szExtraInfo[maxSize];
|
||||
va_list marker;
|
||||
|
||||
va_start(marker, szExtraInfoFormat);
|
||||
|
||||
_vsnprintf(szExtraInfo, sizeof(szExtraInfo), szExtraInfoFormat, marker);
|
||||
_vsnprintf_s(szExtraInfo, maxSize, sizeof(szExtraInfo), szExtraInfoFormat, marker);
|
||||
|
||||
/* VC++ format: file(linenum) : error #: 'token' : extrainfo */
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
|
|
@ -1126,8 +1127,8 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type
|
|||
newNode = constructBuiltIn(type, op, *p, node->getLine(), true);
|
||||
|
||||
if (newNode) {
|
||||
sequenceVector.erase(p);
|
||||
sequenceVector.insert(p, newNode);
|
||||
p = sequenceVector.erase(p);
|
||||
p = sequenceVector.insert(p, newNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,11 +193,12 @@ void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, ch
|
|||
{
|
||||
for (int x = 0; x < guardBlockSize; x++) {
|
||||
if (blockMem[x] != val) {
|
||||
const int maxSize = 80;
|
||||
char assertMsg[80];
|
||||
|
||||
// We don't print the assert message. It's here just to be helpful.
|
||||
sprintf(assertMsg, "PoolAlloc: Damage %s %lu byte allocation at 0x%p\n",
|
||||
locText, size, data());
|
||||
sprintf_s(assertMsg, maxSize, "PoolAlloc: Damage %s %lu byte allocation at 0x%p\n",
|
||||
locText, size, data());
|
||||
assert(0 && "PoolAlloc: Damage in guard block");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,8 +81,9 @@ void TType::buildMangledName(TString& mangledName)
|
|||
|
||||
mangledName += static_cast<char>('0' + getNominalSize());
|
||||
if (isArray()) {
|
||||
char buf[10];
|
||||
sprintf(buf, "%d", arraySize);
|
||||
const int maxSize = 10;
|
||||
char buf[maxSize];
|
||||
sprintf_s(buf, maxSize, "%d", arraySize);
|
||||
mangledName += '[';
|
||||
mangledName += buf;
|
||||
mangledName += ']';
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ O [0-7]
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "ParseHelper.h"
|
||||
#include "glslang_tab.h"
|
||||
#include "glslang_tab.cpp.h"
|
||||
|
||||
/* windows only pragma */
|
||||
#ifdef _MSC_VER
|
||||
|
|
@ -84,7 +84,7 @@ TSourceLoc yylineno;
|
|||
|
||||
%option noyywrap
|
||||
%option never-interactive
|
||||
%option outfile="Gen_glslang.cpp"
|
||||
%option outfile="gen_glslang.cpp"
|
||||
%x FIELDS
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -55,19 +55,21 @@ public:
|
|||
|
||||
TString TType::getCompleteString() const
|
||||
{
|
||||
char buf[100];
|
||||
const int maxSize = 100;
|
||||
char buf[maxSize];
|
||||
char *p = &buf[0];
|
||||
char *end = &buf[maxSize];
|
||||
|
||||
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
|
||||
p += sprintf(p, "%s ", getQualifierString());
|
||||
p += sprintf_s(p, end - p, "%s ", getQualifierString());
|
||||
if (array)
|
||||
p += sprintf(p, "array of ");
|
||||
p += sprintf_s(p, end - p, "array of ");
|
||||
if (matrix)
|
||||
p += sprintf(p, "%dX%d matrix of ", size, size);
|
||||
p += sprintf_s(p, end - p, "%dX%d matrix of ", size, size);
|
||||
else if (size > 1)
|
||||
p += sprintf(p, "%d-component vector of ", size);
|
||||
p += sprintf_s(p, end - p, "%d-component vector of ", size);
|
||||
|
||||
sprintf(p, "%s", getBasicString());
|
||||
sprintf_s(p, end - p, "%s", getBasicString());
|
||||
|
||||
return TString(buf);
|
||||
}
|
||||
|
|
@ -101,8 +103,9 @@ void OutputSymbol(TIntermSymbol* node, TIntermTraverser* it)
|
|||
|
||||
OutputTreeText(oit->infoSink, node, oit->depth);
|
||||
|
||||
char buf[100];
|
||||
sprintf(buf, "'%s' (%s)\n",
|
||||
const int maxSize = 100;
|
||||
char buf[maxSize];
|
||||
sprintf_s(buf, maxSize, "'%s' (%s)\n",
|
||||
node->getSymbol().c_str(),
|
||||
node->getCompleteString().c_str());
|
||||
|
||||
|
|
@ -380,16 +383,18 @@ void OutputConstantUnion(TIntermConstantUnion* node, TIntermTraverser* it)
|
|||
break;
|
||||
case EbtFloat:
|
||||
{
|
||||
char buf[300];
|
||||
sprintf(buf, "%f (%s)", node->getUnionArrayPointer()[i].getFConst(), "const float");
|
||||
const int maxSize = 300;
|
||||
char buf[maxSize];
|
||||
sprintf_s(buf, maxSize, "%f (%s)", node->getUnionArrayPointer()[i].getFConst(), "const float");
|
||||
|
||||
out.debug << buf << "\n";
|
||||
}
|
||||
break;
|
||||
case EbtInt:
|
||||
{
|
||||
char buf[300];
|
||||
sprintf(buf, "%d (%s)", node->getUnionArrayPointer()[i].getIConst(), "const int");
|
||||
const int maxSize = 300;
|
||||
char buf[maxSize];
|
||||
sprintf_s(buf, maxSize, "%d (%s)", node->getUnionArrayPointer()[i].getIConst(), "const int");
|
||||
|
||||
out.debug << buf << "\n";
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -80,8 +80,9 @@ bool ParseBinary(bool /* preVisit */, TIntermBinary* node, TIntermTraverser* it)
|
|||
TQualifier qualifier = node->getType().getQualifier();
|
||||
|
||||
if (qualifier != EvqConst) {
|
||||
char buf[200];
|
||||
sprintf(buf, "'constructor' : assigning non-constant to %s", oit->type.getCompleteString().c_str());
|
||||
const int maxSize = 200;
|
||||
char buf[maxSize];
|
||||
sprintf_s(buf, maxSize, "'constructor' : assigning non-constant to %s", oit->type.getCompleteString().c_str());
|
||||
oit->infoSink.info.message(EPrefixError, buf, node->getLine());
|
||||
oit->error = true;
|
||||
return false;
|
||||
|
|
@ -96,8 +97,9 @@ bool ParseUnary(bool /* preVisit */, TIntermUnary* node, TIntermTraverser* it)
|
|||
{
|
||||
TConstTraverser* oit = static_cast<TConstTraverser*>(it);
|
||||
|
||||
char buf[200];
|
||||
sprintf(buf, "'constructor' : assigning non-constant to '%s'", oit->type.getCompleteString().c_str());
|
||||
const int maxSize = 200;
|
||||
char buf[maxSize];
|
||||
sprintf_s(buf, maxSize, "'constructor' : assigning non-constant to '%s'", oit->type.getCompleteString().c_str());
|
||||
oit->infoSink.info.message(EPrefixError, buf, node->getLine());
|
||||
oit->error = true;
|
||||
return false;
|
||||
|
|
@ -108,8 +110,9 @@ bool ParseAggregate(bool /* preVisit */, TIntermAggregate* node, TIntermTraverse
|
|||
TConstTraverser* oit = static_cast<TConstTraverser*>(it);
|
||||
|
||||
if (!node->isConstructor() && node->getOp() != EOpComma) {
|
||||
char buf[200];
|
||||
sprintf(buf, "'constructor' : assigning non-constant to '%s'", oit->type.getCompleteString().c_str());
|
||||
const int maxSize = 200;
|
||||
char buf[maxSize];
|
||||
sprintf_s(buf, maxSize, "'constructor' : assigning non-constant to '%s'", oit->type.getCompleteString().c_str());
|
||||
oit->infoSink.info.message(EPrefixError, buf, node->getLine());
|
||||
oit->error = true;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// atom.c
|
||||
//
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// cpp.c
|
||||
//
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// scanner.c
|
||||
//
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
//
|
||||
// tokens.c
|
||||
//
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -437,6 +438,7 @@ void UngetToken(int token, yystypepp * yylvalpp) {
|
|||
|
||||
void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {
|
||||
int token;
|
||||
const int maxSize = 100;
|
||||
char str[100];
|
||||
|
||||
if (fp == 0) fp = stdout;
|
||||
|
|
@ -445,10 +447,10 @@ void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {
|
|||
switch (token) {
|
||||
case CPP_IDENTIFIER:
|
||||
case CPP_TYPEIDENTIFIER:
|
||||
sprintf(str, "%s ", GetAtomString(atable, yylvalpp->sc_ident));
|
||||
sprintf_s(str, maxSize, "%s ", GetAtomString(atable, yylvalpp->sc_ident));
|
||||
break;
|
||||
case CPP_STRCONSTANT:
|
||||
sprintf(str, "\"%s\"", GetAtomString(atable, yylvalpp->sc_ident));
|
||||
sprintf_s(str, maxSize, "\"%s\"", GetAtomString(atable, yylvalpp->sc_ident));
|
||||
break;
|
||||
case CPP_FLOATCONSTANT:
|
||||
//printf("%g9.6 ", yylvalpp->sc_fval);
|
||||
|
|
@ -458,9 +460,9 @@ void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {
|
|||
break;
|
||||
default:
|
||||
if (token >= 127)
|
||||
sprintf(str, "%s ", GetAtomString(atable, token));
|
||||
sprintf_s(str, maxSize, "%s ", GetAtomString(atable, token));
|
||||
else
|
||||
sprintf(str, "%c", token);
|
||||
sprintf_s(str, maxSize, "%c", token);
|
||||
break;
|
||||
}
|
||||
CPPDebugLogMsg(str);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue