diff --git a/examples/09-hdr/hdr.cpp b/examples/09-hdr/hdr.cpp index b67367330..2d945ed11 100644 --- a/examples/09-hdr/hdr.cpp +++ b/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 dv = 1.0f/_height; - uint32_t num = 0; + uint16_t num = 0; for (uint32_t yy = 0; yy < 4; ++yy) { for (uint32_t xx = 0; xx < 4; ++xx) diff --git a/scripts/shaderc.lua b/scripts/shaderc.lua index 6eeccc7a5..f9964b033 100644 --- a/scripts/shaderc.lua +++ b/scripts/shaderc.lua @@ -3,6 +3,8 @@ -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- +group "tools/shaderc" + local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer") local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp") @@ -276,3 +278,5 @@ project "shaderc" configuration {} strip() + +group "tools" diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 114ce602c..bde594c6a 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -579,7 +579,7 @@ namespace bgfx static void fppOutput(int _ch, void* _userData) { Preprocessor* thisClass = (Preprocessor*)_userData; - thisClass->m_preprocessed += _ch; + thisClass->m_preprocessed += char(_ch); } static void fppError(void* /*_userData*/, char* _format, va_list _vargs) @@ -992,7 +992,7 @@ namespace bgfx preprocessor.setDefine("M_PI=3.1415926535897932384626433832795"); - char shaderType = tolower(type[0]); + char shaderType = bx::toLower(type[0]); switch (shaderType) { case 'c': diff --git a/tools/shaderc/shaderc_glsl.cpp b/tools/shaderc/shaderc_glsl.cpp index 9356b8a0a..84bebf76e 100644 --- a/tools/shaderc/shaderc_glsl.cpp +++ b/tools/shaderc/shaderc_glsl.cpp @@ -214,8 +214,8 @@ namespace bgfx { namespace glsl bx::strlcpy(uniformName, name, array-name+1); 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) ); } else @@ -251,7 +251,7 @@ namespace bgfx { namespace glsl uint8_t nameSize = (uint8_t)un.name.size(); bx::write(_writer, 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, un.num); bx::write(_writer, un.regIndex); diff --git a/tools/shaderc/shaderc_hlsl.cpp b/tools/shaderc/shaderc_hlsl.cpp index 962657906..24bf9dc24 100644 --- a/tools/shaderc/shaderc_hlsl.cpp +++ b/tools/shaderc/shaderc_hlsl.cpp @@ -421,7 +421,7 @@ namespace bgfx { namespace hlsl , 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) { _attrs[_numAttrs] = bgfx::attribToId(ris.m_attr); @@ -475,8 +475,8 @@ namespace bgfx { namespace hlsl Uniform un; un.name = varDesc.Name; 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; _uniforms.push_back(un); @@ -527,8 +527,8 @@ namespace bgfx { namespace hlsl un.name.assign(bindDesc.Name, (end - bindDesc.Name) ); un.type = UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | UniformType::Int1); 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); } } @@ -714,7 +714,7 @@ namespace bgfx { namespace hlsl uint8_t nameSize = (uint8_t)un.name.size(); bx::write(_writer, 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, un.num); bx::write(_writer, un.regIndex); diff --git a/tools/shaderc/shaderc_spirv.cpp b/tools/shaderc/shaderc_spirv.cpp index 4c11f1ca9..aab56e110 100644 --- a/tools/shaderc/shaderc_spirv.cpp +++ b/tools/shaderc/shaderc_spirv.cpp @@ -673,14 +673,14 @@ namespace bgfx { namespace spirv un.type = UniformType::End; break; } - un.num = program->getUniformArraySize(ii); + un.num = uint8_t(program->getUniformArraySize(ii) ); un.regIndex = 0; un.regCount = un.num; uint8_t nameSize = (uint8_t)un.name.size(); bx::write(_writer, 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, un.num); bx::write(_writer, un.regIndex); diff --git a/tools/texturev/texturev.cpp b/tools/texturev/texturev.cpp index de60ce6a0..bd582c884 100644 --- a/tools/texturev/texturev.cpp +++ b/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::Middle] ? IMGUI_MBUT_MIDDLE : 0) , mouseState.m_mz - , width - , height + , uint16_t(width) + , uint16_t(height) ); static bool help = false; @@ -878,7 +878,7 @@ int _main_(int _argc, char** _argv) float ortho[16]; bx::mtxOrtho(ortho, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f); 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::dbgTextClear();