Browse Source

VS: Fixing L4 warnings.

Branimir Karadžić 8 years ago
parent
commit
46ec8d3ca4

+ 1 - 1
examples/09-hdr/hdr.cpp

@@ -120,7 +120,7 @@ void setOffsets4x4Lum(bgfx::UniformHandle _handle, uint32_t _width, uint32_t _he
 	float du = 1.0f/_width;
 	float du = 1.0f/_width;
 	float dv = 1.0f/_height;
 	float dv = 1.0f/_height;
 
 
-	uint32_t num = 0;
+	uint16_t num = 0;
 	for (uint32_t yy = 0; yy < 4; ++yy)
 	for (uint32_t yy = 0; yy < 4; ++yy)
 	{
 	{
 		for (uint32_t xx = 0; xx < 4; ++xx)
 		for (uint32_t xx = 0; xx < 4; ++xx)

+ 4 - 0
scripts/shaderc.lua

@@ -3,6 +3,8 @@
 -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
 -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
 --
 --
 
 
+group "tools/shaderc"
+
 local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer")
 local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer")
 local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp")
 local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp")
 
 
@@ -276,3 +278,5 @@ project "shaderc"
 	configuration {}
 	configuration {}
 
 
 	strip()
 	strip()
+
+group "tools"

+ 2 - 2
tools/shaderc/shaderc.cpp

@@ -579,7 +579,7 @@ namespace bgfx
 		static void fppOutput(int _ch, void* _userData)
 		static void fppOutput(int _ch, void* _userData)
 		{
 		{
 			Preprocessor* thisClass = (Preprocessor*)_userData;
 			Preprocessor* thisClass = (Preprocessor*)_userData;
-			thisClass->m_preprocessed += _ch;
+			thisClass->m_preprocessed += char(_ch);
 		}
 		}
 
 
 		static void fppError(void* /*_userData*/, char* _format, va_list _vargs)
 		static void fppError(void* /*_userData*/, char* _format, va_list _vargs)
@@ -992,7 +992,7 @@ namespace bgfx
 
 
 		preprocessor.setDefine("M_PI=3.1415926535897932384626433832795");
 		preprocessor.setDefine("M_PI=3.1415926535897932384626433832795");
 
 
-		char shaderType = tolower(type[0]);
+		char shaderType = bx::toLower(type[0]);
 		switch (shaderType)
 		switch (shaderType)
 		{
 		{
 		case 'c':
 		case 'c':

+ 3 - 3
tools/shaderc/shaderc_glsl.cpp

@@ -214,8 +214,8 @@ namespace bgfx { namespace glsl
 						bx::strlcpy(uniformName, name, array-name+1);
 						bx::strlcpy(uniformName, name, array-name+1);
 
 
 						char arraySize[32];
 						char arraySize[32];
-						const char* end = bx::strnstr(array, "]", eol-array);
-						bx::strlcpy(arraySize, array+1, end-array);
+						const char* arrayEnd = bx::strnstr(array, "]", eol-array);
+						bx::strlcpy(arraySize, array+1, arrayEnd-array);
 						num = uint8_t(atoi(arraySize) );
 						num = uint8_t(atoi(arraySize) );
 					}
 					}
 					else
 					else
@@ -251,7 +251,7 @@ namespace bgfx { namespace glsl
 			uint8_t nameSize = (uint8_t)un.name.size();
 			uint8_t nameSize = (uint8_t)un.name.size();
 			bx::write(_writer, nameSize);
 			bx::write(_writer, nameSize);
 			bx::write(_writer, un.name.c_str(), nameSize);
 			bx::write(_writer, un.name.c_str(), nameSize);
-			uint8_t uniformType = un.type;
+			uint8_t uniformType = uint8_t(un.type);
 			bx::write(_writer, uniformType);
 			bx::write(_writer, uniformType);
 			bx::write(_writer, un.num);
 			bx::write(_writer, un.num);
 			bx::write(_writer, un.regIndex);
 			bx::write(_writer, un.regIndex);

+ 6 - 6
tools/shaderc/shaderc_hlsl.cpp

@@ -421,7 +421,7 @@ namespace bgfx { namespace hlsl
 					, spd.Register
 					, spd.Register
 					);
 					);
 
 
-				const RemapInputSemantic& ris = findInputSemantic(spd.SemanticName, spd.SemanticIndex);
+				const RemapInputSemantic& ris = findInputSemantic(spd.SemanticName, uint8_t(spd.SemanticIndex) );
 				if (ris.m_attr != bgfx::Attrib::Count)
 				if (ris.m_attr != bgfx::Attrib::Count)
 				{
 				{
 					_attrs[_numAttrs] = bgfx::attribToId(ris.m_attr);
 					_attrs[_numAttrs] = bgfx::attribToId(ris.m_attr);
@@ -475,8 +475,8 @@ namespace bgfx { namespace hlsl
 								Uniform un;
 								Uniform un;
 								un.name = varDesc.Name;
 								un.name = varDesc.Name;
 								un.type = uniformType;
 								un.type = uniformType;
-								un.num = constDesc.Elements;
-								un.regIndex = varDesc.StartOffset;
+								un.num = uint8_t(constDesc.Elements);
+								un.regIndex = uint16_t(varDesc.StartOffset);
 								un.regCount = BX_ALIGN_16(varDesc.Size) / 16;
 								un.regCount = BX_ALIGN_16(varDesc.Size) / 16;
 								_uniforms.push_back(un);
 								_uniforms.push_back(un);
 
 
@@ -527,8 +527,8 @@ namespace bgfx { namespace hlsl
 						un.name.assign(bindDesc.Name, (end - bindDesc.Name) );
 						un.name.assign(bindDesc.Name, (end - bindDesc.Name) );
 						un.type = UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | UniformType::Int1);
 						un.type = UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | UniformType::Int1);
 						un.num = 1;
 						un.num = 1;
-						un.regIndex = bindDesc.BindPoint;
-						un.regCount = bindDesc.BindCount;
+						un.regIndex = uint16_t(bindDesc.BindPoint);
+						un.regCount = uint16_t(bindDesc.BindCount);
 						_uniforms.push_back(un);
 						_uniforms.push_back(un);
 					}
 					}
 				}
 				}
@@ -714,7 +714,7 @@ namespace bgfx { namespace hlsl
 				uint8_t nameSize = (uint8_t)un.name.size();
 				uint8_t nameSize = (uint8_t)un.name.size();
 				bx::write(_writer, nameSize);
 				bx::write(_writer, nameSize);
 				bx::write(_writer, un.name.c_str(), nameSize);
 				bx::write(_writer, un.name.c_str(), nameSize);
-				uint8_t type = un.type | fragmentBit;
+				uint8_t type = uint8_t(un.type | fragmentBit);
 				bx::write(_writer, type);
 				bx::write(_writer, type);
 				bx::write(_writer, un.num);
 				bx::write(_writer, un.num);
 				bx::write(_writer, un.regIndex);
 				bx::write(_writer, un.regIndex);

+ 2 - 2
tools/shaderc/shaderc_spirv.cpp

@@ -673,14 +673,14 @@ namespace bgfx { namespace spirv
 							un.type = UniformType::End;
 							un.type = UniformType::End;
 							break;
 							break;
 						}
 						}
-						un.num = program->getUniformArraySize(ii);
+						un.num = uint8_t(program->getUniformArraySize(ii) );
 						un.regIndex = 0;
 						un.regIndex = 0;
 						un.regCount = un.num;
 						un.regCount = un.num;
 
 
 						uint8_t nameSize = (uint8_t)un.name.size();
 						uint8_t nameSize = (uint8_t)un.name.size();
 						bx::write(_writer, nameSize);
 						bx::write(_writer, nameSize);
 						bx::write(_writer, un.name.c_str(), nameSize);
 						bx::write(_writer, un.name.c_str(), nameSize);
-						uint8_t type = un.type | fragmentBit;
+						uint8_t type = uint8_t(un.type | fragmentBit);
 						bx::write(_writer, type);
 						bx::write(_writer, type);
 						bx::write(_writer, un.num);
 						bx::write(_writer, un.num);
 						bx::write(_writer, un.regIndex);
 						bx::write(_writer, un.regIndex);

+ 3 - 3
tools/texturev/texturev.cpp

@@ -759,8 +759,8 @@ int _main_(int _argc, char** _argv)
 				| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT  : 0)
 				| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT  : 0)
 				| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
 				| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
 				, mouseState.m_mz
 				, mouseState.m_mz
-				, width
-				, height
+				, uint16_t(width)
+				, uint16_t(height)
 				);
 				);
 
 
 			static bool help = false;
 			static bool help = false;
@@ -878,7 +878,7 @@ int _main_(int _argc, char** _argv)
 			float ortho[16];
 			float ortho[16];
 			bx::mtxOrtho(ortho, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f);
 			bx::mtxOrtho(ortho, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f);
 			bgfx::setViewTransform(0, NULL, ortho);
 			bgfx::setViewTransform(0, NULL, ortho);
-			bgfx::setViewRect(0, 0, 0, width, height);
+			bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) );
 			bgfx::touch(0);
 			bgfx::touch(0);
 
 
 			bgfx::dbgTextClear();
 			bgfx::dbgTextClear();