diff options
| author | Yong He <yonghe@outlook.com> | 2017-11-04 18:43:03 -0400 |
|---|---|---|
| committer | Yong He <yonghe@outlook.com> | 2017-11-04 18:43:03 -0400 |
| commit | 215ce206838db63fdd310a0ababe421799011d21 (patch) | |
| tree | db190abec3cd8c814a59a6f4905adcaf89bbe058 /source | |
| parent | 784bd914cface6e5837ef0da7aee0df2e16c4999 (diff) | |
fixes x64 warnings
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang-glslang/slang-glslang.vcxproj | 4 | ||||
| -rw-r--r-- | source/slang/bytecode.cpp | 34 | ||||
| -rw-r--r-- | source/slang/bytecode.h | 2 | ||||
| -rw-r--r-- | source/slang/ir.cpp | 2 | ||||
| -rw-r--r-- | source/slang/vm.cpp | 4 |
5 files changed, 25 insertions, 21 deletions
diff --git a/source/slang-glslang/slang-glslang.vcxproj b/source/slang-glslang/slang-glslang.vcxproj index be617f363..068854eba 100644 --- a/source/slang-glslang/slang-glslang.vcxproj +++ b/source/slang-glslang/slang-glslang.vcxproj @@ -97,6 +97,7 @@ <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>NV_EXTENSIONS;AMD_EXTENSIONS;WIN32;_DEBUG;_WINDOWS;_USRDLL;GLSLANG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DisableSpecificWarnings>4819;4267</DisableSpecificWarnings> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -110,6 +111,7 @@ <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>NV_EXTENSIONS;AMD_EXTENSIONS;_DEBUG;_WINDOWS;_USRDLL;GLSLANG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DisableSpecificWarnings>4819;4267</DisableSpecificWarnings> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -125,6 +127,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>NV_EXTENSIONS;AMD_EXTENSIONS;WIN32;NDEBUG;_WINDOWS;_USRDLL;GLSLANG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DisableSpecificWarnings>4819;4267</DisableSpecificWarnings> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -142,6 +145,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>NV_EXTENSIONS;AMD_EXTENSIONS;NDEBUG;_WINDOWS;_USRDLL;GLSLANG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DisableSpecificWarnings>4819;4267</DisableSpecificWarnings> </ClCompile> <Link> <SubSystem>Windows</SubSystem> diff --git a/source/slang/bytecode.cpp b/source/slang/bytecode.cpp index e3cd9e74e..943a9a5a3 100644 --- a/source/slang/bytecode.cpp +++ b/source/slang/bytecode.cpp @@ -156,7 +156,7 @@ BCPtr<void>::RawVal allocateRaw( for(size_t ii = currentOffset; ii < endOffset; ++ii) context->shared->bytecode.Add(0); - return beginOffset; + return (BCPtr<void>::RawVal)beginOffset; } template<typename T> @@ -258,7 +258,7 @@ BCConst getGlobalValue( BCConst bcConst; bcConst.flavor = kBCConstFlavor_Constant; - bcConst.id = constID; + bcConst.id = (uint32_t)constID; context->shared->mapValueToGlobal.Add(value, bcConst); @@ -481,7 +481,7 @@ BytecodeGenerationPtr<BCType> emitBCType( auto bcArgs = (bcType + 1).bitCast<BCPtr<uint8_t>>(); bcType->op = op; - bcType->argCount = argCount; + bcType->argCount = (uint32_t)argCount; for(UInt aa = 0; aa < argCount; ++aa) { @@ -491,7 +491,7 @@ BytecodeGenerationPtr<BCType> emitBCType( UInt id = context->shared->bcTypes.Count(); context->shared->mapTypeToID.Add(type, id); context->shared->bcTypes.Add(bcType); - bcType->id = id; + bcType->id = (uint32_t)id; return bcType; } @@ -705,7 +705,7 @@ BytecodeGenerationPtr<BCSymbol> generateBytecodeSymbolForInst( // Allocate the array of block objects to be stored in the // bytecode file. auto bcBlocks = allocateArray<BCBlock>(context, blockCount); - bcFunc->blockCount = blockCount; + bcFunc->blockCount = (uint32_t)blockCount; bcFunc->blocks = bcBlocks; // Now loop through the blocks again, and allocate the storage @@ -752,7 +752,7 @@ BytecodeGenerationPtr<BCSymbol> generateBytecodeSymbolForInst( } } - bcBlocks[blockID].paramCount = paramCount; + bcBlocks[blockID].paramCount = (uint32_t)paramCount; } // Okay, we've counted how many registers we need for each block, @@ -760,7 +760,7 @@ BytecodeGenerationPtr<BCSymbol> generateBytecodeSymbolForInst( UInt regCount = regCounter; auto bcRegs = allocateArray<BCReg>(context, regCount); - bcFunc->regCount = regCount; + bcFunc->regCount = (uint32_t)regCount; bcFunc->regs = bcRegs; // Now we will loop over things again to fill in the information @@ -788,7 +788,7 @@ BytecodeGenerationPtr<BCSymbol> generateBytecodeSymbolForInst( #if 0 bcRegs[localID].name = tryGenerateNameForSymbol(context, pp); #endif - bcRegs[localID].previousVarIndexPlusOne = localID; + bcRegs[localID].previousVarIndexPlusOne = (uint32_t)localID; bcRegs[localID].typeID = getTypeIDForGlobalSymbol(context, pp); } @@ -810,7 +810,7 @@ BytecodeGenerationPtr<BCSymbol> generateBytecodeSymbolForInst( #if 0 bcRegs[localID].name = tryGenerateNameForSymbol(context, ii); #endif - bcRegs[localID].previousVarIndexPlusOne = localID; + bcRegs[localID].previousVarIndexPlusOne = (uint32_t)localID; bcRegs[localID].typeID = getTypeIDForGlobalSymbol(context, ii); } break; @@ -830,11 +830,11 @@ BytecodeGenerationPtr<BCSymbol> generateBytecodeSymbolForInst( #if 0 bcRegs[localID].name = tryGenerateNameForSymbol(context, ii); #endif - bcRegs[localID].previousVarIndexPlusOne = localID; + bcRegs[localID].previousVarIndexPlusOne = (uint32_t)localID; bcRegs[localID].typeID = getTypeIDForGlobalSymbol(context, ii); bcRegs[localID+1].op = ii->op; - bcRegs[localID+1].previousVarIndexPlusOne = localID+1; + bcRegs[localID+1].previousVarIndexPlusOne = (uint32_t)localID+1; bcRegs[localID+1].typeID = getTypeID(context, (ii->getType()->As<PtrType>())->getValueType()); } @@ -905,7 +905,7 @@ BytecodeGenerationPtr<BCSymbol> generateBytecodeSymbolForInst( UInt constCount = subContext->remappedGlobalSymbols.Count(); auto bcConsts = allocateArray<BCConst>(context, constCount); - bcFunc->constCount = constCount; + bcFunc->constCount = (uint32_t)constCount; bcFunc->consts = bcConsts; for( UInt cc = 0; cc < constCount; ++cc ) @@ -971,7 +971,7 @@ BytecodeGenerationPtr<BCModule> generateBytecodeForModule( // Ensure that local code inside functions can see these symbols BCConst bcConst; bcConst.flavor = kBCConstFlavor_GlobalSymbol; - bcConst.id = globalID; + bcConst.id = (uint32_t)globalID; context->shared->mapValueToGlobal.Add(gv, bcConst); // In the global scope, global IDs are also the local IDs @@ -980,7 +980,7 @@ BytecodeGenerationPtr<BCModule> generateBytecodeForModule( auto bcSymbols = allocateArray<BCPtr<BCSymbol>>(context, symbolCount); - bcModule->symbolCount = symbolCount; + bcModule->symbolCount = (uint32_t)symbolCount; bcModule->symbols = bcSymbols; for( auto gv = irModule->getFirstGlobalValue(); gv; gv = gv->getNextValue() ) @@ -1000,7 +1000,7 @@ BytecodeGenerationPtr<BCModule> generateBytecodeForModule( // At this point we should have identified all the literals we need: UInt constantCount = context->shared->constants.Count(); auto bcConstants = allocateArray<BCConstant>(context, constantCount); - bcModule->constantCount = constantCount; + bcModule->constantCount = (uint32_t)constantCount; bcModule->constants = bcConstants; for(UInt cc = 0; cc < constantCount; ++cc) @@ -1028,7 +1028,7 @@ BytecodeGenerationPtr<BCModule> generateBytecodeForModule( // At this point we should have collected all the types we need: UInt typeCount = context->shared->bcTypes.Count(); auto bcTypes = allocateArray<BCPtr<BCType>>(context, typeCount); - bcModule->typeCount = typeCount; + bcModule->typeCount = (uint32_t)typeCount; bcModule->types = bcTypes; for(UInt tt = 0; tt < typeCount; ++tt) @@ -1065,7 +1065,7 @@ void generateBytecodeContainer( } UInt bcModuleCount = bcModulesList.Count(); - header->moduleCount = bcModuleCount; + header->moduleCount = (uint32_t)bcModuleCount; auto bcModules = allocateArray<BCPtr<BCModule>>(context, bcModuleCount); header->modules = bcModules; diff --git a/source/slang/bytecode.h b/source/slang/bytecode.h index 75b9f15cd..f1ad52c32 100644 --- a/source/slang/bytecode.h +++ b/source/slang/bytecode.h @@ -56,7 +56,7 @@ struct BCPtr { if (ptr) { - rawVal = (char*)ptr - (char*)this; + rawVal = (RawVal)((char*)ptr - (char*)this); } else { diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp index efd3730ae..ca82b21e7 100644 --- a/source/slang/ir.cpp +++ b/source/slang/ir.cpp @@ -260,7 +260,7 @@ namespace Slang IRInst* inst = (IRInst*) malloc(size); memset(inst, 0, size); - inst->argCount = fixedArgCount + varArgCount; + inst->argCount = (uint32_t)(fixedArgCount + varArgCount); inst->op = op; diff --git a/source/slang/vm.cpp b/source/slang/vm.cpp index 02f8e82fd..d795a841b 100644 --- a/source/slang/vm.cpp +++ b/source/slang/vm.cpp @@ -587,7 +587,7 @@ VMType loadVMType( VMTypeImpl* impl = (VMTypeImpl*) alloca(size); memset(impl, 0, size); impl->op = bcType->op; - impl->argCount = argCount; + impl->argCount = (uint32_t)argCount; VMVal* args = (VMVal*) (impl + 1); for(UInt aa = 0; aa < argCount; ++aa) @@ -732,7 +732,7 @@ void* findGlobalSymbolPtr( continue; if(strcmp(symbolName, name) == 0) - return getGlobalPtr(module, ss); + return getGlobalPtr(module, (uint32_t)ss); } return nullptr; |
