From 57d34f557bfc74c11aeca4e87002b66813dd4404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 28 Sep 2016 16:42:15 -0700 Subject: [PATCH] Cleanup. --- src/bgfx.cpp | 4 ++-- tools/shaderc/shaderc.cpp | 8 +++++++- tools/texturec/texturec.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 6465f4f76..39e6c2110 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -483,7 +483,7 @@ namespace bgfx BGFX_DECLARE_SHADER_EMBEDDED(fs_clear6), BGFX_DECLARE_SHADER_EMBEDDED(fs_clear7), - { NULL, { bgfx::RendererType::Count, NULL, 0 } } + { NULL, { { bgfx::RendererType::Count, NULL, 0 } } } }; static ShaderHandle createEmbeddedShader(RendererType::Enum _type, const char* _name) @@ -1291,7 +1291,7 @@ namespace bgfx g_caps.formats[fmt] |= 0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_CUBE) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED : 0; } - for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) + for (uint32_t ii = 0; ii < TextureFormat::UnknownDepth; ++ii) { bool convertable = imageConvert(TextureFormat::BGRA8, TextureFormat::Enum(ii) ); g_caps.formats[ii] |= 0 == (g_caps.formats[ii] & BGFX_CAPS_FORMAT_TEXTURE_2D ) && convertable ? BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED : 0; diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 08f3b4efd..b2d142e14 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -138,7 +138,13 @@ namespace bgfx const char* getUniformTypeName(UniformType::Enum _enum) { - return s_uniformTypeName[_enum]; + uint32_t idx = _enum & ~(BGFX_UNIFORM_FRAGMENTBIT|BGFX_UNIFORM_SAMPLERBIT); + if (idx < UniformType::Count) + { + return s_uniformTypeName[idx]; + } + + return "Unknown uniform type?!"; } UniformType::Enum nameToUniformTypeEnum(const char* _name) diff --git a/tools/texturec/texturec.cpp b/tools/texturec/texturec.cpp index d47efec05..9d4fff142 100644 --- a/tools/texturec/texturec.cpp +++ b/tools/texturec/texturec.cpp @@ -662,10 +662,10 @@ int main(int _argc, const char* _argv[]) { const uint32_t offset = (yy*mip.m_width + xx) * 4; float* inout = &rgba[offset]; - inout[0] = inout[0] * 2.0f/255.0f - 1.0f; - inout[1] = inout[1] * 2.0f/255.0f - 1.0f; - inout[2] = inout[2] * 2.0f/255.0f - 1.0f; - inout[3] = inout[3] * 2.0f/255.0f - 1.0f; + inout[0] = inout[0] * 2.0f - 1.0f; + inout[1] = inout[1] * 2.0f - 1.0f; + inout[2] = inout[2] * 2.0f - 1.0f; + inout[3] = inout[3] * 2.0f - 1.0f; } } }