diff --git a/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/ocornut-imgui/imgui.cpp index bc946094..6db74348 100644 --- a/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/ocornut-imgui/imgui.cpp @@ -338,6 +338,7 @@ #include // new (ptr) #ifdef _MSC_VER +#pragma warning (disable: 4100) // unreferenced formal parameter #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen #endif diff --git a/examples/common/imgui/vs_ocornut_imgui.bin.h b/examples/common/imgui/vs_ocornut_imgui.bin.h index be479206..5473ca3a 100644 --- a/examples/common/imgui/vs_ocornut_imgui.bin.h +++ b/examples/common/imgui/vs_ocornut_imgui.bin.h @@ -60,35 +60,45 @@ static const uint8_t vs_ocornut_imgui_dx9[367] = 0xb4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................ 0x00, 0x02, 0x02, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... }; -static const uint8_t vs_ocornut_imgui_dx11[450] = +static const uint8_t vs_ocornut_imgui_dx11[612] = { - 0x56, 0x53, 0x48, 0x03, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xac, 0x01, 0x44, 0x58, 0x42, 0x43, // VSH.........DXBC - 0x7a, 0x4e, 0x9b, 0x63, 0x05, 0x18, 0x79, 0x85, 0xb1, 0xe7, 0x0b, 0x3c, 0x75, 0x62, 0x38, 0x17, // zN.c..y............... - 0x00, 0x00, // .. + 0x56, 0x53, 0x48, 0x03, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0b, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie + 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x3c, 0x02, 0x44, 0x58, // wTexel......<.DX + 0x42, 0x43, 0x22, 0x5c, 0xcc, 0x36, 0x58, 0xb2, 0x23, 0x45, 0x8a, 0x2b, 0xbd, 0x13, 0xac, 0xf2, // BC"..6X.#E.+.... + 0xa4, 0x09, 0x01, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // ......<.......,. + 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, // ..........ISGNh. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, // ................ + 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ..V............. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, // .........._..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, // ................ + 0x00, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, // ..COLOR.POSITION + 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x6c, 0x00, // .TEXCOORD.OSGNl. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ + 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........b..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x0c, // ................ + 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO + 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, // LOR.TEXCOORD..SH + 0x44, 0x52, 0x24, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x49, 0x00, 0x00, 0x00, 0x59, 0x00, // DR$...@...I...Y. + 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, // ..F. ........._. + 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, // .........._...2. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, // ......_...2..... + 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..g.... ........ + 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e.... ......e. + 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, // ..2 ......h..... + 0x00, 0x00, 0x36, 0x00, 0x00, 0x08, 0xc2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ..6.... .......@ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x80, 0x3f, 0x38, 0x00, 0x00, 0x08, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, // .?8...2.......F. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F. ....... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x09, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ..2.... ........ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x40, // .......@.....@.@ + 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x32, 0x00, 0x00, 0x0a, 0x22, 0x20, 0x10, 0x00, 0x00, 0x00, // ......2..." .... + 0x00, 0x00, 0x1a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, // ......A........@ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x36, 0x00, // .....@.@.....?6. + 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, // ... ......F..... + 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x10, // ..6...2 ......F. + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, // ......>......... + 0x10, 0x00, 0x10, 0x00, // .... }; diff --git a/examples/runtime/shaders/dx11/fs_tree.bin b/examples/runtime/shaders/dx11/fs_tree.bin index c60d3fd9..e3545cab 100644 Binary files a/examples/runtime/shaders/dx11/fs_tree.bin and b/examples/runtime/shaders/dx11/fs_tree.bin differ diff --git a/examples/runtime/shaders/dx11/vs_hdr_blur.bin b/examples/runtime/shaders/dx11/vs_hdr_blur.bin index 91d98de9..a4aa6bfd 100644 Binary files a/examples/runtime/shaders/dx11/vs_hdr_blur.bin and b/examples/runtime/shaders/dx11/vs_hdr_blur.bin differ diff --git a/examples/runtime/shaders/dx11/vs_hdr_tonemap.bin b/examples/runtime/shaders/dx11/vs_hdr_tonemap.bin index 91d98de9..04239696 100644 Binary files a/examples/runtime/shaders/dx11/vs_hdr_tonemap.bin and b/examples/runtime/shaders/dx11/vs_hdr_tonemap.bin differ diff --git a/examples/runtime/shaders/dx11/vs_shadowmaps_hblur.bin b/examples/runtime/shaders/dx11/vs_shadowmaps_hblur.bin index 6a61e06b..587e1c5e 100644 Binary files a/examples/runtime/shaders/dx11/vs_shadowmaps_hblur.bin and b/examples/runtime/shaders/dx11/vs_shadowmaps_hblur.bin differ diff --git a/examples/runtime/shaders/dx11/vs_shadowmaps_vblur.bin b/examples/runtime/shaders/dx11/vs_shadowmaps_vblur.bin index 6a61e06b..0bef9460 100644 Binary files a/examples/runtime/shaders/dx11/vs_shadowmaps_vblur.bin and b/examples/runtime/shaders/dx11/vs_shadowmaps_vblur.bin differ diff --git a/scripts/shaderc.lua b/scripts/shaderc.lua index 37589b09..a52f74bb 100644 --- a/scripts/shaderc.lua +++ b/scripts/shaderc.lua @@ -14,6 +14,11 @@ project "shaderc" path.join(GLSL_OPTIMIZER, "src"), } + removeflags { + -- GCC 4.9 -O2 + -fno-strict-aliasing don't work together... + "OptimizeSpeed", + } + configuration { "vs*" } includedirs { path.join(GLSL_OPTIMIZER, "src/glsl/msvc"), diff --git a/tools/shaderc/shaderc_hlsl.cpp b/tools/shaderc/shaderc_hlsl.cpp index efeb24dc..8c19a1a6 100644 --- a/tools/shaderc/shaderc_hlsl.cpp +++ b/tools/shaderc/shaderc_hlsl.cpp @@ -14,6 +14,12 @@ # define D3D_SVF_USED 2 #endif // D3D_SVF_USED +#ifndef IID_ID3D11ShaderReflection +// In case MinGW is missing IID... +static const GUID GUID_ID3D11ShaderReflection = { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } }; +# define IID_ID3D11ShaderReflection GUID_ID3D11ShaderReflection +#endif // IID_ID3D11ShaderReflection + struct CTHeader { uint32_t Size; @@ -345,7 +351,7 @@ bool getReflectionDataDx11(ID3DBlob* _code, bool _vshader, UniformArray& _unifor un.regCount = BX_ALIGN_16(varDesc.Size) / 16; _uniforms.push_back(un); - BX_TRACE("\t%s, %d, size %d, flags 0x%08x, %d" + BX_TRACE("\t%s, %d, size %d, flags 0x%08x, %d (used)" , varDesc.Name , varDesc.StartOffset , varDesc.Size @@ -355,8 +361,10 @@ bool getReflectionDataDx11(ID3DBlob* _code, bool _vshader, UniformArray& _unifor } else { - if (0 == (varDesc.uFlags & D3D_SVF_USED)) + if (0 == (varDesc.uFlags & D3D_SVF_USED) ) + { unusedUniforms.push_back(varDesc.Name); + } BX_TRACE("\t%s, unknown type", varDesc.Name); } @@ -517,18 +525,21 @@ bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::stri while (!reader.isEof() ) { std::string line = reader.getLine(); - for (UniformNameList::const_iterator it = unusedUniforms.begin(); it != unusedUniforms.end(); ++it) + for (UniformNameList::const_iterator it = unusedUniforms.begin(), itEnd = unusedUniforms.end(); it != itEnd; ++it) { size_t index = line.find("uniform "); if (index == std::string::npos) + { continue; + } // matching lines like: uniform u_name; // we want to replace "uniform" with "static" so that it's no longer - // included in the uniform blob that the application must upload + // included in the uniform blob that the application must upload x // we can't just remove them, because unused functions might still reference // them and cause a compile error when they're gone - if (line.find(*it) != std::string::npos) + ; + if (!!bx::findIdentifierMatch(line.c_str(), it->c_str() ) ) { line = line.replace(index, strLength, "static"); unusedUniforms.erase(it);