{
Op opcode = specConstant ? OpSpecConstant : OpConstant;
Id typeId = makeFloatType(32);
- unsigned value = *(unsigned int*)&f;
+ union { float fl; unsigned int ui; } u;
+ u.fl = f;
+ unsigned value = u.ui;
// See if we already made it. Applies only to regular constants, because specialization constants
// must remain distinct for the purpose of applying a SpecId decoration.
{
Op opcode = specConstant ? OpSpecConstant : OpConstant;
Id typeId = makeFloatType(64);
- unsigned long long value = *(unsigned long long*)&d;
+ union { double db; unsigned long long ull; } u;
+ u.db = d;
+ unsigned long long value = u.ull;
unsigned op1 = value & 0xFFFFFFFF;
unsigned op2 = value >> 32;
namespace spv {
-void Kill(std::ostream& out, const char* message)
+static void Kill(std::ostream& out, const char* message)
{
out << std::endl << "Disassembly failed: " << message << std::endl;
exit(1);
return;
}
-void GLSLstd450GetDebugNames(const char** names)
+static void GLSLstd450GetDebugNames(const char** names)
{
for (int i = 0; i < GLSLstd450Count; ++i)
names[i] = "Unknown";
const char* ImageFormatString(int);
const char* ImageChannelOrderString(int);
const char* ImageChannelTypeString(int);
+const char* ImageChannelDataTypeString(int type);
+const char* ImageOperandsString(int format);
const char* ImageOperands(int);
const char* FPFastMathString(int);
const char* FPRoundingModeString(int);
const char* KernelProfilingInfoString(int);
const char* CapabilityString(int);
const char* OpcodeString(int);
+const char* ScopeString(int mem);
// For grouping opcodes into subsections
enum OpcodeClass {
TCompiler* ConstructCompiler(EShLanguage, int);
TShHandleBase* ConstructLinker(EShExecutable, int);
+TShHandleBase* ConstructBindings();
void DeleteLinker(TShHandleBase*);
+void DeleteBindingList(TShHandleBase* bindingList);
TUniformMap* ConstructUniformMap();
void DeleteCompiler(TCompiler*);
using namespace glslang;
+typedef union {
+ double d;
+ int i[2];
+} DoubleIntUnion;
+
// Some helper functions
bool isNan(double x)
{
+ DoubleIntUnion u;
// tough to find a platform independent library function, do it directly
- int bitPatternL = *(int*)&x;
- int bitPatternH = *((int*)&x + 1);
+ u.d = x;
+ int bitPatternL = u.i[0];
+ int bitPatternH = u.i[1];
return (bitPatternH & 0x7ff80000) == 0x7ff80000 &&
((bitPatternH & 0xFFFFF) != 0 || bitPatternL != 0);
}
bool isInf(double x)
{
+ DoubleIntUnion u;
// tough to find a platform independent library function, do it directly
- int bitPatternL = *(int*)&x;
- int bitPatternH = *((int*)&x + 1);
+ u.d = x;
+ int bitPatternL = u.i[0];
+ int bitPatternH = u.i[1];
return (bitPatternH & 0x7ff00000) == 0x7ff00000 &&
(bitPatternH & 0xFFFFF) == 0 && bitPatternL == 0;
}
case EbtInt:
if (rightUnionArray[i] == 0)
newConstArray[i].setIConst(0x7FFFFFFF);
- else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == 0x80000000)
+ else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)0x80000000)
newConstArray[i].setIConst(0x80000000);
else
newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst());
// New built-in variables should use a generic (textually declarable) qualifier in
// TStoraregQualifier and only call BuiltInVariable().
//
-void SpecialQualifier(const char* name, TStorageQualifier qualifier, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
+static void SpecialQualifier(const char* name, TStorageQualifier qualifier, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
{
TSymbol* symbol = symbolTable.find(name);
if (symbol) {
//
// Safe to call even if name is not present.
//
-void BuiltInVariable(const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
+static void BuiltInVariable(const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
{
TSymbol* symbol = symbolTable.find(name);
if (! symbol)
//
// See comments above for other detail.
//
-void BuiltInVariable(const char* blockName, const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
+static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
{
TSymbol* symbol = symbolTable.find(blockName);
if (! symbol)
#endif
{
#ifdef GUARD_BLOCKS
- for (int x = 0; x < guardBlockSize; x++) {
+ for (size_t x = 0; x < guardBlockSize; x++) {
if (blockMem[x] != val) {
const int maxSize = 80;
char assertMsg[maxSize];
#include "preprocessor/PpContext.h"
#include "preprocessor/PpTokens.h"
-namespace glslang {
+// Required to avoid missing prototype warnings for some compilers
+int yylex(YYSTYPE*, glslang::TParseContext&);
+namespace glslang {
+
// read past any white space
void TInputScanner::consumeWhiteSpace(bool& foundNonSpaceTab)
{
// Helper functions for printing, not part of traversing.
//
-void OutputTreeText(TInfoSink& infoSink, const TIntermNode* node, const int depth)
+static void OutputTreeText(TInfoSink& infoSink, const TIntermNode* node, const int depth)
{
int i;
return false;
}
-void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, int depth)
+static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, int depth)
{
int size = node->getType().computeNumComponents();
// Wrapper for Linux call to DetachThread. This is required as pthread_cleanup_push() expects
// the cleanup routine to return void.
//
-void DetachThreadLinux(void *)
+static void DetachThreadLinux(void *)
{
DetachThread();
}
void* OS_CreateThread(TThreadEntrypoint);
void OS_WaitForAllThreads(void* threads, int numThreads);
+void OS_CleanupThreadData(void);
void OS_Sleep(int milliseconds);
void OS_DumpMemoryCounters();