summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-02-21 11:35:58 +0100
committer ImJezze <jezze@gmx.net>2016-02-21 11:35:58 +0100
commitb5daabda5495dea5c50e17961ecfed2ea8619d76 (patch)
treef192bedcd7939c68d40a75a1901239be7f52de07
parente57c90084c5d1dd9f6cdb0bbbf8782dc4f369cda (diff)
parentc24b31a077c2103b27e4df67d3be825c0c7d379d (diff)
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Resolved Conflicts: - src/osd/modules/render/d3d/d3dhlsl.cpp
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore10
-rw-r--r--3rdparty/benchmark/.gitignore46
-rw-r--r--3rdparty/benchmark/.travis-setup.sh26
-rw-r--r--3rdparty/benchmark/.travis.yml41
-rw-r--r--3rdparty/benchmark/.ycm_extra_conf.py115
-rw-r--r--3rdparty/benchmark/AUTHORS30
-rw-r--r--3rdparty/benchmark/CMakeLists.txt112
-rw-r--r--3rdparty/benchmark/CONTRIBUTING.md58
-rw-r--r--3rdparty/benchmark/CONTRIBUTORS46
-rw-r--r--3rdparty/benchmark/LICENSE202
-rw-r--r--3rdparty/benchmark/README.md295
-rw-r--r--3rdparty/benchmark/appveyor.yml55
-rw-r--r--3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake37
-rw-r--r--3rdparty/benchmark/cmake/CXXFeatureCheck.cmake39
-rw-r--r--3rdparty/benchmark/cmake/GetGitVersion.cmake51
-rw-r--r--3rdparty/benchmark/cmake/gnu_posix_regex.cpp12
-rw-r--r--3rdparty/benchmark/cmake/posix_regex.cpp12
-rw-r--r--3rdparty/benchmark/cmake/std_regex.cpp10
-rw-r--r--3rdparty/benchmark/cmake/steady_clock.cpp7
-rw-r--r--3rdparty/benchmark/cmake/thread_safety_attributes.cpp4
-rw-r--r--3rdparty/benchmark/include/benchmark/benchmark.h21
-rw-r--r--3rdparty/benchmark/include/benchmark/benchmark_api.h602
-rw-r--r--3rdparty/benchmark/include/benchmark/macros.h48
-rw-r--r--3rdparty/benchmark/include/benchmark/reporter.h122
-rw-r--r--3rdparty/benchmark/mingw.py320
-rw-r--r--3rdparty/benchmark/src/CMakeLists.txt51
-rw-r--r--3rdparty/benchmark/src/arraysize.h34
-rw-r--r--3rdparty/benchmark/src/benchmark.cc919
-rw-r--r--3rdparty/benchmark/src/check.h60
-rw-r--r--3rdparty/benchmark/src/colorprint.cc116
-rw-r--r--3rdparty/benchmark/src/colorprint.h19
-rw-r--r--3rdparty/benchmark/src/commandlineflags.cc220
-rw-r--r--3rdparty/benchmark/src/commandlineflags.h76
-rw-r--r--3rdparty/benchmark/src/console_reporter.cc116
-rw-r--r--3rdparty/benchmark/src/csv_reporter.cc105
-rw-r--r--3rdparty/benchmark/src/cycleclock.h137
-rw-r--r--3rdparty/benchmark/src/internal_macros.h40
-rw-r--r--3rdparty/benchmark/src/json_reporter.cc159
-rw-r--r--3rdparty/benchmark/src/log.cc40
-rw-r--r--3rdparty/benchmark/src/log.h28
-rw-r--r--3rdparty/benchmark/src/mutex.h142
-rw-r--r--3rdparty/benchmark/src/re.h60
-rw-r--r--3rdparty/benchmark/src/re_posix.cc59
-rw-r--r--3rdparty/benchmark/src/re_std.cc44
-rw-r--r--3rdparty/benchmark/src/reporter.cc86
-rw-r--r--3rdparty/benchmark/src/sleep.cc50
-rw-r--r--3rdparty/benchmark/src/sleep.h17
-rw-r--r--3rdparty/benchmark/src/stat.h307
-rw-r--r--3rdparty/benchmark/src/string_util.cc169
-rw-r--r--3rdparty/benchmark/src/string_util.h44
-rw-r--r--3rdparty/benchmark/src/sysinfo.cc416
-rw-r--r--3rdparty/benchmark/src/sysinfo.h12
-rw-r--r--3rdparty/benchmark/src/walltime.cc263
-rw-r--r--3rdparty/benchmark/src/walltime.h17
-rw-r--r--3rdparty/benchmark/test/CMakeLists.txt89
-rw-r--r--3rdparty/benchmark/test/basic_test.cc102
-rw-r--r--3rdparty/benchmark/test/benchmark_test.cc154
-rw-r--r--3rdparty/benchmark/test/cxx03_test.cc31
-rw-r--r--3rdparty/benchmark/test/filter_test.cc91
-rw-r--r--3rdparty/benchmark/test/fixture_test.cc42
-rw-r--r--3rdparty/benchmark/test/options_test.cc26
-rw-r--r--3rdparty/bgfx/.appveyor.yml22
-rw-r--r--3rdparty/bgfx/.travis.yml22
-rw-r--r--3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h2
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/LICENSE.txt24
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/Math.hpp90
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp51
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp719
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp9
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/Tables.cpp109
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/Tables.hpp25
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/Types.hpp17
-rw-r--r--3rdparty/bgfx/3rdparty/etc2/Vector.hpp222
-rw-r--r--3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp2
-rw-r--r--3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore2
-rw-r--r--3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp12
-rw-r--r--3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore58
-rw-r--r--3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py183
-rw-r--r--3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE22
-rw-r--r--3rdparty/bgfx/3rdparty/iconfontheaders/README.md29
-rw-r--r--3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome.h611
-rw-r--r--3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h234
-rw-r--r--3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h938
-rw-r--r--3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h2
-rw-r--r--3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h2
-rw-r--r--3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h2
-rw-r--r--3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h2
-rw-r--r--3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h5
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp235
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h134
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp37
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp49
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h15
-rw-r--r--3rdparty/bgfx/3rdparty/pvrtc/BitScale.h2
-rw-r--r--3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c3
-rw-r--r--3rdparty/bgfx/3rdparty/stb/stb_image.c1
-rw-r--r--3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h15
-rw-r--r--3rdparty/bgfx/README.md23
-rw-r--r--3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h51
-rw-r--r--3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h36
-rw-r--r--3rdparty/bgfx/examples/08-update/update.cpp10
-rw-r--r--3rdparty/bgfx/examples/09-hdr/hdr.cpp4
-rw-r--r--3rdparty/bgfx/examples/10-font/font.cpp26
-rw-r--r--3rdparty/bgfx/examples/13-stencil/stencil.cpp4
-rw-r--r--3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp8
-rw-r--r--3rdparty/bgfx/examples/15-shadowmaps-simple/fs_sms_shadow_pd.sc6
-rw-r--r--3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp15
-rw-r--r--3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp22
-rw-r--r--3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h14
-rw-r--r--3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h25
-rw-r--r--3rdparty/bgfx/examples/27-terrain/terrain.cpp26
-rw-r--r--3rdparty/bgfx/examples/common/aviwriter.h6
-rw-r--r--3rdparty/bgfx/examples/common/bgfx_utils.cpp23
-rw-r--r--3rdparty/bgfx/examples/common/bounds.cpp96
-rw-r--r--3rdparty/bgfx/examples/common/bounds.h6
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_ios.mm10
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_p.h2
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_sdl.cpp157
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_windows.cpp2
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_x11.cpp35
-rw-r--r--3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h47
-rw-r--r--3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h84
-rw-r--r--3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h102
-rw-r--r--3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h27
-rw-r--r--3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h27
-rw-r--r--3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h27
-rw-r--r--3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h14
-rw-r--r--3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h26
-rw-r--r--3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h26
-rw-r--r--3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h28
-rw-r--r--3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h46
-rw-r--r--3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h22
-rw-r--r--3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h17
-rw-r--r--3rdparty/bgfx/examples/common/imgui/imgui.cpp9
-rw-r--r--3rdparty/bgfx/examples/common/imgui/imgui.h24
-rw-r--r--3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp10
-rw-r--r--3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h26
-rw-r--r--3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h25
-rw-r--r--3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h26
-rw-r--r--3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h25
-rw-r--r--3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h30
-rw-r--r--3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h33
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h132
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/nanovg.h6
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp98
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h35
-rw-r--r--3rdparty/bgfx/examples/common/shaderlib.sh30
-rw-r--r--3rdparty/bgfx/examples/runtime/font/kenney-icon-font.ttfbin0 -> 46184 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt35
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.binbin603 -> 603 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.binbin3573 -> 3573 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.binbin6510 -> 6534 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.binbin3545 -> 3545 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.binbin6398 -> 6422 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.binbin5203 -> 5203 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.binbin5231 -> 5231 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.binbin3457 -> 3457 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.binbin6046 -> 6070 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.binbin3429 -> 3429 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.binbin5934 -> 5958 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.binbin5087 -> 5087 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.binbin5115 -> 5115 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.binbin11918 -> 11918 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.binbin39963 -> 40071 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.binbin10842 -> 10850 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.binbin35579 -> 35715 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.binbin12436 -> 12436 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.binbin13524 -> 13524 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.binbin3749 -> 3717 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.binbin7214 -> 7206 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.binbin3721 -> 3689 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.binbin7102 -> 7094 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.binbin5379 -> 5347 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.binbin5407 -> 5375 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.binbin4815 -> 4239 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.binbin5631 -> 5631 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.binbin428 -> 477 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.binbin2274 -> 2278 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.binbin553 -> 557 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.binbin137 -> 141 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.binbin618 -> 622 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.binbin218 -> 222 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.binbin137 -> 141 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.binbin696 -> 700 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.binbin1088 -> 1092 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.binbin618 -> 622 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.binbin1656 -> 1664 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.binbin1469 -> 1473 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.binbin1793 -> 1797 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.binbin1433 -> 1381 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.binbin525 -> 529 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.binbin1673 -> 1677 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.binbin1661 -> 1661 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.binbin556 -> 560 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.binbin137 -> 141 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.binbin1278 -> 1206 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.binbin183 -> 187 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.binbin459 -> 463 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.binbin429 -> 433 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.binbin431 -> 435 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.binbin429 -> 433 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.binbin404 -> 408 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.binbin47438 -> 47442 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.binbin149 -> 153 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.binbin2726 -> 2730 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.binbin4507 -> 4511 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.binbin2722 -> 2726 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.binbin4471 -> 4475 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.binbin3772 -> 3776 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.binbin3776 -> 3780 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.binbin2686 -> 2690 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.binbin4375 -> 4379 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.binbin2682 -> 2686 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.binbin4419 -> 4423 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.binbin3744 -> 3748 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.binbin3728 -> 3732 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.binbin7591 -> 7591 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.binbin24496 -> 24496 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.binbin7267 -> 7267 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.binbin22316 -> 22316 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.binbin7961 -> 7965 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.binbin8665 -> 8669 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.binbin2806 -> 2810 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.binbin4891 -> 4895 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.binbin2790 -> 2794 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.binbin4827 -> 4831 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.binbin3872 -> 3876 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.binbin3888 -> 3892 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.binbin572 -> 576 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.binbin960 -> 964 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.binbin1152 -> 1156 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.binbin269 -> 273 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.binbin221 -> 225 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.binbin333 -> 337 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.binbin261 -> 265 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.binbin218 -> 222 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.binbin380 -> 384 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.binbin384 -> 388 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.binbin960 -> 964 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.binbin1152 -> 1156 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.binbin1910 -> 1914 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.binbin572 -> 576 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.binbin149 -> 153 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.binbin227 -> 231 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.binbin201 -> 205 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.binbin201 -> 205 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.binbin149 -> 153 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.binbin227 -> 231 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.binbin201 -> 205 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.binbin201 -> 205 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.binbin277 -> 281 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.binbin149 -> 153 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.binbin227 -> 231 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.binbin374 -> 378 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.binbin218 -> 222 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.binbin2061 -> 2065 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.binbin2464 -> 2468 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.binbin3300 -> 3304 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.binbin149 -> 153 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.binbin269 -> 354 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.binbin149 -> 153 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.binbin1976 -> 1980 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.binbin572 -> 576 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.binbin218 -> 222 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.binbin2169 -> 2173 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.binbin1018 -> 1022 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.binbin217 -> 221 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.binbin427 -> 431 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.binbin262 -> 266 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.binbin325 -> 329 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.binbin813 -> 817 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.binbin337 -> 341 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.binbin1089 -> 1093 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.binbin1083 -> 1087 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.binbin461 -> 465 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.binbin1089 -> 1093 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.binbin665 -> 669 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.binbin577 -> 581 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.binbin653 -> 657 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.binbin672 -> 676 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.binbin443 -> 447 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.binbin474 -> 478 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.binbin982 -> 986 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.binbin553 -> 557 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.binbin682 -> 686 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.binbin355 -> 359 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.binbin283 -> 287 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.binbin802 -> 806 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.binbin1451 -> 1455 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.binbin818 -> 822 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.binbin1515 -> 1519 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.binbin1462 -> 1466 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.binbin1398 -> 1402 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.binbin283 -> 287 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.binbin754 -> 758 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.binbin351 -> 355 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.binbin577 -> 581 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.binbin754 -> 758 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.binbin541 -> 545 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.binbin437 -> 441 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.binbin283 -> 287 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.binbin545 -> 549 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.binbin577 -> 581 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.binbin738 -> 742 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.binbin283 -> 287 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.binbin283 -> 287 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.binbin541 -> 545 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.binbin577 -> 581 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.binbin629 -> 633 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.binbin319 -> 323 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.binbin355 -> 359 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.binbin373 -> 371 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.binbin320 -> 318 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.binbin4213 -> 4207 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.binbin10222 -> 10204 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.binbin4257 -> 4251 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.binbin10442 -> 10424 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.binbin7587 -> 7581 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.binbin7541 -> 7535 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.binbin4085 -> 4079 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.binbin9678 -> 9660 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.binbin4117 -> 4111 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.binbin9814 -> 9796 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.binbin7448 -> 7442 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.binbin7414 -> 7408 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.binbin15736 -> 15670 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.binbin63472 -> 63214 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.binbin15787 -> 15721 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.binbin63918 -> 63660 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.binbin19328 -> 19262 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.binbin19273 -> 19207 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.binbin4635 -> 4633 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.binbin12152 -> 12150 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.binbin4679 -> 4677 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.binbin12372 -> 12370 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.binbin8011 -> 8009 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.binbin7965 -> 7963 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.binbin1746 -> 1708 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.binbin302 -> 300 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.binbin254 -> 252 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.binbin421 -> 417 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.binbin1746 -> 1708 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.binbin8652 -> 8588 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.binbin302 -> 398 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.binbin355 -> 353 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.binbin302 -> 300 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.binbin3976 -> 3970 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.binbin9840 -> 9822 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.binbin4020 -> 4014 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.binbin10060 -> 10042 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.binbin7231 -> 7225 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.binbin7185 -> 7179 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.binbin3854 -> 3848 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.binbin9320 -> 9302 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.binbin3886 -> 3880 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.binbin9456 -> 9438 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.binbin7098 -> 7092 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.binbin7064 -> 7058 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.binbin15123 -> 15057 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.binbin61633 -> 61375 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.binbin15168 -> 15102 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.binbin62055 -> 61797 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.binbin18584 -> 18518 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.binbin18535 -> 18469 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.binbin4373 -> 4371 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.binbin11670 -> 11668 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.binbin4417 -> 4415 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.binbin11890 -> 11888 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.binbin7630 -> 7628 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.binbin7584 -> 7582 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.binbin1619 -> 1581 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.binbin290 -> 288 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.binbin242 -> 240 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.binbin356 -> 352 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.binbin1619 -> 1581 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.binbin8286 -> 8222 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.binbin290 -> 380 bytes
-rw-r--r--3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.binbin623 -> 700 bytes
-rw-r--r--3rdparty/bgfx/include/bgfx/bgfx.h23
-rw-r--r--3rdparty/bgfx/include/bgfx/bgfxdefines.h12
-rw-r--r--3rdparty/bgfx/include/bgfx/bgfxplatform.h80
-rw-r--r--3rdparty/bgfx/include/bgfx/c99/bgfx.h146
-rw-r--r--3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h157
-rw-r--r--3rdparty/bgfx/makefile29
-rw-r--r--3rdparty/bgfx/scripts/bgfx.lua10
-rw-r--r--3rdparty/bgfx/scripts/example-common.lua5
-rw-r--r--3rdparty/bgfx/scripts/genie.lua28
-rw-r--r--3rdparty/bgfx/scripts/makedisttex.lua19
-rw-r--r--3rdparty/bgfx/scripts/shader.mk29
-rw-r--r--3rdparty/bgfx/scripts/shaderc.lua6
-rw-r--r--3rdparty/bgfx/scripts/texturec.lua4
-rw-r--r--3rdparty/bgfx/src/bgfx.cpp198
-rw-r--r--3rdparty/bgfx/src/bgfx_p.h90
-rw-r--r--3rdparty/bgfx/src/bgfx_shader.sh26
-rw-r--r--3rdparty/bgfx/src/config.h37
-rw-r--r--3rdparty/bgfx/src/glcontext_eagl.mm2
-rw-r--r--3rdparty/bgfx/src/glcontext_egl.cpp2
-rw-r--r--3rdparty/bgfx/src/glcontext_glx.cpp2
-rw-r--r--3rdparty/bgfx/src/glcontext_nsgl.mm2
-rw-r--r--3rdparty/bgfx/src/glcontext_ppapi.cpp2
-rw-r--r--3rdparty/bgfx/src/glcontext_wgl.cpp2
-rw-r--r--3rdparty/bgfx/src/glimports.h6
-rw-r--r--3rdparty/bgfx/src/image.cpp1236
-rw-r--r--3rdparty/bgfx/src/image.h31
-rw-r--r--3rdparty/bgfx/src/renderer_d3d11.cpp113
-rw-r--r--3rdparty/bgfx/src/renderer_d3d11.h5
-rw-r--r--3rdparty/bgfx/src/renderer_d3d12.cpp35
-rw-r--r--3rdparty/bgfx/src/renderer_d3d12.h4
-rw-r--r--3rdparty/bgfx/src/renderer_d3d9.cpp223
-rw-r--r--3rdparty/bgfx/src/renderer_d3d9.h14
-rw-r--r--3rdparty/bgfx/src/renderer_gl.cpp193
-rw-r--r--3rdparty/bgfx/src/renderer_gl.h24
-rw-r--r--3rdparty/bgfx/src/renderer_mtl.h2
-rw-r--r--3rdparty/bgfx/src/renderer_mtl.mm36
-rw-r--r--3rdparty/bgfx/src/renderer_null.cpp11
-rw-r--r--3rdparty/bgfx/src/shader_dx9bc.cpp3
-rw-r--r--3rdparty/bgfx/src/shader_dxbc.cpp3
-rw-r--r--3rdparty/bgfx/tools/bin/windows/.gitignore1
-rw-r--r--3rdparty/bgfx/tools/bin/windows/geometryc.exebin0 -> 1041934 bytes
-rw-r--r--3rdparty/bgfx/tools/bin/windows/shaderc.exebin0 -> 2096654 bytes
-rw-r--r--3rdparty/bgfx/tools/bin/windows/texturec.exebin0 -> 5843221 bytes
-rw-r--r--3rdparty/bgfx/tools/geometryc/geometryc.cpp6
-rw-r--r--3rdparty/bgfx/tools/makedisttex.cpp195
-rw-r--r--3rdparty/bgfx/tools/shaderc/shaderc.cpp2839
-rw-r--r--3rdparty/bgfx/tools/shaderc/shaderc.h134
-rw-r--r--3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp354
-rw-r--r--3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp1185
-rw-r--r--3rdparty/bgfx/tools/texturec/texturec.cpp362
-rw-r--r--3rdparty/bx/.appveyor.yml21
-rw-r--r--3rdparty/bx/.travis.yml20
-rw-r--r--3rdparty/bx/README.md3
-rw-r--r--3rdparty/bx/include/bx/bx.h27
-rw-r--r--3rdparty/bx/include/bx/config.h1
-rw-r--r--3rdparty/bx/include/bx/error.h111
-rw-r--r--3rdparty/bx/include/bx/fpumath.h97
-rw-r--r--3rdparty/bx/include/bx/handlealloc.h2
-rw-r--r--3rdparty/bx/include/bx/hash.h2
-rw-r--r--3rdparty/bx/include/bx/os.h15
-rw-r--r--3rdparty/bx/include/bx/platform.h36
-rw-r--r--3rdparty/bx/include/bx/readerwriter.h159
-rw-r--r--3rdparty/bx/include/bx/thread.h11
-rw-r--r--3rdparty/bx/makefile5
-rw-r--r--3rdparty/bx/scripts/genie.lua8
-rw-r--r--3rdparty/bx/scripts/toolchain.lua111
-rw-r--r--3rdparty/bx/tools/bin/darwin/geniebin422176 -> 422176 bytes
-rw-r--r--3rdparty/bx/tools/bin/linux/geniebin396856 -> 396856 bytes
-rw-r--r--3rdparty/bx/tools/bin/windows/genie.exebin399872 -> 400896 bytes
-rw-r--r--3rdparty/bx/tools/bin2c/bin2c.cpp6
-rw-r--r--3rdparty/http-parser/.gitignore28
-rw-r--r--3rdparty/http-parser/.mailmap8
-rw-r--r--3rdparty/http-parser/.travis.yml13
-rw-r--r--3rdparty/http-parser/AUTHORS67
-rw-r--r--3rdparty/http-parser/LICENSE-MIT23
-rw-r--r--3rdparty/http-parser/Makefile136
-rw-r--r--3rdparty/http-parser/README.md183
-rw-r--r--3rdparty/http-parser/bench.c111
-rw-r--r--3rdparty/http-parser/contrib/parsertrace.c160
-rw-r--r--3rdparty/http-parser/contrib/url_parser.c46
-rw-r--r--3rdparty/http-parser/http_parser.c2429
-rw-r--r--3rdparty/http-parser/http_parser.gyp111
-rw-r--r--3rdparty/http-parser/http_parser.h342
-rw-r--r--3rdparty/http-parser/test.c3852
-rw-r--r--3rdparty/libuv/.gitignore75
-rw-r--r--3rdparty/libuv/.mailmap39
-rw-r--r--3rdparty/libuv/AUTHORS242
-rw-r--r--3rdparty/libuv/CONTRIBUTING.md166
-rw-r--r--3rdparty/libuv/ChangeLog2372
-rw-r--r--3rdparty/libuv/android-configure20
-rw-r--r--3rdparty/libuv/appveyor.yml36
-rw-r--r--3rdparty/libuv/autogen.sh46
-rw-r--r--3rdparty/libuv/checksparse.sh234
-rw-r--r--3rdparty/libuv/common.gypi210
-rw-r--r--3rdparty/libuv/configure.ac68
-rw-r--r--3rdparty/libuv/docs/make.bat243
494 files changed, 27975 insertions, 4060 deletions
diff --git a/.gitattributes b/.gitattributes
index 8ed64ccc8cf..1e631f6f107 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -37,3 +37,4 @@ src/osd/sdl/shader/*.fsh svneol=native#text/plain
readme svneol=native#text/plain
README svneol=native#text/plain
*.ppm -text svneol=unset#image/x-portable-pixmap
+*.po eol=lf \ No newline at end of file
diff --git a/.gitignore b/.gitignore
index a9154ad4011..921014a6811 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,16 +2,20 @@
/*
/*/
!/3rdparty/
+!/benchmarks/
!/artwork/
!/docs/
!/hash/
!/hlsl/
!/keymaps/
+!/language/
!/nl_examples/
+!/plugins/
!/regtests/
!/samples/
!/scripts/
!/src/
+!/shaders/
!/tests/
!/doxygen/
!/web/
@@ -25,4 +29,10 @@
regtests/chdman/temp
regtests/jedutil/output
*.pyc
+*.mo
/CMakeLists.txt
+/src/devices/cpu/m68000/m68kops.cpp
+/src/devices/cpu/m68000/m68kops.h
+/src/devices/cpu/m68000/m68kmake.*
+/src/devices/cpu/m68000/m68kmake
+!/src/devices/cpu/m68000/m68kmake.cpp \ No newline at end of file
diff --git a/3rdparty/benchmark/.gitignore b/3rdparty/benchmark/.gitignore
new file mode 100644
index 00000000000..3c1b4f2183e
--- /dev/null
+++ b/3rdparty/benchmark/.gitignore
@@ -0,0 +1,46 @@
+*.a
+*.so
+*.so.?*
+*.dll
+*.exe
+*.dylib
+*.cmake
+!/cmake/*.cmake
+*~
+*.pyc
+__pycache__
+
+# lcov
+*.lcov
+/lcov
+
+# cmake files.
+/Testing
+CMakeCache.txt
+CMakeFiles/
+cmake_install.cmake
+
+# makefiles.
+Makefile
+
+# in-source build.
+bin/
+lib/
+/test/*_test
+
+# exuberant ctags.
+tags
+
+# YouCompleteMe configuration.
+.ycm_extra_conf.pyc
+
+# ninja generated files.
+.ninja_deps
+.ninja_log
+build.ninja
+install_manifest.txt
+rules.ninja
+
+# out-of-source build top-level folders.
+build/
+_build/
diff --git a/3rdparty/benchmark/.travis-setup.sh b/3rdparty/benchmark/.travis-setup.sh
new file mode 100644
index 00000000000..c900fa9331a
--- /dev/null
+++ b/3rdparty/benchmark/.travis-setup.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+# Before install
+
+sudo add-apt-repository -y ppa:kalakris/cmake
+if [ "$STD" = "c++11" ]; then
+ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+ if [ "$CXX" = "clang++" ]; then
+ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+ sudo add-apt-repository -y "deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6 main"
+ fi
+fi
+sudo apt-get update -qq
+
+# Install
+sudo apt-get install -qq cmake
+if [ "$STD" = "c++11" ] && [ "$CXX" = "g++" ]; then
+ sudo apt-get install -qq gcc-4.8 g++-4.8
+ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90
+ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
+elif [ "$CXX" = "clang++" ]; then
+ sudo apt-get install -qq clang-3.6
+ sudo update-alternatives --install /usr/local/bin/clang clang /usr/bin/clang-3.6 90
+ sudo update-alternatives --install /usr/local/bin/clang++ clang++ /usr/bin/clang++-3.6 90
+ export PATH=/usr/local/bin:$PATH
+fi
diff --git a/3rdparty/benchmark/.travis.yml b/3rdparty/benchmark/.travis.yml
new file mode 100644
index 00000000000..8b138ce134d
--- /dev/null
+++ b/3rdparty/benchmark/.travis.yml
@@ -0,0 +1,41 @@
+language: cpp
+
+# NOTE: The COMPILER variable is unused. It simply makes the display on
+# travis-ci.org more readable.
+matrix:
+ include:
+ - compiler: gcc
+ env: COMPILER=g++-4.6 STD=c++0x BUILD_TYPE=Coverage
+ - compiler: gcc
+ env: COMPILER=g++-4.6 STD=c++0x BUILD_TYPE=Debug
+ - compiler: gcc
+ env: COMPILER=g++-4.6 STD=c++0x BUILD_TYPE=Release
+ - compiler: gcc
+ env: COMPILER=g++-4.8 STD=c++11 BUILD_TYPE=Debug
+ - compiler: gcc
+ env: COMPILER=g++-4.8 STD=c++11 BUILD_TYPE=Release
+ - compiler: clang
+ env: COMPILER=clang++-3.6 STD=c++11 BUILD_TYPE=Debug
+ - compiler: clang
+ env: COMPILER=clang++-3.6 STD=c++11 BUILD_TYPE=Release
+
+before_script:
+ - source .travis-setup.sh
+ - mkdir build && cd build
+
+install:
+ - if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
+ PATH=~/.local/bin:${PATH};
+ pip install --user --upgrade pip;
+ pip install --user cpp-coveralls;
+ fi
+
+script:
+ - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-std=${STD}"
+ - make
+ - make CTEST_OUTPUT_ON_FAILURE=1 test
+
+after_success:
+ - if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
+ coveralls --include src --include include --gcov-options '\-lp' --root .. --build-root .;
+ fi
diff --git a/3rdparty/benchmark/.ycm_extra_conf.py b/3rdparty/benchmark/.ycm_extra_conf.py
new file mode 100644
index 00000000000..86194357da6
--- /dev/null
+++ b/3rdparty/benchmark/.ycm_extra_conf.py
@@ -0,0 +1,115 @@
+import os
+import ycm_core
+
+# These are the compilation flags that will be used in case there's no
+# compilation database set (by default, one is not set).
+# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
+flags = [
+'-Wall',
+'-Werror',
+'-pendantic-errors',
+'-std=c++0x',
+'-fno-strict-aliasing',
+'-O3',
+'-DNDEBUG',
+# ...and the same thing goes for the magic -x option which specifies the
+# language that the files to be compiled are written in. This is mostly
+# relevant for c++ headers.
+# For a C project, you would set this to 'c' instead of 'c++'.
+'-x', 'c++',
+'-I', 'include',
+'-isystem', '/usr/include',
+'-isystem', '/usr/local/include',
+]
+
+
+# Set this to the absolute path to the folder (NOT the file!) containing the
+# compile_commands.json file to use that instead of 'flags'. See here for
+# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
+#
+# Most projects will NOT need to set this to anything; you can just change the
+# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
+compilation_database_folder = ''
+
+if os.path.exists( compilation_database_folder ):
+ database = ycm_core.CompilationDatabase( compilation_database_folder )
+else:
+ database = None
+
+SOURCE_EXTENSIONS = [ '.cc' ]
+
+def DirectoryOfThisScript():
+ return os.path.dirname( os.path.abspath( __file__ ) )
+
+
+def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
+ if not working_directory:
+ return list( flags )
+ new_flags = []
+ make_next_absolute = False
+ path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
+ for flag in flags:
+ new_flag = flag
+
+ if make_next_absolute:
+ make_next_absolute = False
+ if not flag.startswith( '/' ):
+ new_flag = os.path.join( working_directory, flag )
+
+ for path_flag in path_flags:
+ if flag == path_flag:
+ make_next_absolute = True
+ break
+
+ if flag.startswith( path_flag ):
+ path = flag[ len( path_flag ): ]
+ new_flag = path_flag + os.path.join( working_directory, path )
+ break
+
+ if new_flag:
+ new_flags.append( new_flag )
+ return new_flags
+
+
+def IsHeaderFile( filename ):
+ extension = os.path.splitext( filename )[ 1 ]
+ return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
+
+
+def GetCompilationInfoForFile( filename ):
+ # The compilation_commands.json file generated by CMake does not have entries
+ # for header files. So we do our best by asking the db for flags for a
+ # corresponding source file, if any. If one exists, the flags for that file
+ # should be good enough.
+ if IsHeaderFile( filename ):
+ basename = os.path.splitext( filename )[ 0 ]
+ for extension in SOURCE_EXTENSIONS:
+ replacement_file = basename + extension
+ if os.path.exists( replacement_file ):
+ compilation_info = database.GetCompilationInfoForFile(
+ replacement_file )
+ if compilation_info.compiler_flags_:
+ return compilation_info
+ return None
+ return database.GetCompilationInfoForFile( filename )
+
+
+def FlagsForFile( filename, **kwargs ):
+ if database:
+ # Bear in mind that compilation_info.compiler_flags_ does NOT return a
+ # python list, but a "list-like" StringVec object
+ compilation_info = GetCompilationInfoForFile( filename )
+ if not compilation_info:
+ return None
+
+ final_flags = MakeRelativePathsInFlagsAbsolute(
+ compilation_info.compiler_flags_,
+ compilation_info.compiler_working_dir_ )
+ else:
+ relative_to = DirectoryOfThisScript()
+ final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
+
+ return {
+ 'flags': final_flags,
+ 'do_cache': True
+ }
diff --git a/3rdparty/benchmark/AUTHORS b/3rdparty/benchmark/AUTHORS
new file mode 100644
index 00000000000..5a4b35535e2
--- /dev/null
+++ b/3rdparty/benchmark/AUTHORS
@@ -0,0 +1,30 @@
+# This is the official list of benchmark authors for copyright purposes.
+# This file is distinct from the CONTRIBUTORS files.
+# See the latter for an explanation.
+#
+# Names should be added to this file as:
+# Name or Organization <email address>
+# The email address is not required for organizations.
+#
+# Please keep the list sorted.
+
+Arne Beer <arne@twobeer.de>
+Christopher Seymour <chris.j.seymour@hotmail.com>
+David Coeurjolly <david.coeurjolly@liris.cnrs.fr>
+Dominic Hamon <dma@stripysock.com>
+Eugene Zhuk <eugene.zhuk@gmail.com>
+Evgeny Safronov <division494@gmail.com>
+Felix Homann <linuxaudio@showlabor.de>
+Google Inc.
+JianXiong Zhou <zhoujianxiong2@gmail.com>
+Kaito Udagawa <umireon@gmail.com>
+Lei Xu <eddyxu@gmail.com>
+Matt Clarkson <mattyclarkson@gmail.com>
+Oleksandr Sochka <sasha.sochka@gmail.com>
+Paul Redmond <paul.redmond@gmail.com>
+Radoslav Yovchev <radoslav.tm@gmail.com>
+Shuo Chen <chenshuo@chenshuo.com>
+Yusuke Suzuki <utatane.tea@gmail.com>
+Dirac Research
+Zbigniew Skowron <zbychs@gmail.com>
+Dominik Czarnota <dominik.b.czarnota@gmail.com>
diff --git a/3rdparty/benchmark/CMakeLists.txt b/3rdparty/benchmark/CMakeLists.txt
new file mode 100644
index 00000000000..a753ad64b35
--- /dev/null
+++ b/3rdparty/benchmark/CMakeLists.txt
@@ -0,0 +1,112 @@
+cmake_minimum_required (VERSION 2.8.11)
+project (benchmark)
+
+option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
+option(BENCHMARK_ENABLE_LTO "Enable link time optimisation of the benchmark library." OFF)
+# Make sure we can import out CMake functions
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+# Read the git tags to determine the project version
+include(GetGitVersion)
+get_git_version(GIT_VERSION)
+
+# Tell the user what versions we are using
+string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION ${GIT_VERSION})
+message("-- Version: ${VERSION}")
+
+# The version of the libraries
+set(GENERIC_LIB_VERSION ${VERSION})
+string(SUBSTRING ${VERSION} 0 1 GENERIC_LIB_SOVERSION)
+
+# Import our CMake modules
+include(CheckCXXCompilerFlag)
+include(AddCXXCompilerFlag)
+include(CXXFeatureCheck)
+
+# Try and enable C++11. Don't use C++14 because it doesn't work in some
+# configurations.
+add_cxx_compiler_flag(-std=c++11)
+if (NOT HAVE_CXX_FLAG_STD_CXX11)
+ add_cxx_compiler_flag(-std=c++0x)
+endif()
+
+# Turn compiler warnings up to 11
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+ add_cxx_compiler_flag(-W4)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+else()
+ add_cxx_compiler_flag(-Wall)
+endif()
+add_cxx_compiler_flag(-Wextra)
+add_cxx_compiler_flag(-Wshadow)
+add_cxx_compiler_flag(-Werror RELEASE)
+add_cxx_compiler_flag(-pedantic)
+add_cxx_compiler_flag(-pedantic-errors)
+add_cxx_compiler_flag(-Wshorten-64-to-32)
+add_cxx_compiler_flag(-Wfloat-equal)
+add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
+add_cxx_compiler_flag(-fstrict-aliasing)
+if (HAVE_CXX_FLAG_FSTRICT_ALIASING)
+ add_cxx_compiler_flag(-Wstrict-aliasing)
+endif()
+add_cxx_compiler_flag(-Wthread-safety)
+if (HAVE_WTHREAD_SAFETY)
+ add_definitions(-DHAVE_WTHREAD_SAFETY)
+ cxx_feature_check(THREAD_SAFETY_ATTRIBUTES)
+endif()
+
+# Link time optimisation
+if (BENCHMARK_ENABLE_LTO)
+ add_cxx_compiler_flag(-flto)
+ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+ find_program(GCC_AR gcc-ar)
+ if (GCC_AR)
+ set(CMAKE_AR ${GCC_AR})
+ endif()
+ find_program(GCC_RANLIB gcc-ranlib)
+ if (GCC_RANLIB)
+ set(CMAKE_RANLIB ${GCC_RANLIB})
+ endif()
+ endif()
+endif()
+
+# Coverage build type
+set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
+ "Flags used by the C++ compiler during coverage builds."
+ FORCE)
+set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
+ "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
+ "Flags used for linking binaries during coverage builds."
+ FORCE)
+set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
+ "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
+ "Flags used by the shared libraries linker during coverage builds."
+ FORCE)
+mark_as_advanced(
+ CMAKE_CXX_FLAGS_COVERAGE
+ CMAKE_EXE_LINKER_FLAGS_COVERAGE
+ CMAKE_SHARED_LINKER_FLAGS_COVERAGE)
+set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage."
+ FORCE)
+add_cxx_compiler_flag(--coverage COVERAGE)
+
+# C++ feature checks
+cxx_feature_check(STD_REGEX)
+cxx_feature_check(GNU_POSIX_REGEX)
+cxx_feature_check(POSIX_REGEX)
+cxx_feature_check(STEADY_CLOCK)
+
+# Ensure we have pthreads
+find_package(Threads REQUIRED)
+
+# Set up directories
+include_directories(${PROJECT_SOURCE_DIR}/include)
+
+# Build the targets
+add_subdirectory(src)
+
+if (BENCHMARK_ENABLE_TESTING)
+ enable_testing()
+ add_subdirectory(test)
+endif()
diff --git a/3rdparty/benchmark/CONTRIBUTING.md b/3rdparty/benchmark/CONTRIBUTING.md
new file mode 100644
index 00000000000..43de4c9d470
--- /dev/null
+++ b/3rdparty/benchmark/CONTRIBUTING.md
@@ -0,0 +1,58 @@
+# How to contribute #
+
+We'd love to accept your patches and contributions to this project. There are
+a just a few small guidelines you need to follow.
+
+
+## Contributor License Agreement ##
+
+Contributions to any Google project must be accompanied by a Contributor
+License Agreement. This is not a copyright **assignment**, it simply gives
+Google permission to use and redistribute your contributions as part of the
+project.
+
+ * If you are an individual writing original source code and you're sure you
+ own the intellectual property, then you'll need to sign an [individual
+ CLA][].
+
+ * If you work for a company that wants to allow you to contribute your work,
+ then you'll need to sign a [corporate CLA][].
+
+You generally only need to submit a CLA once, so if you've already submitted
+one (even if it was for a different project), you probably don't need to do it
+again.
+
+[individual CLA]: https://developers.google.com/open-source/cla/individual
+[corporate CLA]: https://developers.google.com/open-source/cla/corporate
+
+Once your CLA is submitted (or if you already submitted one for
+another Google project), make a commit adding yourself to the
+[AUTHORS][] and [CONTRIBUTORS][] files. This commit can be part
+of your first [pull request][].
+
+[AUTHORS]: AUTHORS
+[CONTRIBUTORS]: CONTRIBUTORS
+
+
+## Submitting a patch ##
+
+ 1. It's generally best to start by opening a new issue describing the bug or
+ feature you're intending to fix. Even if you think it's relatively minor,
+ it's helpful to know what people are working on. Mention in the initial
+ issue that you are planning to work on that bug or feature so that it can
+ be assigned to you.
+
+ 1. Follow the normal process of [forking][] the project, and setup a new
+ branch to work in. It's important that each group of changes be done in
+ separate branches in order to ensure that a pull request only includes the
+ commits related to that bug or feature.
+
+ 1. Do your best to have [well-formed commit messages][] for each change.
+ This provides consistency throughout the project, and ensures that commit
+ messages are able to be formatted properly by various git tools.
+
+ 1. Finally, push the commits to your fork and submit a [pull request][].
+
+[forking]: https://help.github.com/articles/fork-a-repo
+[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
+[pull request]: https://help.github.com/articles/creating-a-pull-request
diff --git a/3rdparty/benchmark/CONTRIBUTORS b/3rdparty/benchmark/CONTRIBUTORS
new file mode 100644
index 00000000000..ed55bcf2767
--- /dev/null
+++ b/3rdparty/benchmark/CONTRIBUTORS
@@ -0,0 +1,46 @@
+# People who have agreed to one of the CLAs and can contribute patches.
+# The AUTHORS file lists the copyright holders; this file
+# lists people. For example, Google employees are listed here
+# but not in AUTHORS, because Google holds the copyright.
+#
+# Names should be added to this file only after verifying that
+# the individual or the individual's organization has agreed to
+# the appropriate Contributor License Agreement, found here:
+#
+# https://developers.google.com/open-source/cla/individual
+# https://developers.google.com/open-source/cla/corporate
+#
+# The agreement for individuals can be filled out on the web.
+#
+# When adding J Random Contributor's name to this file,
+# either J's name or J's organization's name should be
+# added to the AUTHORS file, depending on whether the
+# individual or corporate CLA was used.
+#
+# Names should be added to this file as:
+# Name <email address>
+#
+# Please keep the list sorted.
+
+Arne Beer <arne@twobeer.de>
+Chris Kennelly <ckennelly@google.com> <ckennelly@ckennelly.com>
+Christopher Seymour <chris.j.seymour@hotmail.com>
+David Coeurjolly <david.coeurjolly@liris.cnrs.fr>
+Dominic Hamon <dma@stripysock.com>
+Eugene Zhuk <eugene.zhuk@gmail.com>
+Evgeny Safronov <division494@gmail.com>
+Felix Homann <linuxaudio@showlabor.de>
+JianXiong Zhou <zhoujianxiong2@gmail.com>
+Kaito Udagawa <umireon@gmail.com>
+Lei Xu <eddyxu@gmail.com>
+Matt Clarkson <mattyclarkson@gmail.com>
+Oleksandr Sochka <sasha.sochka@gmail.com>
+Pascal Leroy <phl@google.com>
+Paul Redmond <paul.redmond@gmail.com>
+Pierre Phaneuf <pphaneuf@google.com>
+Radoslav Yovchev <radoslav.tm@gmail.com>
+Shuo Chen <chenshuo@chenshuo.com>
+Yusuke Suzuki <utatane.tea@gmail.com>
+Tobias Ulvgård <tobias.ulvgard@dirac.se>
+Zbigniew Skowron <zbychs@gmail.com>
+Dominik Czarnota <dominik.b.czarnota@gmail.com>
diff --git a/3rdparty/benchmark/LICENSE b/3rdparty/benchmark/LICENSE
new file mode 100644
index 00000000000..d6456956733
--- /dev/null
+++ b/3rdparty/benchmark/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/3rdparty/benchmark/README.md b/3rdparty/benchmark/README.md
new file mode 100644
index 00000000000..1fa7186ec40
--- /dev/null
+++ b/3rdparty/benchmark/README.md
@@ -0,0 +1,295 @@
+benchmark
+=========
+[![Build Status](https://travis-ci.org/google/benchmark.svg?branch=master)](https://travis-ci.org/google/benchmark)
+[![Build status](https://ci.appveyor.com/api/projects/status/u0qsyp7t1tk7cpxs/branch/master?svg=true)](https://ci.appveyor.com/project/google/benchmark/branch/master)
+[![Coverage Status](https://coveralls.io/repos/google/benchmark/badge.svg)](https://coveralls.io/r/google/benchmark)
+
+A library to support the benchmarking of functions, similar to unit-tests.
+
+Discussion group: https://groups.google.com/d/forum/benchmark-discuss
+
+IRC channel: https://freenode.net #googlebenchmark
+
+Example usage
+-------------
+Define a function that executes the code to be measured a
+specified number of times:
+
+```c++
+static void BM_StringCreation(benchmark::State& state) {
+ while (state.KeepRunning())
+ std::string empty_string;
+}
+// Register the function as a benchmark
+BENCHMARK(BM_StringCreation);
+
+// Define another benchmark
+static void BM_StringCopy(benchmark::State& state) {
+ std::string x = "hello";
+ while (state.KeepRunning())
+ std::string copy(x);
+}
+BENCHMARK(BM_StringCopy);
+
+BENCHMARK_MAIN();
+```
+
+Sometimes a family of microbenchmarks can be implemented with
+just one routine that takes an extra argument to specify which
+one of the family of benchmarks to run. For example, the following
+code defines a family of microbenchmarks for measuring the speed
+of `memcpy()` calls of different lengths:
+
+```c++
+static void BM_memcpy(benchmark::State& state) {
+ char* src = new char[state.range_x()]; char* dst = new char[state.range_x()];
+ memset(src, 'x', state.range_x());
+ while (state.KeepRunning())
+ memcpy(dst, src, state.range_x());
+ state.SetBytesProcessed(int64_t(state.iterations()) *
+ int64_t(state.range_x()));
+ delete[] src;
+ delete[] dst;
+}
+BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10);
+```
+
+The preceding code is quite repetitive, and can be replaced with the
+following short-hand. The following invocation will pick a few
+appropriate arguments in the specified range and will generate a
+microbenchmark for each such argument.
+
+```c++
+BENCHMARK(BM_memcpy)->Range(8, 8<<10);
+```
+
+You might have a microbenchmark that depends on two inputs. For
+example, the following code defines a family of microbenchmarks for
+measuring the speed of set insertion.
+
+```c++
+static void BM_SetInsert(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ state.PauseTiming();
+ std::set<int> data = ConstructRandomSet(state.range_x());
+ state.ResumeTiming();
+ for (int j = 0; j < state.range_y(); ++j)
+ data.insert(RandomNumber());
+ }
+}
+BENCHMARK(BM_SetInsert)
+ ->ArgPair(1<<10, 1)
+ ->ArgPair(1<<10, 8)
+ ->ArgPair(1<<10, 64)
+ ->ArgPair(1<<10, 512)
+ ->ArgPair(8<<10, 1)
+ ->ArgPair(8<<10, 8)
+ ->ArgPair(8<<10, 64)
+ ->ArgPair(8<<10, 512);
+```
+
+The preceding code is quite repetitive, and can be replaced with
+the following short-hand. The following macro will pick a few
+appropriate arguments in the product of the two specified ranges
+and will generate a microbenchmark for each such pair.
+
+```c++
+BENCHMARK(BM_SetInsert)->RangePair(1<<10, 8<<10, 1, 512);
+```
+
+For more complex patterns of inputs, passing a custom function
+to Apply allows programmatic specification of an
+arbitrary set of arguments to run the microbenchmark on.
+The following example enumerates a dense range on one parameter,
+and a sparse range on the second.
+
+```c++
+static void CustomArguments(benchmark::internal::Benchmark* b) {
+ for (int i = 0; i <= 10; ++i)
+ for (int j = 32; j <= 1024*1024; j *= 8)
+ b->ArgPair(i, j);
+}
+BENCHMARK(BM_SetInsert)->Apply(CustomArguments);
+```
+
+Templated microbenchmarks work the same way:
+Produce then consume 'size' messages 'iters' times
+Measures throughput in the absence of multiprogramming.
+
+```c++
+template <class Q> int BM_Sequential(benchmark::State& state) {
+ Q q;
+ typename Q::value_type v;
+ while (state.KeepRunning()) {
+ for (int i = state.range_x(); i--; )
+ q.push(v);
+ for (int e = state.range_x(); e--; )
+ q.Wait(&v);
+ }
+ // actually messages, not bytes:
+ state.SetBytesProcessed(
+ static_cast<int64_t>(state.iterations())*state.range_x());
+}
+BENCHMARK_TEMPLATE(BM_Sequential, WaitQueue<int>)->Range(1<<0, 1<<10);
+```
+
+Three macros are provided for adding benchmark templates.
+
+```c++
+#if __cplusplus >= 201103L // C++11 and greater.
+#define BENCHMARK_TEMPLATE(func, ...) // Takes any number of parameters.
+#else // C++ < C++11
+#define BENCHMARK_TEMPLATE(func, arg1)
+#endif
+#define BENCHMARK_TEMPLATE1(func, arg1)
+#define BENCHMARK_TEMPLATE2(func, arg1, arg2)
+```
+
+In a multithreaded test (benchmark invoked by multiple threads simultaneously),
+it is guaranteed that none of the threads will start until all have called
+KeepRunning, and all will have finished before KeepRunning returns false. As
+such, any global setup or teardown you want to do can be
+wrapped in a check against the thread index:
+
+```c++
+static void BM_MultiThreaded(benchmark::State& state) {
+ if (state.thread_index == 0) {
+ // Setup code here.
+ }
+ while (state.KeepRunning()) {
+ // Run the test as normal.
+ }
+ if (state.thread_index == 0) {
+ // Teardown code here.
+ }
+}
+BENCHMARK(BM_MultiThreaded)->Threads(2);
+```
+
+If the benchmarked code itself uses threads and you want to compare it to
+single-threaded code, you may want to use real-time ("wallclock") measurements
+for latency comparisons:
+
+```c++
+BENCHMARK(BM_test)->Range(8, 8<<10)->UseRealTime();
+```
+
+Without `UseRealTime`, CPU time is used by default.
+
+To prevent a value or expression from being optimized away by the compiler
+the `benchmark::DoNotOptimize(...)` function can be used.
+
+```c++
+static void BM_test(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ int x = 0;
+ for (int i=0; i < 64; ++i) {
+ benchmark::DoNotOptimize(x += i);
+ }
+ }
+}
+```
+
+Benchmark Fixtures
+------------------
+Fixture tests are created by
+first defining a type that derives from ::benchmark::Fixture and then
+creating/registering the tests using the following macros:
+
+* `BENCHMARK_F(ClassName, Method)`
+* `BENCHMARK_DEFINE_F(ClassName, Method)`
+* `BENCHMARK_REGISTER_F(ClassName, Method)`
+
+For Example:
+
+```c++
+class MyFixture : public benchmark::Fixture {};
+
+BENCHMARK_F(MyFixture, FooTest)(benchmark::State& st) {
+ while (st.KeepRunning()) {
+ ...
+ }
+}
+
+BENCHMARK_DEFINE_F(MyFixture, BarTest)(benchmark::State& st) {
+ while (st.KeepRunning()) {
+ ...
+ }
+}
+/* BarTest is NOT registered */
+BENCHMARK_REGISTER_F(MyFixture, BarTest)->Threads(2);
+/* BarTest is now registered */
+```
+
+Output Formats
+--------------
+The library supports multiple output formats. Use the
+`--benchmark_format=<tabular|json>` flag to set the format type. `tabular` is
+the default format.
+
+The Tabular format is intended to be a human readable format. By default
+the format generates color output. Context is output on stderr and the
+tabular data on stdout. Example tabular output looks like:
+```
+Benchmark Time(ns) CPU(ns) Iterations
+----------------------------------------------------------------------
+BM_SetInsert/1024/1 28928 29349 23853 133.097kB/s 33.2742k items/s
+BM_SetInsert/1024/8 32065 32913 21375 949.487kB/s 237.372k items/s
+BM_SetInsert/1024/10 33157 33648 21431 1.13369MB/s 290.225k items/s
+```
+
+The JSON format outputs human readable json split into two top level attributes.
+The `context` attribute contains information about the run in general, including
+information about the CPU and the date.
+The `benchmarks` attribute contains a list of ever benchmark run. Example json
+output looks like:
+```
+{
+ "context": {
+ "date": "2015/03/17-18:40:25",
+ "num_cpus": 40,
+ "mhz_per_cpu": 2801,
+ "cpu_scaling_enabled": false,
+ "build_type": "debug"
+ },
+ "benchmarks": [
+ {
+ "name": "BM_SetInsert/1024/1",
+ "iterations": 94877,
+ "real_time": 29275,
+ "cpu_time": 29836,
+ "bytes_per_second": 134066,
+ "items_per_second": 33516
+ },
+ {
+ "name": "BM_SetInsert/1024/8",
+ "iterations": 21609,
+ "real_time": 32317,
+ "cpu_time": 32429,
+ "bytes_per_second": 986770,
+ "items_per_second": 246693
+ },
+ {
+ "name": "BM_SetInsert/1024/10",
+ "iterations": 21393,
+ "real_time": 32724,
+ "cpu_time": 33355,
+ "bytes_per_second": 1199226,
+ "items_per_second": 299807
+ }
+ ]
+}
+```
+
+The CSV format outputs comma-separated values. The `context` is output on stderr
+and the CSV itself on stdout. Example CSV output looks like:
+```
+name,iterations,real_time,cpu_time,bytes_per_second,items_per_second,label
+"BM_SetInsert/1024/1",65465,17890.7,8407.45,475768,118942,
+"BM_SetInsert/1024/8",116606,18810.1,9766.64,3.27646e+06,819115,
+"BM_SetInsert/1024/10",106365,17238.4,8421.53,4.74973e+06,1.18743e+06,
+```
+
+Linking against the library
+---------------------------
+When using gcc, it is necessary to link against pthread to avoid runtime exceptions. This is due to how gcc implements std::thread. See [issue #67](https://github.com/google/benchmark/issues/67) for more details.
diff --git a/3rdparty/benchmark/appveyor.yml b/3rdparty/benchmark/appveyor.yml
new file mode 100644
index 00000000000..5368a4ac009
--- /dev/null
+++ b/3rdparty/benchmark/appveyor.yml
@@ -0,0 +1,55 @@
+version: '{build}'
+
+configuration:
+ - Static Debug
+ - Static Release
+# - Shared Debug
+# - Shared Release
+
+platform:
+ - x86
+ - x64
+
+environment:
+ matrix:
+ - compiler: gcc-4.9.2-posix
+# - compiler: gcc-4.8.4-posix
+# - compiler: msvc-12-seh
+
+install:
+ # derive some extra information
+ - for /f "tokens=1-2" %%a in ("%configuration%") do (@set "linkage=%%a")
+ - for /f "tokens=1-2" %%a in ("%configuration%") do (@set "variant=%%b")
+ - if "%linkage%"=="Shared" (set shared=YES) else (set shared=NO)
+ - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_name=%%a")
+ - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_version=%%b")
+ - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_threading=%%c")
+ - if "%platform%"=="x64" (set arch=x86_64)
+ - if "%platform%"=="x86" (set arch=i686)
+ # download the specific version of MinGW
+ - if "%compiler_name%"=="gcc" (for /f %%a in ('python mingw.py --quiet --version "%compiler_version%" --arch "%arch%" --threading "%compiler_threading%" --location "C:\mingw-builds"') do @set "compiler_path=%%a")
+
+before_build:
+ # Set up mingw commands
+ - if "%compiler_name%"=="gcc" (set "generator=MinGW Makefiles")
+ - if "%compiler_name%"=="gcc" (set "build=mingw32-make -j4")
+ - if "%compiler_name%"=="gcc" (set "test=mingw32-make CTEST_OUTPUT_ON_FAILURE=1 test")
+ # msvc specific commands
+ # TODO :)
+ # add the compiler path if needed
+ - if not "%compiler_path%"=="" (set "PATH=%PATH%;%compiler_path%")
+ # git bash conflicts with MinGW makefiles
+ - if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%")
+
+build_script:
+ - cmake -G "%generator%" "-DCMAKE_BUILD_TYPE=%variant%" "-DBUILD_SHARED_LIBS=%shared%"
+ - cmd /c "%build%"
+
+test_script:
+ - cmd /c "%test%"
+
+matrix:
+ fast_finish: true
+
+cache:
+ - C:\mingw-builds
diff --git a/3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake b/3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake
new file mode 100644
index 00000000000..870f11ae4d8
--- /dev/null
+++ b/3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake
@@ -0,0 +1,37 @@
+# - Adds a compiler flag if it is supported by the compiler
+#
+# This function checks that the supplied compiler flag is supported and then
+# adds it to the corresponding compiler flags
+#
+# add_cxx_compiler_flag(<FLAG> [<VARIANT>])
+#
+# - Example
+#
+# include(AddCXXCompilerFlag)
+# add_cxx_compiler_flag(-Wall)
+# add_cxx_compiler_flag(-no-strict-aliasing RELEASE)
+# Requires CMake 2.6+
+
+if(__add_cxx_compiler_flag)
+ return()
+endif()
+set(__add_cxx_compiler_flag INCLUDED)
+
+include(CheckCXXCompilerFlag)
+
+function(add_cxx_compiler_flag FLAG)
+ string(TOUPPER "HAVE_CXX_FLAG_${FLAG}" SANITIZED_FLAG)
+ string(REPLACE "+" "X" SANITIZED_FLAG ${SANITIZED_FLAG})
+ string(REGEX REPLACE "[^A-Za-z_0-9]" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
+ string(REGEX REPLACE "_+" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
+ set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+ check_cxx_compiler_flag("" ${SANITIZED_FLAG})
+ if(${SANITIZED_FLAG})
+ set(VARIANT ${ARGV1})
+ if(ARGV1)
+ string(TOUPPER "_${VARIANT}" VARIANT)
+ endif()
+ set(CMAKE_CXX_FLAGS${VARIANT} "${CMAKE_CXX_FLAGS${VARIANT}} ${FLAG}" PARENT_SCOPE)
+ endif()
+endfunction()
+
diff --git a/3rdparty/benchmark/cmake/CXXFeatureCheck.cmake b/3rdparty/benchmark/cmake/CXXFeatureCheck.cmake
new file mode 100644
index 00000000000..23ee8ac6572
--- /dev/null
+++ b/3rdparty/benchmark/cmake/CXXFeatureCheck.cmake
@@ -0,0 +1,39 @@
+# - Compile and run code to check for C++ features
+#
+# This functions compiles a source file under the `cmake` folder
+# and adds the corresponding `HAVE_[FILENAME]` flag to the CMake
+# environment
+#
+# cxx_feature_check(<FLAG> [<VARIANT>])
+#
+# - Example
+#
+# include(CXXFeatureCheck)
+# cxx_feature_check(STD_REGEX)
+# Requires CMake 2.6+
+
+if(__cxx_feature_check)
+ return()
+endif()
+set(__cxx_feature_check INCLUDED)
+
+function(cxx_feature_check FILE)
+ string(TOLOWER ${FILE} FILE)
+ string(TOUPPER ${FILE} VAR)
+ string(TOUPPER "HAVE_${VAR}" FEATURE)
+ message("-- Performing Test ${FEATURE}")
+ try_run(RUN_${FEATURE} COMPILE_${FEATURE}
+ ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp)
+ if(RUN_${FEATURE} EQUAL 0)
+ message("-- Performing Test ${FEATURE} -- success")
+ set(HAVE_${VAR} 1 PARENT_SCOPE)
+ add_definitions(-DHAVE_${VAR})
+ else()
+ if(NOT COMPILE_${FEATURE})
+ message("-- Performing Test ${FEATURE} -- failed to compile")
+ else()
+ message("-- Performing Test ${FEATURE} -- compiled but failed to run")
+ endif()
+ endif()
+endfunction()
+
diff --git a/3rdparty/benchmark/cmake/GetGitVersion.cmake b/3rdparty/benchmark/cmake/GetGitVersion.cmake
new file mode 100644
index 00000000000..8dd94800459
--- /dev/null
+++ b/3rdparty/benchmark/cmake/GetGitVersion.cmake
@@ -0,0 +1,51 @@
+# - Returns a version string from Git tags
+#
+# This function inspects the annotated git tags for the project and returns a string
+# into a CMake variable
+#
+# get_git_version(<var>)
+#
+# - Example
+#
+# include(GetGitVersion)
+# get_git_version(GIT_VERSION)
+#
+# Requires CMake 2.8.11+
+find_package(Git)
+
+if(__get_git_version)
+ return()
+endif()
+set(__get_git_version INCLUDED)
+
+function(get_git_version var)
+ if(GIT_EXECUTABLE)
+ execute_process(COMMAND ${GIT_EXECUTABLE} describe --match "v[0-9]*.[0-9]*.[0-9]*" --abbrev=8
+ RESULT_VARIABLE status
+ OUTPUT_VARIABLE GIT_VERSION
+ ERROR_QUIET)
+ if(${status})
+ set(GIT_VERSION "v0.0.0")
+ else()
+ string(STRIP ${GIT_VERSION} GIT_VERSION)
+ string(REGEX REPLACE "-[0-9]+-g" "-" GIT_VERSION ${GIT_VERSION})
+ endif()
+
+ # Work out if the repository is dirty
+ execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
+ OUTPUT_QUIET
+ ERROR_QUIET)
+ execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD --
+ OUTPUT_VARIABLE GIT_DIFF_INDEX
+ ERROR_QUIET)
+ string(COMPARE NOTEQUAL "${GIT_DIFF_INDEX}" "" GIT_DIRTY)
+ if (${GIT_DIRTY})
+ set(GIT_VERSION "${GIT_VERSION}-dirty")
+ endif()
+ else()
+ set(GIT_VERSION "v0.0.0")
+ endif()
+
+ message("-- git Version: ${GIT_VERSION}")
+ set(${var} ${GIT_VERSION} PARENT_SCOPE)
+endfunction()
diff --git a/3rdparty/benchmark/cmake/gnu_posix_regex.cpp b/3rdparty/benchmark/cmake/gnu_posix_regex.cpp
new file mode 100644
index 00000000000..b5b91cdab7c
--- /dev/null
+++ b/3rdparty/benchmark/cmake/gnu_posix_regex.cpp
@@ -0,0 +1,12 @@
+#include <gnuregex.h>
+#include <string>
+int main() {
+ std::string str = "test0159";
+ regex_t re;
+ int ec = regcomp(&re, "^[a-z]+[0-9]+$", REG_EXTENDED | REG_NOSUB);
+ if (ec != 0) {
+ return ec;
+ }
+ return regexec(&re, str.c_str(), 0, nullptr, 0) ? -1 : 0;
+}
+
diff --git a/3rdparty/benchmark/cmake/posix_regex.cpp b/3rdparty/benchmark/cmake/posix_regex.cpp
new file mode 100644
index 00000000000..a31af80481a
--- /dev/null
+++ b/3rdparty/benchmark/cmake/posix_regex.cpp
@@ -0,0 +1,12 @@
+#include <regex.h>
+#include <string>
+int main() {
+ std::string str = "test0159";
+ regex_t re;
+ int ec = regcomp(&re, "^[a-z]+[0-9]+$", REG_EXTENDED | REG_NOSUB);
+ if (ec != 0) {
+ return ec;
+ }
+ return regexec(&re, str.c_str(), 0, nullptr, 0) ? -1 : 0;
+}
+
diff --git a/3rdparty/benchmark/cmake/std_regex.cpp b/3rdparty/benchmark/cmake/std_regex.cpp
new file mode 100644
index 00000000000..696f2a26bce
--- /dev/null
+++ b/3rdparty/benchmark/cmake/std_regex.cpp
@@ -0,0 +1,10 @@
+#include <regex>
+#include <string>
+int main() {
+ const std::string str = "test0159";
+ std::regex re;
+ re = std::regex("^[a-z]+[0-9]+$",
+ std::regex_constants::extended | std::regex_constants::nosubs);
+ return std::regex_search(str, re) ? 0 : -1;
+}
+
diff --git a/3rdparty/benchmark/cmake/steady_clock.cpp b/3rdparty/benchmark/cmake/steady_clock.cpp
new file mode 100644
index 00000000000..66d50d17e9e
--- /dev/null
+++ b/3rdparty/benchmark/cmake/steady_clock.cpp
@@ -0,0 +1,7 @@
+#include <chrono>
+
+int main() {
+ typedef std::chrono::steady_clock Clock;
+ Clock::time_point tp = Clock::now();
+ ((void)tp);
+}
diff --git a/3rdparty/benchmark/cmake/thread_safety_attributes.cpp b/3rdparty/benchmark/cmake/thread_safety_attributes.cpp
new file mode 100644
index 00000000000..46161babdb1
--- /dev/null
+++ b/3rdparty/benchmark/cmake/thread_safety_attributes.cpp
@@ -0,0 +1,4 @@
+#define HAVE_THREAD_SAFETY_ATTRIBUTES
+#include "../src/mutex.h"
+
+int main() {}
diff --git a/3rdparty/benchmark/include/benchmark/benchmark.h b/3rdparty/benchmark/include/benchmark/benchmark.h
new file mode 100644
index 00000000000..18aa9e634cb
--- /dev/null
+++ b/3rdparty/benchmark/include/benchmark/benchmark.h
@@ -0,0 +1,21 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+#ifndef BENCHMARK_BENCHMARK_H_
+#define BENCHMARK_BENCHMARK_H_
+
+#include "macros.h"
+#include "benchmark_api.h"
+#include "reporter.h"
+
+#endif // BENCHMARK_BENCHMARK_H_
diff --git a/3rdparty/benchmark/include/benchmark/benchmark_api.h b/3rdparty/benchmark/include/benchmark/benchmark_api.h
new file mode 100644
index 00000000000..5523587834a
--- /dev/null
+++ b/3rdparty/benchmark/include/benchmark/benchmark_api.h
@@ -0,0 +1,602 @@
+// Support for registering benchmarks for functions.
+
+/* Example usage:
+// Define a function that executes the code to be measured a
+// specified number of times:
+static void BM_StringCreation(benchmark::State& state) {
+ while (state.KeepRunning())
+ std::string empty_string;
+}
+
+// Register the function as a benchmark
+BENCHMARK(BM_StringCreation);
+
+// Define another benchmark
+static void BM_StringCopy(benchmark::State& state) {
+ std::string x = "hello";
+ while (state.KeepRunning())
+ std::string copy(x);
+}
+BENCHMARK(BM_StringCopy);
+
+// Augment the main() program to invoke benchmarks if specified
+// via the --benchmarks command line flag. E.g.,
+// my_unittest --benchmark_filter=all
+// my_unittest --benchmark_filter=BM_StringCreation
+// my_unittest --benchmark_filter=String
+// my_unittest --benchmark_filter='Copy|Creation'
+int main(int argc, char** argv) {
+ benchmark::Initialize(&argc, argv);
+ benchmark::RunSpecifiedBenchmarks();
+ return 0;
+}
+
+// Sometimes a family of microbenchmarks can be implemented with
+// just one routine that takes an extra argument to specify which
+// one of the family of benchmarks to run. For example, the following
+// code defines a family of microbenchmarks for measuring the speed
+// of memcpy() calls of different lengths:
+
+static void BM_memcpy(benchmark::State& state) {
+ char* src = new char[state.range_x()]; char* dst = new char[state.range_x()];
+ memset(src, 'x', state.range_x());
+ while (state.KeepRunning())
+ memcpy(dst, src, state.range_x());
+ state.SetBytesProcessed(int64_t(state.iterations()) *
+ int64_t(state.range_x()));
+ delete[] src; delete[] dst;
+}
+BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10);
+
+// The preceding code is quite repetitive, and can be replaced with the
+// following short-hand. The following invocation will pick a few
+// appropriate arguments in the specified range and will generate a
+// microbenchmark for each such argument.
+BENCHMARK(BM_memcpy)->Range(8, 8<<10);
+
+// You might have a microbenchmark that depends on two inputs. For
+// example, the following code defines a family of microbenchmarks for
+// measuring the speed of set insertion.
+static void BM_SetInsert(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ state.PauseTiming();
+ set<int> data = ConstructRandomSet(state.range_x());
+ state.ResumeTiming();
+ for (int j = 0; j < state.range_y(); ++j)
+ data.insert(RandomNumber());
+ }
+}
+BENCHMARK(BM_SetInsert)
+ ->ArgPair(1<<10, 1)
+ ->ArgPair(1<<10, 8)
+ ->ArgPair(1<<10, 64)
+ ->ArgPair(1<<10, 512)
+ ->ArgPair(8<<10, 1)
+ ->ArgPair(8<<10, 8)
+ ->ArgPair(8<<10, 64)
+ ->ArgPair(8<<10, 512);
+
+// The preceding code is quite repetitive, and can be replaced with
+// the following short-hand. The following macro will pick a few
+// appropriate arguments in the product of the two specified ranges
+// and will generate a microbenchmark for each such pair.
+BENCHMARK(BM_SetInsert)->RangePair(1<<10, 8<<10, 1, 512);
+
+// For more complex patterns of inputs, passing a custom function
+// to Apply allows programmatic specification of an
+// arbitrary set of arguments to run the microbenchmark on.
+// The following example enumerates a dense range on
+// one parameter, and a sparse range on the second.
+static void CustomArguments(benchmark::internal::Benchmark* b) {
+ for (int i = 0; i <= 10; ++i)
+ for (int j = 32; j <= 1024*1024; j *= 8)
+ b->ArgPair(i, j);
+}
+BENCHMARK(BM_SetInsert)->Apply(CustomArguments);
+
+// Templated microbenchmarks work the same way:
+// Produce then consume 'size' messages 'iters' times
+// Measures throughput in the absence of multiprogramming.
+template <class Q> int BM_Sequential(benchmark::State& state) {
+ Q q;
+ typename Q::value_type v;
+ while (state.KeepRunning()) {
+ for (int i = state.range_x(); i--; )
+ q.push(v);
+ for (int e = state.range_x(); e--; )
+ q.Wait(&v);
+ }
+ // actually messages, not bytes:
+ state.SetBytesProcessed(
+ static_cast<int64_t>(state.iterations())*state.range_x());
+}
+BENCHMARK_TEMPLATE(BM_Sequential, WaitQueue<int>)->Range(1<<0, 1<<10);
+
+Use `Benchmark::MinTime(double t)` to set the minimum time used to run the
+benchmark. This option overrides the `benchmark_min_time` flag.
+
+void BM_test(benchmark::State& state) {
+ ... body ...
+}
+BENCHMARK(BM_test)->MinTime(2.0); // Run for at least 2 seconds.
+
+In a multithreaded test, it is guaranteed that none of the threads will start
+until all have called KeepRunning, and all will have finished before KeepRunning
+returns false. As such, any global setup or teardown you want to do can be
+wrapped in a check against the thread index:
+
+static void BM_MultiThreaded(benchmark::State& state) {
+ if (state.thread_index == 0) {
+ // Setup code here.
+ }
+ while (state.KeepRunning()) {
+ // Run the test as normal.
+ }
+ if (state.thread_index == 0) {
+ // Teardown code here.
+ }
+}
+BENCHMARK(BM_MultiThreaded)->Threads(4);
+*/
+
+#ifndef BENCHMARK_BENCHMARK_API_H_
+#define BENCHMARK_BENCHMARK_API_H_
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "macros.h"
+
+namespace benchmark {
+class BenchmarkReporter;
+
+void Initialize(int* argc, char** argv);
+
+// Otherwise, run all benchmarks specified by the --benchmark_filter flag,
+// and exit after running the benchmarks.
+void RunSpecifiedBenchmarks();
+void RunSpecifiedBenchmarks(BenchmarkReporter* reporter);
+
+// If this routine is called, peak memory allocation past this point in the
+// benchmark is reported at the end of the benchmark report line. (It is
+// computed by running the benchmark once with a single iteration and a memory
+// tracer.)
+// TODO(dominic)
+// void MemoryUsage();
+
+namespace internal {
+class Benchmark;
+class BenchmarkImp;
+class BenchmarkFamilies;
+
+template <class T> struct Voider {
+ typedef void type;
+};
+
+template <class T, class = void>
+struct EnableIfString {};
+
+template <class T>
+struct EnableIfString<T, typename Voider<typename T::basic_string>::type> {
+ typedef int type;
+};
+
+void UseCharPointer(char const volatile*);
+
+// Take ownership of the pointer and register the benchmark. Return the
+// registered benchmark.
+Benchmark* RegisterBenchmarkInternal(Benchmark*);
+
+} // end namespace internal
+
+
+// The DoNotOptimize(...) function can be used to prevent a value or
+// expression from being optimized away by the compiler. This function is
+// intented to add little to no overhead.
+// See: http://stackoverflow.com/questions/28287064
+#if defined(__clang__) && defined(__GNUC__)
+// TODO(ericwf): Clang has a bug where it tries to always use a register
+// even if value must be stored in memory. This causes codegen to fail.
+// To work around this we remove the "r" modifier so the operand is always
+// loaded into memory.
+template <class Tp>
+inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
+ asm volatile("" : "+m" (const_cast<Tp&>(value)));
+}
+#elif defined(__GNUC__)
+template <class Tp>
+inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
+ asm volatile("" : "+rm" (const_cast<Tp&>(value)));
+}
+#else
+template <class Tp>
+inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
+ internal::UseCharPointer(&reinterpret_cast<char const volatile&>(value));
+}
+#endif
+
+
+// State is passed to a running Benchmark and contains state for the
+// benchmark to use.
+class State {
+public:
+ State(size_t max_iters, bool has_x, int x, bool has_y, int y, int thread_i);
+
+ // Returns true iff the benchmark should continue through another iteration.
+ // NOTE: A benchmark may not return from the test until KeepRunning() has
+ // returned false.
+ bool KeepRunning() {
+ if (BENCHMARK_BUILTIN_EXPECT(!started_, false)) {
+ ResumeTiming();
+ started_ = true;
+ }
+ bool const res = total_iterations_++ < max_iterations;
+ if (BENCHMARK_BUILTIN_EXPECT(!res, false)) {
+ assert(started_);
+ PauseTiming();
+ // Total iterations now is one greater than max iterations. Fix this.
+ total_iterations_ = max_iterations;
+ }
+ return res;
+ }
+
+ // REQUIRES: timer is running
+ // Stop the benchmark timer. If not called, the timer will be
+ // automatically stopped after KeepRunning() returns false for the first time.
+ //
+ // For threaded benchmarks the PauseTiming() function acts
+ // like a barrier. I.e., the ith call by a particular thread to this
+ // function will block until all threads have made their ith call.
+ // The timer will stop when the last thread has called this function.
+ //
+ // NOTE: PauseTiming()/ResumeTiming() are relatively
+ // heavyweight, and so their use should generally be avoided
+ // within each benchmark iteration, if possible.
+ void PauseTiming();
+
+ // REQUIRES: timer is not running
+ // Start the benchmark timer. The timer is NOT running on entrance to the
+ // benchmark function. It begins running after the first call to KeepRunning()
+ //
+ // For threaded benchmarks the ResumeTiming() function acts
+ // like a barrier. I.e., the ith call by a particular thread to this
+ // function will block until all threads have made their ith call.
+ // The timer will start when the last thread has called this function.
+ //
+ // NOTE: PauseTiming()/ResumeTiming() are relatively
+ // heavyweight, and so their use should generally be avoided
+ // within each benchmark iteration, if possible.
+ void ResumeTiming();
+
+ // Set the number of bytes processed by the current benchmark
+ // execution. This routine is typically called once at the end of a
+ // throughput oriented benchmark. If this routine is called with a
+ // value > 0, the report is printed in MB/sec instead of nanoseconds
+ // per iteration.
+ //
+ // REQUIRES: a benchmark has exited its KeepRunning loop.
+ BENCHMARK_ALWAYS_INLINE
+ void SetBytesProcessed(size_t bytes) {
+ bytes_processed_ = bytes;
+ }
+
+ BENCHMARK_ALWAYS_INLINE
+ size_t bytes_processed() const {
+ return bytes_processed_;
+ }
+
+ // If this routine is called with items > 0, then an items/s
+ // label is printed on the benchmark report line for the currently
+ // executing benchmark. It is typically called at the end of a processing
+ // benchmark where a processing items/second output is desired.
+ //
+ // REQUIRES: a benchmark has exited its KeepRunning loop.
+ BENCHMARK_ALWAYS_INLINE
+ void SetItemsProcessed(size_t items) {
+ items_processed_ = items;
+ }
+
+ BENCHMARK_ALWAYS_INLINE
+ size_t items_processed() const {
+ return items_processed_;
+ }
+
+ // If this routine is called, the specified label is printed at the
+ // end of the benchmark report line for the currently executing
+ // benchmark. Example:
+ // static void BM_Compress(int iters) {
+ // ...
+ // double compress = input_size / output_size;
+ // benchmark::SetLabel(StringPrintf("compress:%.1f%%", 100.0*compression));
+ // }
+ // Produces output that looks like:
+ // BM_Compress 50 50 14115038 compress:27.3%
+ //
+ // REQUIRES: a benchmark has exited its KeepRunning loop.
+ void SetLabel(const char* label);
+
+ // Allow the use of std::string without actually including <string>.
+ // This function does not participate in overload resolution unless StringType
+ // has the nested typename `basic_string`. This typename should be provided
+ // as an injected class name in the case of std::string.
+ template <class StringType>
+ void SetLabel(StringType const & str,
+ typename internal::EnableIfString<StringType>::type = 1) {
+ this->SetLabel(str.c_str());
+ }
+
+ // Range arguments for this run. CHECKs if the argument has been set.
+ BENCHMARK_ALWAYS_INLINE
+ int range_x() const {
+ assert(has_range_x_);
+ ((void)has_range_x_); // Prevent unused warning.
+ return range_x_;
+ }
+
+ BENCHMARK_ALWAYS_INLINE
+ int range_y() const {
+ assert(has_range_y_);
+ ((void)has_range_y_); // Prevent unused warning.
+ return range_y_;
+ }
+
+ BENCHMARK_ALWAYS_INLINE
+ size_t iterations() const { return total_iterations_; }
+
+private:
+ bool started_;
+ size_t total_iterations_;
+
+ bool has_range_x_;
+ int range_x_;
+
+ bool has_range_y_;
+ int range_y_;
+
+ size_t bytes_processed_;
+ size_t items_processed_;
+
+public:
+ const int thread_index;
+ const size_t max_iterations;
+
+private:
+ BENCHMARK_DISALLOW_COPY_AND_ASSIGN(State);
+};
+
+namespace internal {
+
+typedef void(Function)(State&);
+
+// ------------------------------------------------------
+// Benchmark registration object. The BENCHMARK() macro expands
+// into an internal::Benchmark* object. Various methods can
+// be called on this object to change the properties of the benchmark.
+// Each method returns "this" so that multiple method calls can
+// chained into one expression.
+class Benchmark {
+public:
+ virtual ~Benchmark();
+
+ // Note: the following methods all return "this" so that multiple
+ // method calls can be chained together in one expression.
+
+ // Run this benchmark once with "x" as the extra argument passed
+ // to the function.
+ // REQUIRES: The function passed to the constructor must accept an arg1.
+ Benchmark* Arg(int x);
+
+ // Run this benchmark once for a number of values picked from the
+ // range [start..limit]. (start and limit are always picked.)
+ // REQUIRES: The function passed to the constructor must accept an arg1.
+ Benchmark* Range(int start, int limit);
+
+ // Run this benchmark once for every value in the range [start..limit]
+ // REQUIRES: The function passed to the constructor must accept an arg1.
+ Benchmark* DenseRange(int start, int limit);
+
+ // Run this benchmark once with "x,y" as the extra arguments passed
+ // to the function.
+ // REQUIRES: The function passed to the constructor must accept arg1,arg2.
+ Benchmark* ArgPair(int x, int y);
+
+ // Pick a set of values A from the range [lo1..hi1] and a set
+ // of values B from the range [lo2..hi2]. Run the benchmark for
+ // every pair of values in the cartesian product of A and B
+ // (i.e., for all combinations of the values in A and B).
+ // REQUIRES: The function passed to the constructor must accept arg1,arg2.
+ Benchmark* RangePair(int lo1, int hi1, int lo2, int hi2);
+
+ // Pass this benchmark object to *func, which can customize
+ // the benchmark by calling various methods like Arg, ArgPair,
+ // Threads, etc.
+ Benchmark* Apply(void (*func)(Benchmark* benchmark));
+
+ // Set the minimum amount of time to use when running this benchmark. This
+ // option overrides the `benchmark_min_time` flag.
+ Benchmark* MinTime(double t);
+
+ // If a particular benchmark is I/O bound, runs multiple threads internally or
+ // if for some reason CPU timings are not representative, call this method. If
+ // called, the elapsed time will be used to control how many iterations are
+ // run, and in the printing of items/second or MB/seconds values. If not
+ // called, the cpu time used by the benchmark will be used.
+ Benchmark* UseRealTime();
+
+ // Support for running multiple copies of the same benchmark concurrently
+ // in multiple threads. This may be useful when measuring the scaling
+ // of some piece of code.
+
+ // Run one instance of this benchmark concurrently in t threads.
+ Benchmark* Threads(int t);
+
+ // Pick a set of values T from [min_threads,max_threads].
+ // min_threads and max_threads are always included in T. Run this
+ // benchmark once for each value in T. The benchmark run for a
+ // particular value t consists of t threads running the benchmark
+ // function concurrently. For example, consider:
+ // BENCHMARK(Foo)->ThreadRange(1,16);
+ // This will run the following benchmarks:
+ // Foo in 1 thread
+ // Foo in 2 threads
+ // Foo in 4 threads
+ // Foo in 8 threads
+ // Foo in 16 threads
+ Benchmark* ThreadRange(int min_threads, int max_threads);
+
+ // Equivalent to ThreadRange(NumCPUs(), NumCPUs())
+ Benchmark* ThreadPerCpu();
+
+ virtual void Run(State& state) = 0;
+
+ // Used inside the benchmark implementation
+ struct Instance;
+
+protected:
+ explicit Benchmark(const char* name);
+ Benchmark(Benchmark const&);
+ void SetName(const char* name);
+
+private:
+ friend class BenchmarkFamilies;
+ BenchmarkImp* imp_;
+
+ Benchmark& operator=(Benchmark const&);
+};
+
+// The class used to hold all Benchmarks created from static function.
+// (ie those created using the BENCHMARK(...) macros.
+class FunctionBenchmark : public Benchmark {
+public:
+ FunctionBenchmark(const char* name, Function* func)
+ : Benchmark(name), func_(func)
+ {}
+
+ virtual void Run(State& st);
+private:
+ Function* func_;
+};
+
+} // end namespace internal
+
+// The base class for all fixture tests.
+class Fixture: public internal::Benchmark {
+public:
+ Fixture() : internal::Benchmark("") {}
+
+ virtual void Run(State& st) {
+ this->SetUp();
+ this->BenchmarkCase(st);
+ this->TearDown();
+ }
+
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+
+protected:
+ virtual void BenchmarkCase(State&) = 0;
+};
+
+} // end namespace benchmark
+
+
+// ------------------------------------------------------
+// Macro to register benchmarks
+
+// Check that __COUNTER__ is defined and that __COUNTER__ increases by 1
+// every time it is expanded. X + 1 == X + 0 is used in case X is defined to be
+// empty. If X is empty the expression becomes (+1 == +0).
+#if defined(__COUNTER__) && (__COUNTER__ + 1 == __COUNTER__ + 0)
+#define BENCHMARK_PRIVATE_UNIQUE_ID __COUNTER__
+#else
+#define BENCHMARK_PRIVATE_UNIQUE_ID __LINE__
+#endif
+
+// Helpers for generating unique variable names
+#define BENCHMARK_PRIVATE_NAME(n) \
+ BENCHMARK_PRIVATE_CONCAT(_benchmark_, BENCHMARK_PRIVATE_UNIQUE_ID, n)
+#define BENCHMARK_PRIVATE_CONCAT(a, b, c) BENCHMARK_PRIVATE_CONCAT2(a, b, c)
+#define BENCHMARK_PRIVATE_CONCAT2(a, b, c) a##b##c
+
+#define BENCHMARK_PRIVATE_DECLARE(n) \
+ static ::benchmark::internal::Benchmark* \
+ BENCHMARK_PRIVATE_NAME(n) BENCHMARK_UNUSED
+
+#define BENCHMARK(n) \
+ BENCHMARK_PRIVATE_DECLARE(n) = \
+ (::benchmark::internal::RegisterBenchmarkInternal( \
+ new ::benchmark::internal::FunctionBenchmark(#n, n)))
+
+// Old-style macros
+#define BENCHMARK_WITH_ARG(n, a) BENCHMARK(n)->Arg((a))
+#define BENCHMARK_WITH_ARG2(n, a1, a2) BENCHMARK(n)->ArgPair((a1), (a2))
+#define BENCHMARK_RANGE(n, lo, hi) BENCHMARK(n)->Range((lo), (hi))
+#define BENCHMARK_RANGE2(n, l1, h1, l2, h2) \
+ BENCHMARK(n)->RangePair((l1), (h1), (l2), (h2))
+
+// This will register a benchmark for a templatized function. For example:
+//
+// template<int arg>
+// void BM_Foo(int iters);
+//
+// BENCHMARK_TEMPLATE(BM_Foo, 1);
+//
+// will register BM_Foo<1> as a benchmark.
+#define BENCHMARK_TEMPLATE1(n, a) \
+ BENCHMARK_PRIVATE_DECLARE(n) = \
+ (::benchmark::internal::RegisterBenchmarkInternal( \
+ new ::benchmark::internal::FunctionBenchmark(#n "<" #a ">", n<a>)))
+
+#define BENCHMARK_TEMPLATE2(n, a, b) \
+ BENCHMARK_PRIVATE_DECLARE(n) = \
+ (::benchmark::internal::RegisterBenchmarkInternal( \
+ new ::benchmark::internal::FunctionBenchmark( \
+ #n "<" #a "," #b ">", n<a, b>)))
+
+#if __cplusplus >= 201103L
+#define BENCHMARK_TEMPLATE(n, ...) \
+ BENCHMARK_PRIVATE_DECLARE(n) = \
+ (::benchmark::internal::RegisterBenchmarkInternal( \
+ new ::benchmark::internal::FunctionBenchmark( \
+ #n "<" #__VA_ARGS__ ">", n<__VA_ARGS__>)))
+#else
+#define BENCHMARK_TEMPLATE(n, a) BENCHMARK_TEMPLATE1(n, a)
+#endif
+
+
+#define BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \
+class BaseClass##_##Method##_Benchmark : public BaseClass { \
+public: \
+ BaseClass##_##Method##_Benchmark() : BaseClass() { \
+ this->SetName(#BaseClass "/" #Method);} \
+protected: \
+ virtual void BenchmarkCase(::benchmark::State&); \
+};
+
+#define BENCHMARK_DEFINE_F(BaseClass, Method) \
+ BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \
+ void BaseClass##_##Method##_Benchmark::BenchmarkCase
+
+#define BENCHMARK_REGISTER_F(BaseClass, Method) \
+ BENCHMARK_PRIVATE_REGISTER_F(BaseClass##_##Method##_Benchmark)
+
+#define BENCHMARK_PRIVATE_REGISTER_F(TestName) \
+ BENCHMARK_PRIVATE_DECLARE(TestName) = \
+ (::benchmark::internal::RegisterBenchmarkInternal(new TestName()))
+
+// This macro will define and register a benchmark within a fixture class.
+#define BENCHMARK_F(BaseClass, Method) \
+ BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \
+ BENCHMARK_REGISTER_F(BaseClass, Method); \
+ void BaseClass##_##Method##_Benchmark::BenchmarkCase
+
+
+// Helper macro to create a main routine in a test that runs the benchmarks
+#define BENCHMARK_MAIN() \
+ int main(int argc, char** argv) { \
+ ::benchmark::Initialize(&argc, argv); \
+ ::benchmark::RunSpecifiedBenchmarks(); \
+ }
+
+#endif // BENCHMARK_BENCHMARK_API_H_
diff --git a/3rdparty/benchmark/include/benchmark/macros.h b/3rdparty/benchmark/include/benchmark/macros.h
new file mode 100644
index 00000000000..3e9540edc44
--- /dev/null
+++ b/3rdparty/benchmark/include/benchmark/macros.h
@@ -0,0 +1,48 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+#ifndef BENCHMARK_MACROS_H_
+#define BENCHMARK_MACROS_H_
+
+#if __cplusplus < 201103L
+# define BENCHMARK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&); \
+ TypeName& operator=(const TypeName&)
+#else
+# define BENCHMARK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&) = delete; \
+ TypeName& operator=(const TypeName&) = delete
+#endif
+
+#if defined(__GNUC__)
+# define BENCHMARK_UNUSED __attribute__((unused))
+# define BENCHMARK_ALWAYS_INLINE __attribute__((always_inline))
+# define BENCHMARK_NOEXCEPT noexcept
+#elif defined(_MSC_VER) && !defined(__clang__)
+# define BENCHMARK_UNUSED
+# define BENCHMARK_ALWAYS_INLINE __forceinline
+# define BENCHMARK_NOEXCEPT
+# define __func__ __FUNCTION__
+#else
+# define BENCHMARK_UNUSED
+# define BENCHMARK_ALWAYS_INLINE
+# define BENCHMARK_NOEXCEPT
+#endif
+
+#if defined(__GNUC__)
+# define BENCHMARK_BUILTIN_EXPECT(x, y) __builtin_expect(x, y)
+#else
+# define BENCHMARK_BUILTIN_EXPECT(x, y) x
+#endif
+
+#endif // BENCHMARK_MACROS_H_
diff --git a/3rdparty/benchmark/include/benchmark/reporter.h b/3rdparty/benchmark/include/benchmark/reporter.h
new file mode 100644
index 00000000000..d23ab6574d7
--- /dev/null
+++ b/3rdparty/benchmark/include/benchmark/reporter.h
@@ -0,0 +1,122 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+#ifndef BENCHMARK_REPORTER_H_
+#define BENCHMARK_REPORTER_H_
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "benchmark_api.h" // For forward declaration of BenchmarkReporter
+
+namespace benchmark {
+
+// Interface for custom benchmark result printers.
+// By default, benchmark reports are printed to stdout. However an application
+// can control the destination of the reports by calling
+// RunSpecifiedBenchmarks and passing it a custom reporter object.
+// The reporter object must implement the following interface.
+class BenchmarkReporter {
+ public:
+ struct Context {
+ int num_cpus;
+ double mhz_per_cpu;
+ bool cpu_scaling_enabled;
+
+ // The number of chars in the longest benchmark name.
+ size_t name_field_width;
+ };
+
+ struct Run {
+ Run() :
+ iterations(1),
+ real_accumulated_time(0),
+ cpu_accumulated_time(0),
+ bytes_per_second(0),
+ items_per_second(0),
+ max_heapbytes_used(0) {}
+
+ std::string benchmark_name;
+ std::string report_label; // Empty if not set by benchmark.
+ int64_t iterations;
+ double real_accumulated_time;
+ double cpu_accumulated_time;
+
+ // Zero if not set by benchmark.
+ double bytes_per_second;
+ double items_per_second;
+
+ // This is set to 0.0 if memory tracing is not enabled.
+ double max_heapbytes_used;
+ };
+
+ // Called once for every suite of benchmarks run.
+ // The parameter "context" contains information that the
+ // reporter may wish to use when generating its report, for example the
+ // platform under which the benchmarks are running. The benchmark run is
+ // never started if this function returns false, allowing the reporter
+ // to skip runs based on the context information.
+ virtual bool ReportContext(const Context& context) = 0;
+
+ // Called once for each group of benchmark runs, gives information about
+ // cpu-time and heap memory usage during the benchmark run.
+ // Note that all the grouped benchmark runs should refer to the same
+ // benchmark, thus have the same name.
+ virtual void ReportRuns(const std::vector<Run>& report) = 0;
+
+ // Called once and only once after ever group of benchmarks is run and
+ // reported.
+ virtual void Finalize();
+
+ virtual ~BenchmarkReporter();
+protected:
+ static void ComputeStats(std::vector<Run> const& reports, Run* mean, Run* stddev);
+};
+
+// Simple reporter that outputs benchmark data to the console. This is the
+// default reporter used by RunSpecifiedBenchmarks().
+class ConsoleReporter : public BenchmarkReporter {
+ public:
+ virtual bool ReportContext(const Context& context);
+ virtual void ReportRuns(const std::vector<Run>& reports);
+protected:
+ virtual void PrintRunData(const Run& report);
+
+ size_t name_field_width_;
+};
+
+class JSONReporter : public BenchmarkReporter {
+public:
+ JSONReporter() : first_report_(true) {}
+ virtual bool ReportContext(const Context& context);
+ virtual void ReportRuns(const std::vector<Run>& reports);
+ virtual void Finalize();
+
+private:
+ void PrintRunData(const Run& report);
+
+ bool first_report_;
+};
+
+class CSVReporter : public BenchmarkReporter {
+public:
+ virtual bool ReportContext(const Context& context);
+ virtual void ReportRuns(const std::vector<Run>& reports);
+
+private:
+ void PrintRunData(const Run& report);
+};
+
+} // end namespace benchmark
+#endif // BENCHMARK_REPORTER_H_
diff --git a/3rdparty/benchmark/mingw.py b/3rdparty/benchmark/mingw.py
new file mode 100644
index 00000000000..706ad559db9
--- /dev/null
+++ b/3rdparty/benchmark/mingw.py
@@ -0,0 +1,320 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+import argparse
+import errno
+import logging
+import os
+import platform
+import re
+import sys
+import subprocess
+import tempfile
+
+try:
+ import winreg
+except ImportError:
+ import _winreg as winreg
+try:
+ import urllib.request as request
+except ImportError:
+ import urllib as request
+try:
+ import urllib.parse as parse
+except ImportError:
+ import urlparse as parse
+
+class EmptyLogger(object):
+ '''
+ Provides an implementation that performs no logging
+ '''
+ def debug(self, *k, **kw):
+ pass
+ def info(self, *k, **kw):
+ pass
+ def warn(self, *k, **kw):
+ pass
+ def error(self, *k, **kw):
+ pass
+ def critical(self, *k, **kw):
+ pass
+ def setLevel(self, *k, **kw):
+ pass
+
+urls = (
+ 'http://downloads.sourceforge.net/project/mingw-w64/Toolchains%20'
+ 'targetting%20Win32/Personal%20Builds/mingw-builds/installer/'
+ 'repository.txt',
+ 'http://downloads.sourceforge.net/project/mingwbuilds/host-windows/'
+ 'repository.txt'
+)
+'''
+A list of mingw-build repositories
+'''
+
+def repository(urls = urls, log = EmptyLogger()):
+ '''
+ Downloads and parse mingw-build repository files and parses them
+ '''
+ log.info('getting mingw-builds repository')
+ versions = {}
+ re_sourceforge = re.compile(r'http://sourceforge.net/projects/([^/]+)/files')
+ re_sub = r'http://downloads.sourceforge.net/project/\1'
+ for url in urls:
+ log.debug(' - requesting: %s', url)
+ socket = request.urlopen(url)
+ repo = socket.read()
+ if not isinstance(repo, str):
+ repo = repo.decode();
+ socket.close()
+ for entry in repo.split('\n')[:-1]:
+ value = entry.split('|')
+ version = tuple([int(n) for n in value[0].strip().split('.')])
+ version = versions.setdefault(version, {})
+ arch = value[1].strip()
+ if arch == 'x32':
+ arch = 'i686'
+ elif arch == 'x64':
+ arch = 'x86_64'
+ arch = version.setdefault(arch, {})
+ threading = arch.setdefault(value[2].strip(), {})
+ exceptions = threading.setdefault(value[3].strip(), {})
+ revision = exceptions.setdefault(int(value[4].strip()[3:]),
+ re_sourceforge.sub(re_sub, value[5].strip()))
+ return versions
+
+def find_in_path(file, path=None):
+ '''
+ Attempts to find an executable in the path
+ '''
+ if platform.system() == 'Windows':
+ file += '.exe'
+ if path is None:
+ path = os.environ.get('PATH', '')
+ if type(path) is type(''):
+ path = path.split(os.pathsep)
+ return list(filter(os.path.exists,
+ map(lambda dir, file=file: os.path.join(dir, file), path)))
+
+def find_7zip(log = EmptyLogger()):
+ '''
+ Attempts to find 7zip for unpacking the mingw-build archives
+ '''
+ log.info('finding 7zip')
+ path = find_in_path('7z')
+ if not path:
+ key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\7-Zip')
+ path, _ = winreg.QueryValueEx(key, 'Path')
+ path = [os.path.join(path, '7z.exe')]
+ log.debug('found \'%s\'', path[0])
+ return path[0]
+
+find_7zip()
+
+def unpack(archive, location, log = EmptyLogger()):
+ '''
+ Unpacks a mingw-builds archive
+ '''
+ sevenzip = find_7zip(log)
+ log.info('unpacking %s', os.path.basename(archive))
+ cmd = [sevenzip, 'x', archive, '-o' + location, '-y']
+ log.debug(' - %r', cmd)
+ with open(os.devnull, 'w') as devnull:
+ subprocess.check_call(cmd, stdout = devnull)
+
+def download(url, location, log = EmptyLogger()):
+ '''
+ Downloads and unpacks a mingw-builds archive
+ '''
+ log.info('downloading MinGW')
+ log.debug(' - url: %s', url)
+ log.debug(' - location: %s', location)
+
+ re_content = re.compile(r'attachment;[ \t]*filename=(")?([^"]*)(")?[\r\n]*')
+
+ stream = request.urlopen(url)
+ try:
+ content = stream.getheader('Content-Disposition') or ''
+ except AttributeError:
+ content = stream.headers.getheader('Content-Disposition') or ''
+ matches = re_content.match(content)
+ if matches:
+ filename = matches.group(2)
+ else:
+ parsed = parse.urlparse(stream.geturl())
+ filename = os.path.basename(parsed.path)
+
+ try:
+ os.makedirs(location)
+ except OSError as e:
+ if e.errno == errno.EEXIST and os.path.isdir(location):
+ pass
+ else:
+ raise
+
+ archive = os.path.join(location, filename)
+ with open(archive, 'wb') as out:
+ while True:
+ buf = stream.read(1024)
+ if not buf:
+ break
+ out.write(buf)
+ unpack(archive, location, log = log)
+ os.remove(archive)
+
+ possible = os.path.join(location, 'mingw64')
+ if not os.path.exists(possible):
+ possible = os.path.join(location, 'mingw32')
+ if not os.path.exists(possible):
+ raise ValueError('Failed to find unpacked MinGW: ' + possible)
+ return possible
+
+def root(location = None, arch = None, version = None, threading = None,
+ exceptions = None, revision = None, log = EmptyLogger()):
+ '''
+ Returns the root folder of a specific version of the mingw-builds variant
+ of gcc. Will download the compiler if needed
+ '''
+
+ # Get the repository if we don't have all the information
+ if not (arch and version and threading and exceptions and revision):
+ versions = repository(log = log)
+
+ # Determine some defaults
+ version = version or max(versions.keys())
+ if not arch:
+ arch = platform.machine().lower()
+ if arch == 'x86':
+ arch = 'i686'
+ elif arch == 'amd64':
+ arch = 'x86_64'
+ if not threading:
+ keys = versions[version][arch].keys()
+ if 'posix' in keys:
+ threading = 'posix'
+ elif 'win32' in keys:
+ threading = 'win32'
+ else:
+ threading = keys[0]
+ if not exceptions:
+ keys = versions[version][arch][threading].keys()
+ if 'seh' in keys:
+ exceptions = 'seh'
+ elif 'sjlj' in keys:
+ exceptions = 'sjlj'
+ else:
+ exceptions = keys[0]
+ if revision == None:
+ revision = max(versions[version][arch][threading][exceptions].keys())
+ if not location:
+ location = os.path.join(tempfile.gettempdir(), 'mingw-builds')
+
+ # Get the download url
+ url = versions[version][arch][threading][exceptions][revision]
+
+ # Tell the user whatzzup
+ log.info('finding MinGW %s', '.'.join(str(v) for v in version))
+ log.debug(' - arch: %s', arch)
+ log.debug(' - threading: %s', threading)
+ log.debug(' - exceptions: %s', exceptions)
+ log.debug(' - revision: %s', revision)
+ log.debug(' - url: %s', url)
+
+ # Store each specific revision differently
+ slug = '{version}-{arch}-{threading}-{exceptions}-rev{revision}'
+ slug = slug.format(
+ version = '.'.join(str(v) for v in version),
+ arch = arch,
+ threading = threading,
+ exceptions = exceptions,
+ revision = revision
+ )
+ if arch == 'x86_64':
+ root_dir = os.path.join(location, slug, 'mingw64')
+ elif arch == 'i686':
+ root_dir = os.path.join(location, slug, 'mingw32')
+ else:
+ raise ValueError('Unknown MinGW arch: ' + arch)
+
+ # Download if needed
+ if not os.path.exists(root_dir):
+ downloaded = download(url, os.path.join(location, slug), log = log)
+ if downloaded != root_dir:
+ raise ValueError('The location of mingw did not match\n%s\n%s'
+ % (downloaded, root_dir))
+
+ return root_dir
+
+def str2ver(string):
+ '''
+ Converts a version string into a tuple
+ '''
+ try:
+ version = tuple(int(v) for v in string.split('.'))
+ if len(version) is not 3:
+ raise ValueError()
+ except ValueError:
+ raise argparse.ArgumentTypeError(
+ 'please provide a three digit version string')
+ return version
+
+def main():
+ '''
+ Invoked when the script is run directly by the python interpreter
+ '''
+ parser = argparse.ArgumentParser(
+ description = 'Downloads a specific version of MinGW',
+ formatter_class = argparse.ArgumentDefaultsHelpFormatter
+ )
+ parser.add_argument('--location',
+ help = 'the location to download the compiler to',
+ default = os.path.join(tempfile.gettempdir(), 'mingw-builds'))
+ parser.add_argument('--arch', required = True, choices = ['i686', 'x86_64'],
+ help = 'the target MinGW architecture string')
+ parser.add_argument('--version', type = str2ver,
+ help = 'the version of GCC to download')
+ parser.add_argument('--threading', choices = ['posix', 'win32'],
+ help = 'the threading type of the compiler')
+ parser.add_argument('--exceptions', choices = ['sjlj', 'seh', 'dwarf'],
+ help = 'the method to throw exceptions')
+ parser.add_argument('--revision', type=int,
+ help = 'the revision of the MinGW release')
+ group = parser.add_mutually_exclusive_group()
+ group.add_argument('-v', '--verbose', action='store_true',
+ help='increase the script output verbosity')
+ group.add_argument('-q', '--quiet', action='store_true',
+ help='only print errors and warning')
+ args = parser.parse_args()
+
+ # Create the logger
+ logger = logging.getLogger('mingw')
+ handler = logging.StreamHandler()
+ formatter = logging.Formatter('%(message)s')
+ handler.setFormatter(formatter)
+ logger.addHandler(handler)
+ logger.setLevel(logging.INFO)
+ if args.quiet:
+ logger.setLevel(logging.WARN)
+ if args.verbose:
+ logger.setLevel(logging.DEBUG)
+
+ # Get MinGW
+ root_dir = root(location = args.location, arch = args.arch,
+ version = args.version, threading = args.threading,
+ exceptions = args.exceptions, revision = args.revision,
+ log = logger)
+
+ sys.stdout.write('%s\n' % os.path.join(root_dir, 'bin'))
+
+if __name__ == '__main__':
+ try:
+ main()
+ except IOError as e:
+ sys.stderr.write('IO error: %s\n' % e)
+ sys.exit(1)
+ except OSError as e:
+ sys.stderr.write('OS error: %s\n' % e)
+ sys.exit(1)
+ except KeyboardInterrupt as e:
+ sys.stderr.write('Killed\n')
+ sys.exit(1)
diff --git a/3rdparty/benchmark/src/CMakeLists.txt b/3rdparty/benchmark/src/CMakeLists.txt
new file mode 100644
index 00000000000..811d075575a
--- /dev/null
+++ b/3rdparty/benchmark/src/CMakeLists.txt
@@ -0,0 +1,51 @@
+# Allow the source files to find headers in src/
+include_directories(${PROJECT_SOURCE_DIR}/src)
+
+# Define the source files
+set(SOURCE_FILES "benchmark.cc" "colorprint.cc" "commandlineflags.cc"
+ "console_reporter.cc" "csv_reporter.cc" "json_reporter.cc"
+ "log.cc" "reporter.cc" "sleep.cc" "string_util.cc"
+ "sysinfo.cc" "walltime.cc")
+# Determine the correct regular expression engine to use
+if(HAVE_STD_REGEX)
+ set(RE_FILES "re_std.cc")
+elseif(HAVE_GNU_POSIX_REGEX)
+ set(RE_FILES "re_posix.cc")
+elseif(HAVE_POSIX_REGEX)
+ set(RE_FILES "re_posix.cc")
+else()
+ message(FATAL_ERROR "Failed to determine the source files for the regular expression backend")
+endif()
+
+add_library(benchmark ${SOURCE_FILES} ${RE_FILES})
+
+
+set_target_properties(benchmark PROPERTIES
+ OUTPUT_NAME "benchmark"
+ VERSION ${GENERIC_LIB_VERSION}
+ SOVERSION ${GENERIC_LIB_SOVERSION}
+)
+
+# Link threads.
+target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT})
+
+# We need extra libraries on Windows
+if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ target_link_libraries(benchmark Shlwapi)
+endif()
+
+# Expose public API
+target_include_directories(benchmark PUBLIC ${PROJECT_SOURCE_DIR}/include)
+
+# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
+install(
+ TARGETS benchmark
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+ COMPONENT library)
+
+install(
+ DIRECTORY "${PROJECT_SOURCE_DIR}/include/benchmark"
+ DESTINATION include
+ FILES_MATCHING PATTERN "*.*h")
diff --git a/3rdparty/benchmark/src/arraysize.h b/3rdparty/benchmark/src/arraysize.h
new file mode 100644
index 00000000000..638a52a0ecb
--- /dev/null
+++ b/3rdparty/benchmark/src/arraysize.h
@@ -0,0 +1,34 @@
+#ifndef BENCHMARK_ARRAYSIZE_H_
+#define BENCHMARK_ARRAYSIZE_H_
+
+#include "internal_macros.h"
+
+namespace benchmark {
+namespace internal {
+// The arraysize(arr) macro returns the # of elements in an array arr.
+// The expression is a compile-time constant, and therefore can be
+// used in defining new arrays, for example. If you use arraysize on
+// a pointer by mistake, you will get a compile-time error.
+//
+
+
+// This template function declaration is used in defining arraysize.
+// Note that the function doesn't need an implementation, as we only
+// use its type.
+template <typename T, size_t N>
+char (&ArraySizeHelper(T (&array)[N]))[N];
+
+// That gcc wants both of these prototypes seems mysterious. VC, for
+// its part, can't decide which to use (another mystery). Matching of
+// template overloads: the final frontier.
+#ifndef COMPILER_MSVC
+template <typename T, size_t N>
+char (&ArraySizeHelper(const T (&array)[N]))[N];
+#endif
+
+#define arraysize(array) (sizeof(::benchmark::internal::ArraySizeHelper(array)))
+
+} // end namespace internal
+} // end namespace benchmark
+
+#endif // BENCHMARK_ARRAYSIZE_H_
diff --git a/3rdparty/benchmark/src/benchmark.cc b/3rdparty/benchmark/src/benchmark.cc
new file mode 100644
index 00000000000..269b7978023
--- /dev/null
+++ b/3rdparty/benchmark/src/benchmark.cc
@@ -0,0 +1,919 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "benchmark/benchmark.h"
+#include "internal_macros.h"
+
+#ifndef BENCHMARK_OS_WINDOWS
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#endif
+
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+#include <algorithm>
+#include <atomic>
+#include <condition_variable>
+#include <iostream>
+#include <memory>
+#include <thread>
+
+#include "check.h"
+#include "commandlineflags.h"
+#include "log.h"
+#include "mutex.h"
+#include "re.h"
+#include "stat.h"
+#include "string_util.h"
+#include "sysinfo.h"
+#include "walltime.h"
+
+DEFINE_bool(benchmark_list_tests, false,
+ "Print a list of benchmarks. This option overrides all other "
+ "options.");
+
+DEFINE_string(benchmark_filter, ".",
+ "A regular expression that specifies the set of benchmarks "
+ "to execute. If this flag is empty, no benchmarks are run. "
+ "If this flag is the string \"all\", all benchmarks linked "
+ "into the process are run.");
+
+DEFINE_double(benchmark_min_time, 0.5,
+ "Minimum number of seconds we should run benchmark before "
+ "results are considered significant. For cpu-time based "
+ "tests, this is the lower bound on the total cpu time "
+ "used by all threads that make up the test. For real-time "
+ "based tests, this is the lower bound on the elapsed time "
+ "of the benchmark execution, regardless of number of "
+ "threads.");
+
+DEFINE_int32(benchmark_repetitions, 1,
+ "The number of runs of each benchmark. If greater than 1, the "
+ "mean and standard deviation of the runs will be reported.");
+
+DEFINE_string(benchmark_format, "tabular",
+ "The format to use for console output. Valid values are "
+ "'tabular', 'json', or 'csv'.");
+
+DEFINE_bool(color_print, true, "Enables colorized logging.");
+
+DEFINE_int32(v, 0, "The level of verbose logging to output");
+
+
+namespace benchmark {
+
+namespace internal {
+
+void UseCharPointer(char const volatile*) {}
+
+// NOTE: This is a dummy "mutex" type used to denote the actual mutex
+// returned by GetBenchmarkLock(). This is only used to placate the thread
+// safety warnings by giving the return of GetBenchmarkLock() a name.
+struct CAPABILITY("mutex") BenchmarkLockType {};
+BenchmarkLockType BenchmarkLockVar;
+
+} // end namespace internal
+
+inline Mutex& RETURN_CAPABILITY(::benchmark::internal::BenchmarkLockVar)
+GetBenchmarkLock()
+{
+ static Mutex lock;
+ return lock;
+}
+
+namespace {
+
+bool IsZero(double n) {
+ return std::abs(n) < std::numeric_limits<double>::epsilon();
+}
+
+// For non-dense Range, intermediate values are powers of kRangeMultiplier.
+static const int kRangeMultiplier = 8;
+static const size_t kMaxIterations = 1000000000;
+
+bool running_benchmark = false;
+
+// Global variable so that a benchmark can cause a little extra printing
+std::string* GetReportLabel() {
+ static std::string label GUARDED_BY(GetBenchmarkLock());
+ return &label;
+}
+
+// TODO(ericwf): support MallocCounter.
+//static benchmark::MallocCounter *benchmark_mc;
+
+struct ThreadStats {
+ ThreadStats() : bytes_processed(0), items_processed(0) {}
+ int64_t bytes_processed;
+ int64_t items_processed;
+};
+
+// Timer management class
+class TimerManager {
+ public:
+ TimerManager(int num_threads, Notification* done)
+ : num_threads_(num_threads),
+ done_(done),
+ running_(false),
+ real_time_used_(0),
+ cpu_time_used_(0),
+ num_finalized_(0),
+ phase_number_(0),
+ entered_(0) {
+ }
+
+ // Called by each thread
+ void StartTimer() EXCLUDES(lock_) {
+ bool last_thread = false;
+ {
+ MutexLock ml(lock_);
+ last_thread = Barrier(ml);
+ if (last_thread) {
+ CHECK(!running_) << "Called StartTimer when timer is already running";
+ running_ = true;
+ start_real_time_ = walltime::Now();
+ start_cpu_time_ = MyCPUUsage() + ChildrenCPUUsage();
+ }
+ }
+ if (last_thread) {
+ phase_condition_.notify_all();
+ }
+ }
+
+ // Called by each thread
+ void StopTimer() EXCLUDES(lock_) {
+ bool last_thread = false;
+ {
+ MutexLock ml(lock_);
+ last_thread = Barrier(ml);
+ if (last_thread) {
+ CHECK(running_) << "Called StopTimer when timer is already stopped";
+ InternalStop();
+ }
+ }
+ if (last_thread) {
+ phase_condition_.notify_all();
+ }
+ }
+
+ // Called by each thread
+ void Finalize() EXCLUDES(lock_) {
+ MutexLock l(lock_);
+ num_finalized_++;
+ if (num_finalized_ == num_threads_) {
+ CHECK(!running_) <<
+ "The timer should be stopped before the timer is finalized";
+ done_->Notify();
+ }
+ }
+
+ // REQUIRES: timer is not running
+ double real_time_used() EXCLUDES(lock_) {
+ MutexLock l(lock_);
+ CHECK(!running_);
+ return real_time_used_;
+ }
+
+ // REQUIRES: timer is not running
+ double cpu_time_used() EXCLUDES(lock_) {
+ MutexLock l(lock_);
+ CHECK(!running_);
+ return cpu_time_used_;
+ }
+
+ private:
+ Mutex lock_;
+ Condition phase_condition_;
+ int num_threads_;
+ Notification* done_;
+
+ bool running_; // Is the timer running
+ double start_real_time_; // If running_
+ double start_cpu_time_; // If running_
+
+ // Accumulated time so far (does not contain current slice if running_)
+ double real_time_used_;
+ double cpu_time_used_;
+
+ // How many threads have called Finalize()
+ int num_finalized_;
+
+ // State for barrier management
+ int phase_number_;
+ int entered_; // Number of threads that have entered this barrier
+
+ void InternalStop() REQUIRES(lock_) {
+ CHECK(running_);
+ running_ = false;
+ real_time_used_ += walltime::Now() - start_real_time_;
+ cpu_time_used_ += ((MyCPUUsage() + ChildrenCPUUsage())
+ - start_cpu_time_);
+ }
+
+ // Enter the barrier and wait until all other threads have also
+ // entered the barrier. Returns iff this is the last thread to
+ // enter the barrier.
+ bool Barrier(MutexLock& ml) REQUIRES(lock_) {
+ CHECK_LT(entered_, num_threads_);
+ entered_++;
+ if (entered_ < num_threads_) {
+ // Wait for all threads to enter
+ int phase_number_cp = phase_number_;
+ auto cb = [this, phase_number_cp]() {
+ return this->phase_number_ > phase_number_cp;
+ };
+ phase_condition_.wait(ml.native_handle(), cb);
+ return false; // I was not the last one
+ } else {
+ // Last thread has reached the barrier
+ phase_number_++;
+ entered_ = 0;
+ return true;
+ }
+ }
+};
+
+// TimerManager for current run.
+static std::unique_ptr<TimerManager> timer_manager = nullptr;
+
+} // end namespace
+
+namespace internal {
+
+// Information kept per benchmark we may want to run
+struct Benchmark::Instance {
+ std::string name;
+ Benchmark* benchmark;
+ bool has_arg1;
+ int arg1;
+ bool has_arg2;
+ int arg2;
+ bool use_real_time;
+ double min_time;
+ int threads; // Number of concurrent threads to use
+ bool multithreaded; // Is benchmark multi-threaded?
+};
+
+// Class for managing registered benchmarks. Note that each registered
+// benchmark identifies a family of related benchmarks to run.
+class BenchmarkFamilies {
+ public:
+ static BenchmarkFamilies* GetInstance();
+
+ // Registers a benchmark family and returns the index assigned to it.
+ size_t AddBenchmark(std::unique_ptr<Benchmark> family);
+
+ // Extract the list of benchmark instances that match the specified
+ // regular expression.
+ bool FindBenchmarks(const std::string& re,
+ std::vector<Benchmark::Instance>* benchmarks);
+ private:
+ BenchmarkFamilies() {}
+
+ std::vector<std::unique_ptr<Benchmark>> families_;
+ Mutex mutex_;
+};
+
+
+class BenchmarkImp {
+public:
+ explicit BenchmarkImp(const char* name);
+ ~BenchmarkImp();
+
+ void Arg(int x);
+ void Range(int start, int limit);
+ void DenseRange(int start, int limit);
+ void ArgPair(int start, int limit);
+ void RangePair(int lo1, int hi1, int lo2, int hi2);
+ void MinTime(double n);
+ void UseRealTime();
+ void Threads(int t);
+ void ThreadRange(int min_threads, int max_threads);
+ void ThreadPerCpu();
+ void SetName(const char* name);
+
+ static void AddRange(std::vector<int>* dst, int lo, int hi, int mult);
+
+private:
+ friend class BenchmarkFamilies;
+
+ std::string name_;
+ int arg_count_;
+ std::vector< std::pair<int, int> > args_; // Args for all benchmark runs
+ double min_time_;
+ bool use_real_time_;
+ std::vector<int> thread_counts_;
+
+ BenchmarkImp& operator=(BenchmarkImp const&);
+};
+
+BenchmarkFamilies* BenchmarkFamilies::GetInstance() {
+ static BenchmarkFamilies instance;
+ return &instance;
+}
+
+
+size_t BenchmarkFamilies::AddBenchmark(std::unique_ptr<Benchmark> family) {
+ MutexLock l(mutex_);
+ size_t index = families_.size();
+ families_.push_back(std::move(family));
+ return index;
+}
+
+bool BenchmarkFamilies::FindBenchmarks(
+ const std::string& spec,
+ std::vector<Benchmark::Instance>* benchmarks) {
+ // Make regular expression out of command-line flag
+ std::string error_msg;
+ Regex re;
+ if (!re.Init(spec, &error_msg)) {
+ std::cerr << "Could not compile benchmark re: " << error_msg << std::endl;
+ return false;
+ }
+
+ // Special list of thread counts to use when none are specified
+ std::vector<int> one_thread;
+ one_thread.push_back(1);
+
+ MutexLock l(mutex_);
+ for (std::unique_ptr<Benchmark>& bench_family : families_) {
+ // Family was deleted or benchmark doesn't match
+ if (!bench_family) continue;
+ BenchmarkImp* family = bench_family->imp_;
+
+ if (family->arg_count_ == -1) {
+ family->arg_count_ = 0;
+ family->args_.emplace_back(-1, -1);
+ }
+ for (auto const& args : family->args_) {
+ const std::vector<int>* thread_counts =
+ (family->thread_counts_.empty()
+ ? &one_thread
+ : &family->thread_counts_);
+ for (int num_threads : *thread_counts) {
+
+ Benchmark::Instance instance;
+ instance.name = family->name_;
+ instance.benchmark = bench_family.get();
+ instance.has_arg1 = family->arg_count_ >= 1;
+ instance.arg1 = args.first;
+ instance.has_arg2 = family->arg_count_ == 2;
+ instance.arg2 = args.second;
+ instance.min_time = family->min_time_;
+ instance.use_real_time = family->use_real_time_;
+ instance.threads = num_threads;
+ instance.multithreaded = !(family->thread_counts_.empty());
+
+ // Add arguments to instance name
+ if (family->arg_count_ >= 1) {
+ AppendHumanReadable(instance.arg1, &instance.name);
+ }
+ if (family->arg_count_ >= 2) {
+ AppendHumanReadable(instance.arg2, &instance.name);
+ }
+ if (!IsZero(family->min_time_)) {
+ instance.name += StringPrintF("/min_time:%0.3f", family->min_time_);
+ }
+ if (family->use_real_time_) {
+ instance.name += "/real_time";
+ }
+
+ // Add the number of threads used to the name
+ if (!family->thread_counts_.empty()) {
+ instance.name += StringPrintF("/threads:%d", instance.threads);
+ }
+
+ if (re.Match(instance.name)) {
+ benchmarks->push_back(instance);
+ }
+ }
+ }
+ }
+ return true;
+}
+
+BenchmarkImp::BenchmarkImp(const char* name)
+ : name_(name), arg_count_(-1),
+ min_time_(0.0), use_real_time_(false) {
+}
+
+BenchmarkImp::~BenchmarkImp() {
+}
+
+void BenchmarkImp::Arg(int x) {
+ CHECK(arg_count_ == -1 || arg_count_ == 1);
+ arg_count_ = 1;
+ args_.emplace_back(x, -1);
+}
+
+void BenchmarkImp::Range(int start, int limit) {
+ CHECK(arg_count_ == -1 || arg_count_ == 1);
+ arg_count_ = 1;
+ std::vector<int> arglist;
+ AddRange(&arglist, start, limit, kRangeMultiplier);
+
+ for (int i : arglist) {
+ args_.emplace_back(i, -1);
+ }
+}
+
+void BenchmarkImp::DenseRange(int start, int limit) {
+ CHECK(arg_count_ == -1 || arg_count_ == 1);
+ arg_count_ = 1;
+ CHECK_GE(start, 0);
+ CHECK_LE(start, limit);
+ for (int arg = start; arg <= limit; arg++) {
+ args_.emplace_back(arg, -1);
+ }
+}
+
+void BenchmarkImp::ArgPair(int x, int y) {
+ CHECK(arg_count_ == -1 || arg_count_ == 2);
+ arg_count_ = 2;
+ args_.emplace_back(x, y);
+}
+
+void BenchmarkImp::RangePair(int lo1, int hi1, int lo2, int hi2) {
+ CHECK(arg_count_ == -1 || arg_count_ == 2);
+ arg_count_ = 2;
+ std::vector<int> arglist1, arglist2;
+ AddRange(&arglist1, lo1, hi1, kRangeMultiplier);
+ AddRange(&arglist2, lo2, hi2, kRangeMultiplier);
+
+ for (int i : arglist1) {
+ for (int j : arglist2) {
+ args_.emplace_back(i, j);
+ }
+ }
+}
+
+void BenchmarkImp::MinTime(double t) {
+ CHECK(t > 0.0);
+ min_time_ = t;
+}
+
+void BenchmarkImp::UseRealTime() {
+ use_real_time_ = true;
+}
+
+void BenchmarkImp::Threads(int t) {
+ CHECK_GT(t, 0);
+ thread_counts_.push_back(t);
+}
+
+void BenchmarkImp::ThreadRange(int min_threads, int max_threads) {
+ CHECK_GT(min_threads, 0);
+ CHECK_GE(max_threads, min_threads);
+
+ AddRange(&thread_counts_, min_threads, max_threads, 2);
+}
+
+void BenchmarkImp::ThreadPerCpu() {
+ static int num_cpus = NumCPUs();
+ thread_counts_.push_back(num_cpus);
+}
+
+void BenchmarkImp::SetName(const char* name) {
+ name_ = name;
+}
+
+void BenchmarkImp::AddRange(std::vector<int>* dst, int lo, int hi, int mult) {
+ CHECK_GE(lo, 0);
+ CHECK_GE(hi, lo);
+
+ // Add "lo"
+ dst->push_back(lo);
+
+ static const int kint32max = std::numeric_limits<int32_t>::max();
+
+ // Now space out the benchmarks in multiples of "mult"
+ for (int32_t i = 1; i < kint32max/mult; i *= mult) {
+ if (i >= hi) break;
+ if (i > lo) {
+ dst->push_back(i);
+ }
+ }
+ // Add "hi" (if different from "lo")
+ if (hi != lo) {
+ dst->push_back(hi);
+ }
+}
+
+Benchmark::Benchmark(const char* name)
+ : imp_(new BenchmarkImp(name))
+{
+}
+
+Benchmark::~Benchmark() {
+ delete imp_;
+}
+
+Benchmark::Benchmark(Benchmark const& other)
+ : imp_(new BenchmarkImp(*other.imp_))
+{
+}
+
+Benchmark* Benchmark::Arg(int x) {
+ imp_->Arg(x);
+ return this;
+}
+
+Benchmark* Benchmark::Range(int start, int limit) {
+ imp_->Range(start, limit);
+ return this;
+}
+
+Benchmark* Benchmark::DenseRange(int start, int limit) {
+ imp_->DenseRange(start, limit);
+ return this;
+}
+
+Benchmark* Benchmark::ArgPair(int x, int y) {
+ imp_->ArgPair(x, y);
+ return this;
+}
+
+Benchmark* Benchmark::RangePair(int lo1, int hi1, int lo2, int hi2) {
+ imp_->RangePair(lo1, hi1, lo2, hi2);
+ return this;
+}
+
+Benchmark* Benchmark::Apply(void (*custom_arguments)(Benchmark* benchmark)) {
+ custom_arguments(this);
+ return this;
+}
+
+Benchmark* Benchmark::MinTime(double t) {
+ imp_->MinTime(t);
+ return this;
+}
+
+Benchmark* Benchmark::UseRealTime() {
+ imp_->UseRealTime();
+ return this;
+}
+
+Benchmark* Benchmark::Threads(int t) {
+ imp_->Threads(t);
+ return this;
+}
+
+Benchmark* Benchmark::ThreadRange(int min_threads, int max_threads) {
+ imp_->ThreadRange(min_threads, max_threads);
+ return this;
+}
+
+Benchmark* Benchmark::ThreadPerCpu() {
+ imp_->ThreadPerCpu();
+ return this;
+}
+
+void Benchmark::SetName(const char* name) {
+ imp_->SetName(name);
+}
+
+void FunctionBenchmark::Run(State& st) {
+ func_(st);
+}
+
+} // end namespace internal
+
+namespace {
+
+
+// Execute one thread of benchmark b for the specified number of iterations.
+// Adds the stats collected for the thread into *total.
+void RunInThread(const benchmark::internal::Benchmark::Instance* b,
+ size_t iters, int thread_id,
+ ThreadStats* total) EXCLUDES(GetBenchmarkLock()) {
+ State st(iters, b->has_arg1, b->arg1, b->has_arg2, b->arg2, thread_id);
+ b->benchmark->Run(st);
+ CHECK(st.iterations() == st.max_iterations) <<
+ "Benchmark returned before State::KeepRunning() returned false!";
+ {
+ MutexLock l(GetBenchmarkLock());
+ total->bytes_processed += st.bytes_processed();
+ total->items_processed += st.items_processed();
+ }
+
+ timer_manager->Finalize();
+}
+
+void RunBenchmark(const benchmark::internal::Benchmark::Instance& b,
+ BenchmarkReporter* br) EXCLUDES(GetBenchmarkLock()) {
+ size_t iters = 1;
+
+ std::vector<BenchmarkReporter::Run> reports;
+
+ std::vector<std::thread> pool;
+ if (b.multithreaded)
+ pool.resize(b.threads);
+
+ for (int i = 0; i < FLAGS_benchmark_repetitions; i++) {
+ std::string mem;
+ for (;;) {
+ // Try benchmark
+ VLOG(2) << "Running " << b.name << " for " << iters << "\n";
+
+ {
+ MutexLock l(GetBenchmarkLock());
+ GetReportLabel()->clear();
+ }
+
+ Notification done;
+ timer_manager = std::unique_ptr<TimerManager>(new TimerManager(b.threads, &done));
+
+ ThreadStats total;
+ running_benchmark = true;
+ if (b.multithreaded) {
+ // If this is out first iteration of the while(true) loop then the
+ // threads haven't been started and can't be joined. Otherwise we need
+ // to join the thread before replacing them.
+ for (std::thread& thread : pool) {
+ if (thread.joinable())
+ thread.join();
+ }
+ for (std::size_t ti = 0; ti < pool.size(); ++ti) {
+ pool[ti] = std::thread(&RunInThread, &b, iters, ti, &total);
+ }
+ } else {
+ // Run directly in this thread
+ RunInThread(&b, iters, 0, &total);
+ }
+ done.WaitForNotification();
+ running_benchmark = false;
+
+ const double cpu_accumulated_time = timer_manager->cpu_time_used();
+ const double real_accumulated_time = timer_manager->real_time_used();
+ timer_manager.reset();
+
+ VLOG(2) << "Ran in " << cpu_accumulated_time << "/"
+ << real_accumulated_time << "\n";
+
+ // Base decisions off of real time if requested by this benchmark.
+ double seconds = cpu_accumulated_time;
+ if (b.use_real_time) {
+ seconds = real_accumulated_time;
+ }
+
+ std::string label;
+ {
+ MutexLock l(GetBenchmarkLock());
+ label = *GetReportLabel();
+ }
+
+ const double min_time = !IsZero(b.min_time) ? b.min_time
+ : FLAGS_benchmark_min_time;
+
+ // If this was the first run, was elapsed time or cpu time large enough?
+ // If this is not the first run, go with the current value of iter.
+ if ((i > 0) ||
+ (iters >= kMaxIterations) ||
+ (seconds >= min_time) ||
+ (real_accumulated_time >= 5*min_time)) {
+ double bytes_per_second = 0;
+ if (total.bytes_processed > 0 && seconds > 0.0) {
+ bytes_per_second = (total.bytes_processed / seconds);
+ }
+ double items_per_second = 0;
+ if (total.items_processed > 0 && seconds > 0.0) {
+ items_per_second = (total.items_processed / seconds);
+ }
+
+ // Create report about this benchmark run.
+ BenchmarkReporter::Run report;
+ report.benchmark_name = b.name;
+ report.report_label = label;
+ // Report the total iterations across all threads.
+ report.iterations = static_cast<int64_t>(iters) * b.threads;
+ report.real_accumulated_time = real_accumulated_time;
+ report.cpu_accumulated_time = cpu_accumulated_time;
+ report.bytes_per_second = bytes_per_second;
+ report.items_per_second = items_per_second;
+ reports.push_back(report);
+ break;
+ }
+
+ // See how much iterations should be increased by
+ // Note: Avoid division by zero with max(seconds, 1ns).
+ double multiplier = min_time * 1.4 / std::max(seconds, 1e-9);
+ // If our last run was at least 10% of FLAGS_benchmark_min_time then we
+ // use the multiplier directly. Otherwise we use at most 10 times
+ // expansion.
+ // NOTE: When the last run was at least 10% of the min time the max
+ // expansion should be 14x.
+ bool is_significant = (seconds / min_time) > 0.1;
+ multiplier = is_significant ? multiplier : std::min(10.0, multiplier);
+ if (multiplier <= 1.0) multiplier = 2.0;
+ double next_iters = std::max(multiplier * iters, iters + 1.0);
+ if (next_iters > kMaxIterations) {
+ next_iters = kMaxIterations;
+ }
+ VLOG(3) << "Next iters: " << next_iters << ", " << multiplier << "\n";
+ iters = static_cast<int>(next_iters + 0.5);
+ }
+ }
+ br->ReportRuns(reports);
+ if (b.multithreaded) {
+ for (std::thread& thread : pool)
+ thread.join();
+ }
+}
+
+} // namespace
+
+State::State(size_t max_iters, bool has_x, int x, bool has_y, int y,
+ int thread_i)
+ : started_(false), total_iterations_(0),
+ has_range_x_(has_x), range_x_(x),
+ has_range_y_(has_y), range_y_(y),
+ bytes_processed_(0), items_processed_(0),
+ thread_index(thread_i),
+ max_iterations(max_iters)
+{
+ CHECK(max_iterations != 0) << "At least one iteration must be run";
+}
+
+void State::PauseTiming() {
+ // Add in time accumulated so far
+ CHECK(running_benchmark);
+ timer_manager->StopTimer();
+}
+
+void State::ResumeTiming() {
+ CHECK(running_benchmark);
+ timer_manager->StartTimer();
+}
+
+void State::SetLabel(const char* label) {
+ CHECK(running_benchmark);
+ MutexLock l(GetBenchmarkLock());
+ *GetReportLabel() = label;
+}
+
+namespace internal {
+namespace {
+
+void PrintBenchmarkList() {
+ std::vector<Benchmark::Instance> benchmarks;
+ auto families = BenchmarkFamilies::GetInstance();
+ if (!families->FindBenchmarks(".", &benchmarks)) return;
+
+ for (const internal::Benchmark::Instance& benchmark : benchmarks) {
+ std::cout << benchmark.name << "\n";
+ }
+}
+
+void RunMatchingBenchmarks(const std::string& spec,
+ BenchmarkReporter* reporter) {
+ CHECK(reporter != nullptr);
+ if (spec.empty()) return;
+
+ std::vector<Benchmark::Instance> benchmarks;
+ auto families = BenchmarkFamilies::GetInstance();
+ if (!families->FindBenchmarks(spec, &benchmarks)) return;
+
+ // Determine the width of the name field using a minimum width of 10.
+ size_t name_field_width = 10;
+ for (const Benchmark::Instance& benchmark : benchmarks) {
+ name_field_width =
+ std::max<size_t>(name_field_width, benchmark.name.size());
+ }
+ if (FLAGS_benchmark_repetitions > 1)
+ name_field_width += std::strlen("_stddev");
+
+ // Print header here
+ BenchmarkReporter::Context context;
+ context.num_cpus = NumCPUs();
+ context.mhz_per_cpu = CyclesPerSecond() / 1000000.0f;
+
+ context.cpu_scaling_enabled = CpuScalingEnabled();
+ context.name_field_width = name_field_width;
+
+ if (reporter->ReportContext(context)) {
+ for (const auto& benchmark : benchmarks) {
+ RunBenchmark(benchmark, reporter);
+ }
+ }
+}
+
+std::unique_ptr<BenchmarkReporter> GetDefaultReporter() {
+ typedef std::unique_ptr<BenchmarkReporter> PtrType;
+ if (FLAGS_benchmark_format == "tabular") {
+ return PtrType(new ConsoleReporter);
+ } else if (FLAGS_benchmark_format == "json") {
+ return PtrType(new JSONReporter);
+ } else if (FLAGS_benchmark_format == "csv") {
+ return PtrType(new CSVReporter);
+ } else {
+ std::cerr << "Unexpected format: '" << FLAGS_benchmark_format << "'\n";
+ std::exit(1);
+ }
+}
+
+} // end namespace
+} // end namespace internal
+
+void RunSpecifiedBenchmarks() {
+ RunSpecifiedBenchmarks(nullptr);
+}
+
+void RunSpecifiedBenchmarks(BenchmarkReporter* reporter) {
+ if (FLAGS_benchmark_list_tests) {
+ internal::PrintBenchmarkList();
+ return;
+ }
+ std::string spec = FLAGS_benchmark_filter;
+ if (spec.empty() || spec == "all")
+ spec = "."; // Regexp that matches all benchmarks
+
+ std::unique_ptr<BenchmarkReporter> default_reporter;
+ if (!reporter) {
+ default_reporter = internal::GetDefaultReporter();
+ reporter = default_reporter.get();
+ }
+ internal::RunMatchingBenchmarks(spec, reporter);
+ reporter->Finalize();
+}
+
+namespace internal {
+
+void PrintUsageAndExit() {
+ fprintf(stdout,
+ "benchmark"
+ " [--benchmark_list_tests={true|false}]\n"
+ " [--benchmark_filter=<regex>]\n"
+ " [--benchmark_min_time=<min_time>]\n"
+ " [--benchmark_repetitions=<num_repetitions>]\n"
+ " [--benchmark_format=<tabular|json|csv>]\n"
+ " [--color_print={true|false}]\n"
+ " [--v=<verbosity>]\n");
+ exit(0);
+}
+
+void ParseCommandLineFlags(int* argc, char** argv) {
+ using namespace benchmark;
+ for (int i = 1; i < *argc; ++i) {
+ if (
+ ParseBoolFlag(argv[i], "benchmark_list_tests",
+ &FLAGS_benchmark_list_tests) ||
+ ParseStringFlag(argv[i], "benchmark_filter",
+ &FLAGS_benchmark_filter) ||
+ ParseDoubleFlag(argv[i], "benchmark_min_time",
+ &FLAGS_benchmark_min_time) ||
+ ParseInt32Flag(argv[i], "benchmark_repetitions",
+ &FLAGS_benchmark_repetitions) ||
+ ParseStringFlag(argv[i], "benchmark_format",
+ &FLAGS_benchmark_format) ||
+ ParseBoolFlag(argv[i], "color_print",
+ &FLAGS_color_print) ||
+ ParseInt32Flag(argv[i], "v", &FLAGS_v)) {
+ for (int j = i; j != *argc; ++j) argv[j] = argv[j + 1];
+
+ --(*argc);
+ --i;
+ } else if (IsFlag(argv[i], "help")) {
+ PrintUsageAndExit();
+ }
+ }
+ if (FLAGS_benchmark_format != "tabular" &&
+ FLAGS_benchmark_format != "json" &&
+ FLAGS_benchmark_format != "csv") {
+ PrintUsageAndExit();
+ }
+}
+
+Benchmark* RegisterBenchmarkInternal(Benchmark* bench) {
+ std::unique_ptr<Benchmark> bench_ptr(bench);
+ BenchmarkFamilies* families = BenchmarkFamilies::GetInstance();
+ families->AddBenchmark(std::move(bench_ptr));
+ return bench;
+}
+
+} // end namespace internal
+
+void Initialize(int* argc, char** argv) {
+ internal::ParseCommandLineFlags(argc, argv);
+ internal::SetLogLevel(FLAGS_v);
+ // TODO remove this. It prints some output the first time it is called.
+ // We don't want to have this ouput printed during benchmarking.
+ MyCPUUsage();
+ // The first call to walltime::Now initialized it. Call it once to
+ // prevent the initialization from happening in a benchmark.
+ walltime::Now();
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/check.h b/3rdparty/benchmark/src/check.h
new file mode 100644
index 00000000000..12933f347fa
--- /dev/null
+++ b/3rdparty/benchmark/src/check.h
@@ -0,0 +1,60 @@
+#ifndef CHECK_H_
+#define CHECK_H_
+
+#include <cstdlib>
+#include <ostream>
+
+#include "internal_macros.h"
+#include "log.h"
+
+namespace benchmark {
+namespace internal {
+
+// CheckHandler is the class constructed by failing CHECK macros. CheckHandler
+// will log information about the failures and abort when it is destructed.
+class CheckHandler {
+public:
+ CheckHandler(const char* check, const char* file, const char* func, int line)
+ : log_(GetErrorLogInstance())
+ {
+ log_ << file << ":" << line << ": " << func << ": Check `"
+ << check << "' failed. ";
+ }
+
+ std::ostream& GetLog() {
+ return log_;
+ }
+
+ BENCHMARK_NORETURN ~CheckHandler() {
+ log_ << std::endl;
+ std::abort();
+ }
+
+ CheckHandler & operator=(const CheckHandler&) = delete;
+ CheckHandler(const CheckHandler&) = delete;
+ CheckHandler() = delete;
+private:
+ std::ostream& log_;
+};
+
+} // end namespace internal
+} // end namespace benchmark
+
+// The CHECK macro returns a std::ostream object that can have extra information
+// written to it.
+#ifndef NDEBUG
+# define CHECK(b) (b ? ::benchmark::internal::GetNullLogInstance() \
+ : ::benchmark::internal::CheckHandler( \
+ #b, __FILE__, __func__, __LINE__).GetLog())
+#else
+# define CHECK(b) ::benchmark::internal::GetNullLogInstance()
+#endif
+
+#define CHECK_EQ(a, b) CHECK((a) == (b))
+#define CHECK_NE(a, b) CHECK((a) != (b))
+#define CHECK_GE(a, b) CHECK((a) >= (b))
+#define CHECK_LE(a, b) CHECK((a) <= (b))
+#define CHECK_GT(a, b) CHECK((a) > (b))
+#define CHECK_LT(a, b) CHECK((a) < (b))
+
+#endif // CHECK_H_
diff --git a/3rdparty/benchmark/src/colorprint.cc b/3rdparty/benchmark/src/colorprint.cc
new file mode 100644
index 00000000000..81f917b2676
--- /dev/null
+++ b/3rdparty/benchmark/src/colorprint.cc
@@ -0,0 +1,116 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "colorprint.h"
+
+#include <cstdarg>
+#include <cstdio>
+
+#include "commandlineflags.h"
+#include "internal_macros.h"
+
+#ifdef BENCHMARK_OS_WINDOWS
+#include <Windows.h>
+#endif
+
+DECLARE_bool(color_print);
+
+namespace benchmark {
+namespace {
+#ifdef BENCHMARK_OS_WINDOWS
+typedef WORD PlatformColorCode;
+#else
+typedef const char* PlatformColorCode;
+#endif
+
+PlatformColorCode GetPlatformColorCode(LogColor color) {
+#ifdef BENCHMARK_OS_WINDOWS
+ switch (color) {
+ case COLOR_RED:
+ return FOREGROUND_RED;
+ case COLOR_GREEN:
+ return FOREGROUND_GREEN;
+ case COLOR_YELLOW:
+ return FOREGROUND_RED | FOREGROUND_GREEN;
+ case COLOR_BLUE:
+ return FOREGROUND_BLUE;
+ case COLOR_MAGENTA:
+ return FOREGROUND_BLUE | FOREGROUND_RED;
+ case COLOR_CYAN:
+ return FOREGROUND_BLUE | FOREGROUND_GREEN;
+ case COLOR_WHITE: // fall through to default
+ default:
+ return 0;
+ }
+#else
+ switch (color) {
+ case COLOR_RED:
+ return "1";
+ case COLOR_GREEN:
+ return "2";
+ case COLOR_YELLOW:
+ return "3";
+ case COLOR_BLUE:
+ return "4";
+ case COLOR_MAGENTA:
+ return "5";
+ case COLOR_CYAN:
+ return "6";
+ case COLOR_WHITE:
+ return "7";
+ default:
+ return nullptr;
+ };
+#endif
+}
+} // end namespace
+
+void ColorPrintf(LogColor color, const char* fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+
+ if (!FLAGS_color_print) {
+ vprintf(fmt, args);
+ va_end(args);
+ return;
+ }
+
+#ifdef BENCHMARK_OS_WINDOWS
+ const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+
+ // Gets the current text color.
+ CONSOLE_SCREEN_BUFFER_INFO buffer_info;
+ GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
+ const WORD old_color_attrs = buffer_info.wAttributes;
+
+ // We need to flush the stream buffers into the console before each
+ // SetConsoleTextAttribute call lest it affect the text that is already
+ // printed but has not yet reached the console.
+ fflush(stdout);
+ SetConsoleTextAttribute(stdout_handle,
+ GetPlatformColorCode(color) | FOREGROUND_INTENSITY);
+ vprintf(fmt, args);
+
+ fflush(stdout);
+ // Restores the text color.
+ SetConsoleTextAttribute(stdout_handle, old_color_attrs);
+#else
+ const char* color_code = GetPlatformColorCode(color);
+ if (color_code) fprintf(stdout, "\033[0;3%sm", color_code);
+ vprintf(fmt, args);
+ printf("\033[m"); // Resets the terminal to default.
+#endif
+ va_end(args);
+}
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/colorprint.h b/3rdparty/benchmark/src/colorprint.h
new file mode 100644
index 00000000000..54d1f664b3b
--- /dev/null
+++ b/3rdparty/benchmark/src/colorprint.h
@@ -0,0 +1,19 @@
+#ifndef BENCHMARK_COLORPRINT_H_
+#define BENCHMARK_COLORPRINT_H_
+
+namespace benchmark {
+enum LogColor {
+ COLOR_DEFAULT,
+ COLOR_RED,
+ COLOR_GREEN,
+ COLOR_YELLOW,
+ COLOR_BLUE,
+ COLOR_MAGENTA,
+ COLOR_CYAN,
+ COLOR_WHITE
+};
+
+void ColorPrintf(LogColor color, const char* fmt, ...);
+} // end namespace benchmark
+
+#endif // BENCHMARK_COLORPRINT_H_
diff --git a/3rdparty/benchmark/src/commandlineflags.cc b/3rdparty/benchmark/src/commandlineflags.cc
new file mode 100644
index 00000000000..3e9a37a71d6
--- /dev/null
+++ b/3rdparty/benchmark/src/commandlineflags.cc
@@ -0,0 +1,220 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "commandlineflags.h"
+
+#include <cstdlib>
+#include <cstring>
+#include <iostream>
+#include <limits>
+
+namespace benchmark {
+// Parses 'str' for a 32-bit signed integer. If successful, writes
+// the result to *value and returns true; otherwise leaves *value
+// unchanged and returns false.
+bool ParseInt32(const std::string& src_text, const char* str, int32_t* value) {
+ // Parses the environment variable as a decimal integer.
+ char* end = nullptr;
+ const long long_value = strtol(str, &end, 10); // NOLINT
+
+ // Has strtol() consumed all characters in the string?
+ if (*end != '\0') {
+ // No - an invalid character was encountered.
+ std::cerr << src_text << " is expected to be a 32-bit integer, "
+ << "but actually has value \"" << str << "\".\n";
+ return false;
+ }
+
+ // Is the parsed value in the range of an Int32?
+ const int32_t result = static_cast<int32_t>(long_value);
+ if (long_value == std::numeric_limits<long>::max() ||
+ long_value == std::numeric_limits<long>::min() ||
+ // The parsed value overflows as a long. (strtol() returns
+ // LONG_MAX or LONG_MIN when the input overflows.)
+ result != long_value
+ // The parsed value overflows as an Int32.
+ ) {
+ std::cerr << src_text << " is expected to be a 32-bit integer, "
+ << "but actually has value \"" << str << "\", "
+ << "which overflows.\n";
+ return false;
+ }
+
+ *value = result;
+ return true;
+}
+
+// Parses 'str' for a double. If successful, writes the result to *value and
+// returns true; otherwise leaves *value unchanged and returns false.
+bool ParseDouble(const std::string& src_text, const char* str, double* value) {
+ // Parses the environment variable as a decimal integer.
+ char* end = nullptr;
+ const double double_value = strtod(str, &end); // NOLINT
+
+ // Has strtol() consumed all characters in the string?
+ if (*end != '\0') {
+ // No - an invalid character was encountered.
+ std::cerr << src_text << " is expected to be a double, "
+ << "but actually has value \"" << str << "\".\n";
+ return false;
+ }
+
+ *value = double_value;
+ return true;
+}
+
+inline const char* GetEnv(const char* name) {
+#if defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
+ // Environment variables which we programmatically clear will be set to the
+ // empty string rather than unset (nullptr). Handle that case.
+ const char* const env = getenv(name);
+ return (env != nullptr && env[0] != '\0') ? env : nullptr;
+#else
+ return getenv(name);
+#endif
+}
+
+// Returns the name of the environment variable corresponding to the
+// given flag. For example, FlagToEnvVar("foo") will return
+// "BENCHMARK_FOO" in the open-source version.
+static std::string FlagToEnvVar(const char* flag) {
+ const std::string flag_str(flag);
+
+ std::string env_var;
+ for (size_t i = 0; i != flag_str.length(); ++i)
+ env_var += static_cast<char>(::toupper(flag_str.c_str()[i]));
+
+ return "BENCHMARK_" + env_var;
+}
+
+// Reads and returns the Boolean environment variable corresponding to
+// the given flag; if it's not set, returns default_value.
+//
+// The value is considered true iff it's not "0".
+bool BoolFromEnv(const char* flag, bool default_value) {
+ const std::string env_var = FlagToEnvVar(flag);
+ const char* const string_value = GetEnv(env_var.c_str());
+ return string_value == nullptr ? default_value : strcmp(string_value, "0") != 0;
+}
+
+// Reads and returns a 32-bit integer stored in the environment
+// variable corresponding to the given flag; if it isn't set or
+// doesn't represent a valid 32-bit integer, returns default_value.
+int32_t Int32FromEnv(const char* flag, int32_t default_value) {
+ const std::string env_var = FlagToEnvVar(flag);
+ const char* const string_value = GetEnv(env_var.c_str());
+ if (string_value == nullptr) {
+ // The environment variable is not set.
+ return default_value;
+ }
+
+ int32_t result = default_value;
+ if (!ParseInt32(std::string("Environment variable ") + env_var, string_value,
+ &result)) {
+ std::cout << "The default value " << default_value << " is used.\n";
+ return default_value;
+ }
+
+ return result;
+}
+
+// Reads and returns the string environment variable corresponding to
+// the given flag; if it's not set, returns default_value.
+const char* StringFromEnv(const char* flag, const char* default_value) {
+ const std::string env_var = FlagToEnvVar(flag);
+ const char* const value = GetEnv(env_var.c_str());
+ return value == nullptr ? default_value : value;
+}
+
+// Parses a string as a command line flag. The string should have
+// the format "--flag=value". When def_optional is true, the "=value"
+// part can be omitted.
+//
+// Returns the value of the flag, or nullptr if the parsing failed.
+const char* ParseFlagValue(const char* str, const char* flag,
+ bool def_optional) {
+ // str and flag must not be nullptr.
+ if (str == nullptr || flag == nullptr) return nullptr;
+
+ // The flag must start with "--".
+ const std::string flag_str = std::string("--") + std::string(flag);
+ const size_t flag_len = flag_str.length();
+ if (strncmp(str, flag_str.c_str(), flag_len) != 0) return nullptr;
+
+ // Skips the flag name.
+ const char* flag_end = str + flag_len;
+
+ // When def_optional is true, it's OK to not have a "=value" part.
+ if (def_optional && (flag_end[0] == '\0')) return flag_end;
+
+ // If def_optional is true and there are more characters after the
+ // flag name, or if def_optional is false, there must be a '=' after
+ // the flag name.
+ if (flag_end[0] != '=') return nullptr;
+
+ // Returns the string after "=".
+ return flag_end + 1;
+}
+
+bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
+ // Gets the value of the flag as a string.
+ const char* const value_str = ParseFlagValue(str, flag, true);
+
+ // Aborts if the parsing failed.
+ if (value_str == nullptr) return false;
+
+ // Converts the string value to a bool.
+ *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');
+ return true;
+}
+
+bool ParseInt32Flag(const char* str, const char* flag, int32_t* value) {
+ // Gets the value of the flag as a string.
+ const char* const value_str = ParseFlagValue(str, flag, false);
+
+ // Aborts if the parsing failed.
+ if (value_str == nullptr) return false;
+
+ // Sets *value to the value of the flag.
+ return ParseInt32(std::string("The value of flag --") + flag, value_str,
+ value);
+}
+
+bool ParseDoubleFlag(const char* str, const char* flag, double* value) {
+ // Gets the value of the flag as a string.
+ const char* const value_str = ParseFlagValue(str, flag, false);
+
+ // Aborts if the parsing failed.
+ if (value_str == nullptr) return false;
+
+ // Sets *value to the value of the flag.
+ return ParseDouble(std::string("The value of flag --") + flag, value_str,
+ value);
+}
+
+bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
+ // Gets the value of the flag as a string.
+ const char* const value_str = ParseFlagValue(str, flag, false);
+
+ // Aborts if the parsing failed.
+ if (value_str == nullptr) return false;
+
+ *value = value_str;
+ return true;
+}
+
+bool IsFlag(const char* str, const char* flag) {
+ return (ParseFlagValue(str, flag, true) != nullptr);
+}
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/commandlineflags.h b/3rdparty/benchmark/src/commandlineflags.h
new file mode 100644
index 00000000000..34b9c6f30e9
--- /dev/null
+++ b/3rdparty/benchmark/src/commandlineflags.h
@@ -0,0 +1,76 @@
+#ifndef BENCHMARK_COMMANDLINEFLAGS_H_
+#define BENCHMARK_COMMANDLINEFLAGS_H_
+
+#include <cstdint>
+#include <string>
+
+// Macro for referencing flags.
+#define FLAG(name) FLAGS_##name
+
+// Macros for declaring flags.
+#define DECLARE_bool(name) extern bool FLAG(name)
+#define DECLARE_int32(name) extern int32_t FLAG(name)
+#define DECLARE_int64(name) extern int64_t FLAG(name)
+#define DECLARE_double(name) extern double FLAG(name)
+#define DECLARE_string(name) extern std::string FLAG(name)
+
+// Macros for defining flags.
+#define DEFINE_bool(name, default_val, doc) bool FLAG(name) = (default_val)
+#define DEFINE_int32(name, default_val, doc) int32_t FLAG(name) = (default_val)
+#define DEFINE_int64(name, default_val, doc) int64_t FLAG(name) = (default_val)
+#define DEFINE_double(name, default_val, doc) double FLAG(name) = (default_val)
+#define DEFINE_string(name, default_val, doc) \
+ std::string FLAG(name) = (default_val)
+
+namespace benchmark {
+// Parses 'str' for a 32-bit signed integer. If successful, writes the result
+// to *value and returns true; otherwise leaves *value unchanged and returns
+// false.
+bool ParseInt32(const std::string& src_text, const char* str, int32_t* value);
+
+// Parses a bool/Int32/string from the environment variable
+// corresponding to the given Google Test flag.
+bool BoolFromEnv(const char* flag, bool default_val);
+int32_t Int32FromEnv(const char* flag, int32_t default_val);
+double DoubleFromEnv(const char* flag, double default_val);
+const char* StringFromEnv(const char* flag, const char* default_val);
+
+// Parses a string for a bool flag, in the form of either
+// "--flag=value" or "--flag".
+//
+// In the former case, the value is taken as true as long as it does
+// not start with '0', 'f', or 'F'.
+//
+// In the latter case, the value is taken as true.
+//
+// On success, stores the value of the flag in *value, and returns
+// true. On failure, returns false without changing *value.
+bool ParseBoolFlag(const char* str, const char* flag, bool* value);
+
+// Parses a string for an Int32 flag, in the form of
+// "--flag=value".
+//
+// On success, stores the value of the flag in *value, and returns
+// true. On failure, returns false without changing *value.
+bool ParseInt32Flag(const char* str, const char* flag, int32_t* value);
+
+// Parses a string for a Double flag, in the form of
+// "--flag=value".
+//
+// On success, stores the value of the flag in *value, and returns
+// true. On failure, returns false without changing *value.
+bool ParseDoubleFlag(const char* str, const char* flag, double* value);
+
+// Parses a string for a string flag, in the form of
+// "--flag=value".
+//
+// On success, stores the value of the flag in *value, and returns
+// true. On failure, returns false without changing *value.
+bool ParseStringFlag(const char* str, const char* flag, std::string* value);
+
+// Returns true if the string matches the flag.
+bool IsFlag(const char* str, const char* flag);
+
+} // end namespace benchmark
+
+#endif // BENCHMARK_COMMANDLINEFLAGS_H_
diff --git a/3rdparty/benchmark/src/console_reporter.cc b/3rdparty/benchmark/src/console_reporter.cc
new file mode 100644
index 00000000000..bee3c8576c0
--- /dev/null
+++ b/3rdparty/benchmark/src/console_reporter.cc
@@ -0,0 +1,116 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "benchmark/reporter.h"
+
+#include <cstdint>
+#include <cstdio>
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include "check.h"
+#include "colorprint.h"
+#include "string_util.h"
+#include "walltime.h"
+
+namespace benchmark {
+
+bool ConsoleReporter::ReportContext(const Context& context) {
+ name_field_width_ = context.name_field_width;
+
+ std::cerr << "Run on (" << context.num_cpus << " X " << context.mhz_per_cpu
+ << " MHz CPU " << ((context.num_cpus > 1) ? "s" : "") << ")\n";
+
+ std::cerr << LocalDateTimeString() << "\n";
+
+ if (context.cpu_scaling_enabled) {
+ std::cerr << "***WARNING*** CPU scaling is enabled, the benchmark "
+ "real time measurements may be noisy and will incure extra "
+ "overhead.\n";
+ }
+
+#ifndef NDEBUG
+ std::cerr << "***WARNING*** Library was built as DEBUG. Timings may be "
+ "affected.\n";
+#endif
+
+ int output_width = fprintf(stdout, "%-*s %10s %10s %10s\n",
+ static_cast<int>(name_field_width_), "Benchmark",
+ "Time(ns)", "CPU(ns)", "Iterations");
+ std::cout << std::string(output_width - 1, '-') << "\n";
+
+ return true;
+}
+
+void ConsoleReporter::ReportRuns(const std::vector<Run>& reports) {
+ if (reports.empty()) {
+ return;
+ }
+
+ for (Run const& run : reports) {
+ CHECK_EQ(reports[0].benchmark_name, run.benchmark_name);
+ PrintRunData(run);
+ }
+
+ if (reports.size() < 2) {
+ // We don't report aggregated data if there was a single run.
+ return;
+ }
+
+ Run mean_data;
+ Run stddev_data;
+ BenchmarkReporter::ComputeStats(reports, &mean_data, &stddev_data);
+
+ // Output using PrintRun.
+ PrintRunData(mean_data);
+ PrintRunData(stddev_data);
+}
+
+void ConsoleReporter::PrintRunData(const Run& result) {
+ // Format bytes per second
+ std::string rate;
+ if (result.bytes_per_second > 0) {
+ rate = StrCat(" ", HumanReadableNumber(result.bytes_per_second), "B/s");
+ }
+
+ // Format items per second
+ std::string items;
+ if (result.items_per_second > 0) {
+ items = StrCat(" ", HumanReadableNumber(result.items_per_second),
+ " items/s");
+ }
+
+ double const multiplier = 1e9; // nano second multiplier
+ ColorPrintf(COLOR_GREEN, "%-*s ",
+ name_field_width_, result.benchmark_name.c_str());
+ if (result.iterations == 0) {
+ ColorPrintf(COLOR_YELLOW, "%10.0f %10.0f ",
+ result.real_accumulated_time * multiplier,
+ result.cpu_accumulated_time * multiplier);
+ } else {
+ ColorPrintf(COLOR_YELLOW, "%10.0f %10.0f ",
+ (result.real_accumulated_time * multiplier) /
+ (static_cast<double>(result.iterations)),
+ (result.cpu_accumulated_time * multiplier) /
+ (static_cast<double>(result.iterations)));
+ }
+ ColorPrintf(COLOR_CYAN, "%10lld", result.iterations);
+ ColorPrintf(COLOR_DEFAULT, "%*s %*s %s\n",
+ 13, rate.c_str(),
+ 18, items.c_str(),
+ result.report_label.c_str());
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/csv_reporter.cc b/3rdparty/benchmark/src/csv_reporter.cc
new file mode 100644
index 00000000000..a83694338bd
--- /dev/null
+++ b/3rdparty/benchmark/src/csv_reporter.cc
@@ -0,0 +1,105 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "benchmark/reporter.h"
+
+#include <cstdint>
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include "string_util.h"
+#include "walltime.h"
+
+// File format reference: http://edoceo.com/utilitas/csv-file-format.
+
+namespace benchmark {
+
+bool CSVReporter::ReportContext(const Context& context) {
+ std::cerr << "Run on (" << context.num_cpus << " X " << context.mhz_per_cpu
+ << " MHz CPU " << ((context.num_cpus > 1) ? "s" : "") << ")\n";
+
+ std::cerr << LocalDateTimeString() << "\n";
+
+ if (context.cpu_scaling_enabled) {
+ std::cerr << "***WARNING*** CPU scaling is enabled, the benchmark "
+ "real time measurements may be noisy and will incure extra "
+ "overhead.\n";
+ }
+
+#ifndef NDEBUG
+ std::cerr << "***WARNING*** Library was built as DEBUG. Timings may be "
+ "affected.\n";
+#endif
+ std::cout << "name,iterations,real_time,cpu_time,bytes_per_second,"
+ "items_per_second,label\n";
+ return true;
+}
+
+void CSVReporter::ReportRuns(std::vector<Run> const& reports) {
+ if (reports.empty()) {
+ return;
+ }
+
+ std::vector<Run> reports_cp = reports;
+ if (reports.size() >= 2) {
+ Run mean_data;
+ Run stddev_data;
+ BenchmarkReporter::ComputeStats(reports, &mean_data, &stddev_data);
+ reports_cp.push_back(mean_data);
+ reports_cp.push_back(stddev_data);
+ }
+ for (auto it = reports_cp.begin(); it != reports_cp.end(); ++it) {
+ PrintRunData(*it);
+ }
+}
+
+void CSVReporter::PrintRunData(Run const& run) {
+ double const multiplier = 1e9; // nano second multiplier
+ double cpu_time = run.cpu_accumulated_time * multiplier;
+ double real_time = run.real_accumulated_time * multiplier;
+ if (run.iterations != 0) {
+ real_time = real_time / static_cast<double>(run.iterations);
+ cpu_time = cpu_time / static_cast<double>(run.iterations);
+ }
+
+ // Field with embedded double-quote characters must be doubled and the field
+ // delimited with double-quotes.
+ std::string name = run.benchmark_name;
+ ReplaceAll(&name, "\"", "\"\"");
+ std::cout << "\"" << name << "\",";
+
+ std::cout << run.iterations << ",";
+ std::cout << real_time << ",";
+ std::cout << cpu_time << ",";
+
+ if (run.bytes_per_second > 0.0) {
+ std::cout << run.bytes_per_second;
+ }
+ std::cout << ",";
+ if (run.items_per_second > 0.0) {
+ std::cout << run.items_per_second;
+ }
+ std::cout << ",";
+ if (!run.report_label.empty()) {
+ // Field with embedded double-quote characters must be doubled and the field
+ // delimited with double-quotes.
+ std::string label = run.report_label;
+ ReplaceAll(&label, "\"", "\"\"");
+ std::cout << "\"" << label << "\"";
+ }
+ std::cout << '\n';
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/cycleclock.h b/3rdparty/benchmark/src/cycleclock.h
new file mode 100644
index 00000000000..42541dafc88
--- /dev/null
+++ b/3rdparty/benchmark/src/cycleclock.h
@@ -0,0 +1,137 @@
+// ----------------------------------------------------------------------
+// CycleClock
+// A CycleClock tells you the current time in Cycles. The "time"
+// is actually time since power-on. This is like time() but doesn't
+// involve a system call and is much more precise.
+//
+// NOTE: Not all cpu/platform/kernel combinations guarantee that this
+// clock increments at a constant rate or is synchronized across all logical
+// cpus in a system.
+//
+// If you need the above guarantees, please consider using a different
+// API. There are efforts to provide an interface which provides a millisecond
+// granularity and implemented as a memory read. A memory read is generally
+// cheaper than the CycleClock for many architectures.
+//
+// Also, in some out of order CPU implementations, the CycleClock is not
+// serializing. So if you're trying to count at cycles granularity, your
+// data might be inaccurate due to out of order instruction execution.
+// ----------------------------------------------------------------------
+
+#ifndef BENCHMARK_CYCLECLOCK_H_
+#define BENCHMARK_CYCLECLOCK_H_
+
+#include <cstdint>
+
+#include "benchmark/macros.h"
+#include "internal_macros.h"
+
+#if defined(BENCHMARK_OS_MACOSX)
+#include <mach/mach_time.h>
+#endif
+// For MSVC, we want to use '_asm rdtsc' when possible (since it works
+// with even ancient MSVC compilers), and when not possible the
+// __rdtsc intrinsic, declared in <intrin.h>. Unfortunately, in some
+// environments, <windows.h> and <intrin.h> have conflicting
+// declarations of some other intrinsics, breaking compilation.
+// Therefore, we simply declare __rdtsc ourselves. See also
+// http://connect.microsoft.com/VisualStudio/feedback/details/262047
+#if defined(COMPILER_MSVC) && !defined(_M_IX86)
+extern "C" uint64_t __rdtsc();
+#pragma intrinsic(__rdtsc)
+#endif
+
+#ifndef BENCHMARK_OS_WINDOWS
+#include <sys/time.h>
+#endif
+
+namespace benchmark {
+// NOTE: only i386 and x86_64 have been well tested.
+// PPC, sparc, alpha, and ia64 are based on
+// http://peter.kuscsik.com/wordpress/?p=14
+// with modifications by m3b. See also
+// https://setisvn.ssl.berkeley.edu/svn/lib/fftw-3.0.1/kernel/cycle.h
+namespace cycleclock {
+// This should return the number of cycles since power-on. Thread-safe.
+inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
+#if defined(BENCHMARK_OS_MACOSX)
+ // this goes at the top because we need ALL Macs, regardless of
+ // architecture, to return the number of "mach time units" that
+ // have passed since startup. See sysinfo.cc where
+ // InitializeSystemInfo() sets the supposed cpu clock frequency of
+ // macs to the number of mach time units per second, not actual
+ // CPU clock frequency (which can change in the face of CPU
+ // frequency scaling). Also note that when the Mac sleeps, this
+ // counter pauses; it does not continue counting, nor does it
+ // reset to zero.
+ return mach_absolute_time();
+#elif defined(__i386__)
+ int64_t ret;
+ __asm__ volatile("rdtsc" : "=A"(ret));
+ return ret;
+#elif defined(__x86_64__) || defined(__amd64__)
+ uint64_t low, high;
+ __asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
+ return (high << 32) | low;
+#elif defined(__powerpc__) || defined(__ppc__)
+ // This returns a time-base, which is not always precisely a cycle-count.
+ int64_t tbl, tbu0, tbu1;
+ asm("mftbu %0" : "=r"(tbu0));
+ asm("mftb %0" : "=r"(tbl));
+ asm("mftbu %0" : "=r"(tbu1));
+ tbl &= -static_cast<int64>(tbu0 == tbu1);
+ // high 32 bits in tbu1; low 32 bits in tbl (tbu0 is garbage)
+ return (tbu1 << 32) | tbl;
+#elif defined(__sparc__)
+ int64_t tick;
+ asm(".byte 0x83, 0x41, 0x00, 0x00");
+ asm("mov %%g1, %0" : "=r"(tick));
+ return tick;
+#elif defined(__ia64__)
+ int64_t itc;
+ asm("mov %0 = ar.itc" : "=r"(itc));
+ return itc;
+#elif defined(COMPILER_MSVC) && defined(_M_IX86)
+ // Older MSVC compilers (like 7.x) don't seem to support the
+ // __rdtsc intrinsic properly, so I prefer to use _asm instead
+ // when I know it will work. Otherwise, I'll use __rdtsc and hope
+ // the code is being compiled with a non-ancient compiler.
+ _asm rdtsc
+#elif defined(COMPILER_MSVC)
+ return __rdtsc();
+#elif defined(__ARM_ARCH)
+#if (__ARM_ARCH >= 6) // V6 is the earliest arch that has a standard cyclecount
+ uint32_t pmccntr;
+ uint32_t pmuseren;
+ uint32_t pmcntenset;
+ // Read the user mode perf monitor counter access permissions.
+ asm("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren));
+ if (pmuseren & 1) { // Allows reading perfmon counters for user mode code.
+ asm("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset));
+ if (pmcntenset & 0x80000000ul) { // Is it counting?
+ asm("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr));
+ // The counter is set up to count every 64th cycle
+ return static_cast<int64_t>(pmccntr) * 64; // Should optimize to << 6
+ }
+ }
+#endif
+ struct timeval tv;
+ gettimeofday(&tv, nullptr);
+ return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
+#elif defined(__mips__)
+ // mips apparently only allows rdtsc for superusers, so we fall
+ // back to gettimeofday. It's possible clock_gettime would be better.
+ struct timeval tv;
+ gettimeofday(&tv, nullptr);
+ return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
+#else
+// The soft failover to a generic implementation is automatic only for ARM.
+// For other platforms the developer is expected to make an attempt to create
+// a fast implementation and use generic version if nothing better is available.
+#error You need to define CycleTimer for your OS and CPU
+#endif
+}
+} // end namespace cycleclock
+} // end namespace benchmark
+
+#endif // BENCHMARK_CYCLECLOCK_H_
diff --git a/3rdparty/benchmark/src/internal_macros.h b/3rdparty/benchmark/src/internal_macros.h
new file mode 100644
index 00000000000..1080ac9435a
--- /dev/null
+++ b/3rdparty/benchmark/src/internal_macros.h
@@ -0,0 +1,40 @@
+#ifndef BENCHMARK_INTERNAL_MACROS_H_
+#define BENCHMARK_INTERNAL_MACROS_H_
+
+#include "benchmark/macros.h"
+
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+
+#if __has_feature(cxx_attributes)
+# define BENCHMARK_NORETURN [[noreturn]]
+#elif defined(__GNUC__)
+# define BENCHMARK_NORETURN __attribute__((noreturn))
+#else
+# define BENCHMARK_NORETURN
+#endif
+
+#if defined(__CYGWIN__)
+# define BENCHMARK_OS_CYGWIN 1
+#elif defined(_WIN32)
+# define BENCHMARK_OS_WINDOWS 1
+#elif defined(__APPLE__)
+// TODO(ericwf) This doesn't actually check that it is a Mac OSX system. Just
+// that it is an apple system.
+# define BENCHMARK_OS_MACOSX 1
+#elif defined(__FreeBSD__)
+# define BENCHMARK_OS_FREEBSD 1
+#elif defined(__linux__)
+# define BENCHMARK_OS_LINUX 1
+#endif
+
+#if defined(__clang__)
+# define COMPILER_CLANG
+#elif defined(_MSC_VER)
+# define COMPILER_MSVC
+#elif defined(__GNUC__)
+# define COMPILER_GCC
+#endif
+
+#endif // BENCHMARK_INTERNAL_MACROS_H_
diff --git a/3rdparty/benchmark/src/json_reporter.cc b/3rdparty/benchmark/src/json_reporter.cc
new file mode 100644
index 00000000000..def50ac49cf
--- /dev/null
+++ b/3rdparty/benchmark/src/json_reporter.cc
@@ -0,0 +1,159 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "benchmark/reporter.h"
+
+#include <cstdint>
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include "string_util.h"
+#include "walltime.h"
+
+namespace benchmark {
+
+namespace {
+
+std::string FormatKV(std::string const& key, std::string const& value) {
+ return StringPrintF("\"%s\": \"%s\"", key.c_str(), value.c_str());
+}
+
+std::string FormatKV(std::string const& key, const char* value) {
+ return StringPrintF("\"%s\": \"%s\"", key.c_str(), value);
+}
+
+std::string FormatKV(std::string const& key, bool value) {
+ return StringPrintF("\"%s\": %s", key.c_str(), value ? "true" : "false");
+}
+
+std::string FormatKV(std::string const& key, int64_t value) {
+ std::stringstream ss;
+ ss << '"' << key << "\": " << value;
+ return ss.str();
+}
+
+int64_t RoundDouble(double v) {
+ return static_cast<int64_t>(v + 0.5);
+}
+
+} // end namespace
+
+bool JSONReporter::ReportContext(const Context& context) {
+ std::ostream& out = std::cout;
+
+ out << "{\n";
+ std::string inner_indent(2, ' ');
+
+ // Open context block and print context information.
+ out << inner_indent << "\"context\": {\n";
+ std::string indent(4, ' ');
+
+ std::string walltime_value = LocalDateTimeString();
+ out << indent << FormatKV("date", walltime_value) << ",\n";
+
+ out << indent
+ << FormatKV("num_cpus", static_cast<int64_t>(context.num_cpus))
+ << ",\n";
+ out << indent
+ << FormatKV("mhz_per_cpu", RoundDouble(context.mhz_per_cpu))
+ << ",\n";
+ out << indent
+ << FormatKV("cpu_scaling_enabled", context.cpu_scaling_enabled)
+ << ",\n";
+
+#if defined(NDEBUG)
+ const char build_type[] = "release";
+#else
+ const char build_type[] = "debug";
+#endif
+ out << indent << FormatKV("library_build_type", build_type) << "\n";
+ // Close context block and open the list of benchmarks.
+ out << inner_indent << "},\n";
+ out << inner_indent << "\"benchmarks\": [\n";
+ return true;
+}
+
+void JSONReporter::ReportRuns(std::vector<Run> const& reports) {
+ if (reports.empty()) {
+ return;
+ }
+ std::string indent(4, ' ');
+ std::ostream& out = std::cout;
+ if (!first_report_) {
+ out << ",\n";
+ }
+ first_report_ = false;
+ std::vector<Run> reports_cp = reports;
+ if (reports.size() >= 2) {
+ Run mean_data;
+ Run stddev_data;
+ BenchmarkReporter::ComputeStats(reports, &mean_data, &stddev_data);
+ reports_cp.push_back(mean_data);
+ reports_cp.push_back(stddev_data);
+ }
+ for (auto it = reports_cp.begin(); it != reports_cp.end(); ++it) {
+ out << indent << "{\n";
+ PrintRunData(*it);
+ out << indent << '}';
+ auto it_cp = it;
+ if (++it_cp != reports_cp.end()) {
+ out << ",\n";
+ }
+ }
+}
+
+void JSONReporter::Finalize() {
+ // Close the list of benchmarks and the top level object.
+ std::cout << "\n ]\n}\n";
+}
+
+void JSONReporter::PrintRunData(Run const& run) {
+ double const multiplier = 1e9; // nano second multiplier
+ double cpu_time = run.cpu_accumulated_time * multiplier;
+ double real_time = run.real_accumulated_time * multiplier;
+ if (run.iterations != 0) {
+ real_time = real_time / static_cast<double>(run.iterations);
+ cpu_time = cpu_time / static_cast<double>(run.iterations);
+ }
+
+ std::string indent(6, ' ');
+ std::ostream& out = std::cout;
+ out << indent
+ << FormatKV("name", run.benchmark_name)
+ << ",\n";
+ out << indent
+ << FormatKV("iterations", run.iterations)
+ << ",\n";
+ out << indent
+ << FormatKV("real_time", RoundDouble(real_time))
+ << ",\n";
+ out << indent
+ << FormatKV("cpu_time", RoundDouble(cpu_time));
+ if (run.bytes_per_second > 0.0) {
+ out << ",\n" << indent
+ << FormatKV("bytes_per_second", RoundDouble(run.bytes_per_second));
+ }
+ if (run.items_per_second > 0.0) {
+ out << ",\n" << indent
+ << FormatKV("items_per_second", RoundDouble(run.items_per_second));
+ }
+ if (!run.report_label.empty()) {
+ out << ",\n" << indent
+ << FormatKV("label", run.report_label);
+ }
+ out << '\n';
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/log.cc b/3rdparty/benchmark/src/log.cc
new file mode 100644
index 00000000000..b660309d324
--- /dev/null
+++ b/3rdparty/benchmark/src/log.cc
@@ -0,0 +1,40 @@
+#include "log.h"
+
+#include <iostream>
+
+namespace benchmark {
+namespace internal {
+
+int& LoggingLevelImp() {
+ static int level = 0;
+ return level;
+}
+
+void SetLogLevel(int value) {
+ LoggingLevelImp() = value;
+}
+
+int GetLogLevel() {
+ return LoggingLevelImp();
+}
+
+class NullLogBuffer : public std::streambuf
+{
+public:
+ int overflow(int c) {
+ return c;
+ }
+};
+
+std::ostream& GetNullLogInstance() {
+ static NullLogBuffer log_buff;
+ static std::ostream null_log(&log_buff);
+ return null_log;
+}
+
+std::ostream& GetErrorLogInstance() {
+ return std::clog;
+}
+
+} // end namespace internal
+} // end namespace benchmark \ No newline at end of file
diff --git a/3rdparty/benchmark/src/log.h b/3rdparty/benchmark/src/log.h
new file mode 100644
index 00000000000..3777810e1c9
--- /dev/null
+++ b/3rdparty/benchmark/src/log.h
@@ -0,0 +1,28 @@
+#ifndef BENCHMARK_LOG_H_
+#define BENCHMARK_LOG_H_
+
+#include <ostream>
+
+namespace benchmark {
+namespace internal {
+
+int GetLogLevel();
+void SetLogLevel(int level);
+
+std::ostream& GetNullLogInstance();
+std::ostream& GetErrorLogInstance();
+
+inline std::ostream& GetLogInstanceForLevel(int level) {
+ if (level <= GetLogLevel()) {
+ return GetErrorLogInstance();
+ }
+ return GetNullLogInstance();
+}
+
+} // end namespace internal
+} // end namespace benchmark
+
+#define VLOG(x) (::benchmark::internal::GetLogInstanceForLevel(x) \
+ << "-- LOG(" << x << "): ")
+
+#endif \ No newline at end of file
diff --git a/3rdparty/benchmark/src/mutex.h b/3rdparty/benchmark/src/mutex.h
new file mode 100644
index 00000000000..f37ec35b3a4
--- /dev/null
+++ b/3rdparty/benchmark/src/mutex.h
@@ -0,0 +1,142 @@
+#ifndef BENCHMARK_MUTEX_H_
+#define BENCHMARK_MUTEX_H_
+
+#include <mutex>
+#include <condition_variable>
+
+// Enable thread safety attributes only with clang.
+// The attributes can be safely erased when compiling with other compilers.
+#if defined(HAVE_THREAD_SAFETY_ATTRIBUTES)
+#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
+#else
+#define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op
+#endif
+
+#define CAPABILITY(x) \
+ THREAD_ANNOTATION_ATTRIBUTE__(capability(x))
+
+#define SCOPED_CAPABILITY \
+ THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
+
+#define GUARDED_BY(x) \
+ THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
+
+#define PT_GUARDED_BY(x) \
+ THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
+
+#define ACQUIRED_BEFORE(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__))
+
+#define ACQUIRED_AFTER(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__))
+
+#define REQUIRES(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(__VA_ARGS__))
+
+#define REQUIRES_SHARED(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(__VA_ARGS__))
+
+#define ACQUIRE(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(__VA_ARGS__))
+
+#define ACQUIRE_SHARED(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(__VA_ARGS__))
+
+#define RELEASE(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__))
+
+#define RELEASE_SHARED(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__))
+
+#define TRY_ACQUIRE(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(__VA_ARGS__))
+
+#define TRY_ACQUIRE_SHARED(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(__VA_ARGS__))
+
+#define EXCLUDES(...) \
+ THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__))
+
+#define ASSERT_CAPABILITY(x) \
+ THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x))
+
+#define ASSERT_SHARED_CAPABILITY(x) \
+ THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x))
+
+#define RETURN_CAPABILITY(x) \
+ THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
+
+#define NO_THREAD_SAFETY_ANALYSIS \
+ THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
+
+
+namespace benchmark {
+
+typedef std::condition_variable Condition;
+
+// NOTE: Wrappers for std::mutex and std::unique_lock are provided so that
+// we can annotate them with thread safety attributes and use the
+// -Wthread-safety warning with clang. The standard library types cannot be
+// used directly because they do not provided the required annotations.
+class CAPABILITY("mutex") Mutex
+{
+public:
+ Mutex() {}
+
+ void lock() ACQUIRE() { mut_.lock(); }
+ void unlock() RELEASE() { mut_.unlock(); }
+ std::mutex& native_handle() {
+ return mut_;
+ }
+private:
+ std::mutex mut_;
+};
+
+
+class SCOPED_CAPABILITY MutexLock
+{
+ typedef std::unique_lock<std::mutex> MutexLockImp;
+public:
+ MutexLock(Mutex& m) ACQUIRE(m) : ml_(m.native_handle())
+ { }
+ ~MutexLock() RELEASE() {}
+ MutexLockImp& native_handle() { return ml_; }
+private:
+ MutexLockImp ml_;
+};
+
+
+class Notification
+{
+public:
+ Notification() : notified_yet_(false) { }
+
+ void WaitForNotification() const EXCLUDES(mutex_) {
+ MutexLock m_lock(mutex_);
+ auto notified_fn = [this]() REQUIRES(mutex_) {
+ return this->HasBeenNotified();
+ };
+ cv_.wait(m_lock.native_handle(), notified_fn);
+ }
+
+ void Notify() EXCLUDES(mutex_) {
+ {
+ MutexLock lock(mutex_);
+ notified_yet_ = 1;
+ }
+ cv_.notify_all();
+ }
+
+private:
+ bool HasBeenNotified() const REQUIRES(mutex_) {
+ return notified_yet_;
+ }
+
+ mutable Mutex mutex_;
+ mutable std::condition_variable cv_;
+ bool notified_yet_ GUARDED_BY(mutex_);
+};
+
+} // end namespace benchmark
+
+#endif // BENCHMARK_MUTEX_H_
diff --git a/3rdparty/benchmark/src/re.h b/3rdparty/benchmark/src/re.h
new file mode 100644
index 00000000000..af57a39cffb
--- /dev/null
+++ b/3rdparty/benchmark/src/re.h
@@ -0,0 +1,60 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef BENCHMARK_RE_H_
+#define BENCHMARK_RE_H_
+
+#if defined(HAVE_STD_REGEX)
+#include <regex>
+#elif defined(HAVE_GNU_POSIX_REGEX)
+#include <gnuregex.h>
+#elif defined(HAVE_POSIX_REGEX)
+#include <regex.h>
+#else
+#error No regular expression backend was found!
+#endif
+#include <string>
+
+namespace benchmark {
+
+// A wrapper around the POSIX regular expression API that provides automatic
+// cleanup
+class Regex {
+ public:
+ Regex();
+ ~Regex();
+
+ // Compile a regular expression matcher from spec. Returns true on success.
+ //
+ // On failure (and if error is not nullptr), error is populated with a human
+ // readable error message if an error occurs.
+ bool Init(const std::string& spec, std::string* error);
+
+ // Returns whether str matches the compiled regular expression.
+ bool Match(const std::string& str);
+ private:
+ bool init_;
+ // Underlying regular expression object
+#if defined(HAVE_STD_REGEX)
+ std::regex re_;
+#elif defined(HAVE_POSIX_REGEX) || defined(HAVE_GNU_POSIX_REGEX)
+ regex_t re_;
+#else
+# error No regular expression backend implementation available
+#endif
+};
+
+} // end namespace benchmark
+
+#endif // BENCHMARK_RE_H_
diff --git a/3rdparty/benchmark/src/re_posix.cc b/3rdparty/benchmark/src/re_posix.cc
new file mode 100644
index 00000000000..95b086ffd6d
--- /dev/null
+++ b/3rdparty/benchmark/src/re_posix.cc
@@ -0,0 +1,59 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "check.h"
+#include "re.h"
+
+namespace benchmark {
+
+Regex::Regex() : init_(false) { }
+
+bool Regex::Init(const std::string& spec, std::string* error) {
+ int ec = regcomp(&re_, spec.c_str(), REG_EXTENDED | REG_NOSUB);
+ if (ec != 0) {
+ if (error) {
+ size_t needed = regerror(ec, &re_, nullptr, 0);
+ char* errbuf = new char[needed];
+ regerror(ec, &re_, errbuf, needed);
+
+ // regerror returns the number of bytes necessary to null terminate
+ // the string, so we move that when assigning to error.
+ CHECK_NE(needed, 0);
+ error->assign(errbuf, needed - 1);
+
+ delete[] errbuf;
+ }
+
+ return false;
+ }
+
+ init_ = true;
+ return true;
+}
+
+Regex::~Regex() {
+ if (init_) {
+ regfree(&re_);
+ }
+}
+
+bool Regex::Match(const std::string& str) {
+ if (!init_) {
+ return false;
+ }
+
+ return regexec(&re_, str.c_str(), 0, nullptr, 0) == 0;
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/re_std.cc b/3rdparty/benchmark/src/re_std.cc
new file mode 100644
index 00000000000..cfd7a218ab4
--- /dev/null
+++ b/3rdparty/benchmark/src/re_std.cc
@@ -0,0 +1,44 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "re.h"
+
+namespace benchmark {
+
+Regex::Regex() : init_(false) { }
+
+bool Regex::Init(const std::string& spec, std::string* error) {
+ try {
+ re_ = std::regex(spec, std::regex_constants::extended);
+
+ init_ = true;
+ } catch (const std::regex_error& e) {
+ if (error) {
+ *error = e.what();
+ }
+ }
+ return init_;
+}
+
+Regex::~Regex() { }
+
+bool Regex::Match(const std::string& str) {
+ if (!init_) {
+ return false;
+ }
+
+ return std::regex_search(str, re_);
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/reporter.cc b/3rdparty/benchmark/src/reporter.cc
new file mode 100644
index 00000000000..4b47e3d556c
--- /dev/null
+++ b/3rdparty/benchmark/src/reporter.cc
@@ -0,0 +1,86 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "benchmark/reporter.h"
+
+#include <cstdlib>
+#include <vector>
+
+#include "check.h"
+#include "stat.h"
+
+namespace benchmark {
+
+void BenchmarkReporter::ComputeStats(
+ const std::vector<Run>& reports,
+ Run* mean_data, Run* stddev_data) {
+ CHECK(reports.size() >= 2) << "Cannot compute stats for less than 2 reports";
+ // Accumulators.
+ Stat1_d real_accumulated_time_stat;
+ Stat1_d cpu_accumulated_time_stat;
+ Stat1_d bytes_per_second_stat;
+ Stat1_d items_per_second_stat;
+ // All repetitions should be run with the same number of iterations so we
+ // can take this information from the first benchmark.
+ int64_t const run_iterations = reports.front().iterations;
+
+ // Populate the accumulators.
+ for (Run const& run : reports) {
+ CHECK_EQ(reports[0].benchmark_name, run.benchmark_name);
+ CHECK_EQ(run_iterations, run.iterations);
+ real_accumulated_time_stat +=
+ Stat1_d(run.real_accumulated_time/run.iterations, run.iterations);
+ cpu_accumulated_time_stat +=
+ Stat1_d(run.cpu_accumulated_time/run.iterations, run.iterations);
+ items_per_second_stat += Stat1_d(run.items_per_second, run.iterations);
+ bytes_per_second_stat += Stat1_d(run.bytes_per_second, run.iterations);
+ }
+
+ // Get the data from the accumulator to BenchmarkReporter::Run's.
+ mean_data->benchmark_name = reports[0].benchmark_name + "_mean";
+ mean_data->iterations = run_iterations;
+ mean_data->real_accumulated_time = real_accumulated_time_stat.Mean() *
+ run_iterations;
+ mean_data->cpu_accumulated_time = cpu_accumulated_time_stat.Mean() *
+ run_iterations;
+ mean_data->bytes_per_second = bytes_per_second_stat.Mean();
+ mean_data->items_per_second = items_per_second_stat.Mean();
+
+ // Only add label to mean/stddev if it is same for all runs
+ mean_data->report_label = reports[0].report_label;
+ for (std::size_t i = 1; i < reports.size(); i++) {
+ if (reports[i].report_label != reports[0].report_label) {
+ mean_data->report_label = "";
+ break;
+ }
+ }
+
+ stddev_data->benchmark_name = reports[0].benchmark_name + "_stddev";
+ stddev_data->report_label = mean_data->report_label;
+ stddev_data->iterations = 0;
+ stddev_data->real_accumulated_time =
+ real_accumulated_time_stat.StdDev();
+ stddev_data->cpu_accumulated_time =
+ cpu_accumulated_time_stat.StdDev();
+ stddev_data->bytes_per_second = bytes_per_second_stat.StdDev();
+ stddev_data->items_per_second = items_per_second_stat.StdDev();
+}
+
+void BenchmarkReporter::Finalize() {
+}
+
+BenchmarkReporter::~BenchmarkReporter() {
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/sleep.cc b/3rdparty/benchmark/src/sleep.cc
new file mode 100644
index 00000000000..918abc485dc
--- /dev/null
+++ b/3rdparty/benchmark/src/sleep.cc
@@ -0,0 +1,50 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "sleep.h"
+
+#include <cerrno>
+#include <ctime>
+
+#include "internal_macros.h"
+
+#ifdef BENCHMARK_OS_WINDOWS
+#include <Windows.h>
+#endif
+
+namespace benchmark {
+#ifdef BENCHMARK_OS_WINDOWS
+// Window's Sleep takes milliseconds argument.
+void SleepForMilliseconds(int milliseconds) { Sleep(milliseconds); }
+void SleepForSeconds(double seconds) {
+ SleepForMilliseconds(static_cast<int>(kNumMillisPerSecond * seconds));
+}
+#else // BENCHMARK_OS_WINDOWS
+void SleepForMicroseconds(int microseconds) {
+ struct timespec sleep_time;
+ sleep_time.tv_sec = microseconds / kNumMicrosPerSecond;
+ sleep_time.tv_nsec = (microseconds % kNumMicrosPerSecond) * kNumNanosPerMicro;
+ while (nanosleep(&sleep_time, &sleep_time) != 0 && errno == EINTR)
+ ; // Ignore signals and wait for the full interval to elapse.
+}
+
+void SleepForMilliseconds(int milliseconds) {
+ SleepForMicroseconds(static_cast<int>(milliseconds) * kNumMicrosPerMilli);
+}
+
+void SleepForSeconds(double seconds) {
+ SleepForMicroseconds(static_cast<int>(seconds * kNumMicrosPerSecond));
+}
+#endif // BENCHMARK_OS_WINDOWS
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/sleep.h b/3rdparty/benchmark/src/sleep.h
new file mode 100644
index 00000000000..f1e515ca4f3
--- /dev/null
+++ b/3rdparty/benchmark/src/sleep.h
@@ -0,0 +1,17 @@
+#ifndef BENCHMARK_SLEEP_H_
+#define BENCHMARK_SLEEP_H_
+
+#include <cstdint>
+
+namespace benchmark {
+const int64_t kNumMillisPerSecond = 1000LL;
+const int64_t kNumMicrosPerMilli = 1000LL;
+const int64_t kNumMicrosPerSecond = kNumMillisPerSecond * 1000LL;
+const int64_t kNumNanosPerMicro = 1000LL;
+const int64_t kNumNanosPerSecond = kNumNanosPerMicro * kNumMicrosPerSecond;
+
+void SleepForMilliseconds(int milliseconds);
+void SleepForSeconds(double seconds);
+} // end namespace benchmark
+
+#endif // BENCHMARK_SLEEP_H_
diff --git a/3rdparty/benchmark/src/stat.h b/3rdparty/benchmark/src/stat.h
new file mode 100644
index 00000000000..c4ecfe8e044
--- /dev/null
+++ b/3rdparty/benchmark/src/stat.h
@@ -0,0 +1,307 @@
+#ifndef BENCHMARK_STAT_H_
+#define BENCHMARK_STAT_H_
+
+#include <cmath>
+#include <limits>
+#include <ostream>
+#include <type_traits>
+
+
+namespace benchmark {
+
+template <typename VType, typename NumType>
+class Stat1;
+
+template <typename VType, typename NumType>
+class Stat1MinMax;
+
+typedef Stat1<float, int64_t> Stat1_f;
+typedef Stat1<double, int64_t> Stat1_d;
+typedef Stat1MinMax<float, int64_t> Stat1MinMax_f;
+typedef Stat1MinMax<double, int64_t> Stat1MinMax_d;
+
+template <typename VType>
+class Vector2;
+template <typename VType>
+class Vector3;
+template <typename VType>
+class Vector4;
+
+template <typename VType, typename NumType>
+class Stat1 {
+ public:
+ typedef Stat1<VType, NumType> Self;
+
+ Stat1() { Clear(); }
+ // Create a sample of value dat and weight 1
+ explicit Stat1(const VType &dat) {
+ sum_ = dat;
+ sum_squares_ = Sqr(dat);
+ numsamples_ = 1;
+ }
+ // Create statistics for all the samples between begin (included)
+ // and end(excluded)
+ explicit Stat1(const VType *begin, const VType *end) {
+ Clear();
+ for (const VType *item = begin; item < end; ++item) {
+ (*this) += Stat1(*item);
+ }
+ }
+ // Create a sample of value dat and weight w
+ Stat1(const VType &dat, const NumType &w) {
+ sum_ = w * dat;
+ sum_squares_ = w * Sqr(dat);
+ numsamples_ = w;
+ }
+ // Copy operator
+ Stat1(const Self &stat) {
+ sum_ = stat.sum_;
+ sum_squares_ = stat.sum_squares_;
+ numsamples_ = stat.numsamples_;
+ }
+
+ void Clear() {
+ numsamples_ = NumType();
+ sum_squares_ = sum_ = VType();
+ }
+
+ Self &operator=(const Self &stat) {
+ sum_ = stat.sum_;
+ sum_squares_ = stat.sum_squares_;
+ numsamples_ = stat.numsamples_;
+ return (*this);
+ }
+ // Merge statistics from two sample sets.
+ Self &operator+=(const Self &stat) {
+ sum_ += stat.sum_;
+ sum_squares_ += stat.sum_squares_;
+ numsamples_ += stat.numsamples_;
+ return (*this);
+ }
+ // The operation opposite to +=
+ Self &operator-=(const Self &stat) {
+ sum_ -= stat.sum_;
+ sum_squares_ -= stat.sum_squares_;
+ numsamples_ -= stat.numsamples_;
+ return (*this);
+ }
+ // Multiply the weight of the set of samples by a factor k
+ Self &operator*=(const VType &k) {
+ sum_ *= k;
+ sum_squares_ *= k;
+ numsamples_ *= k;
+ return (*this);
+ }
+
+ // Merge statistics from two sample sets.
+ Self operator+(const Self &stat) const { return Self(*this) += stat; }
+
+ // The operation opposite to +
+ Self operator-(const Self &stat) const { return Self(*this) -= stat; }
+
+ // Multiply the weight of the set of samples by a factor k
+ Self operator*(const VType &k) const { return Self(*this) *= k; }
+
+ // Return the total weight of this sample set
+ NumType numSamples() const { return numsamples_; }
+
+ // Return the sum of this sample set
+ VType Sum() const { return sum_; }
+
+ // Return the mean of this sample set
+ VType Mean() const {
+ if (numsamples_ == 0) return VType();
+ return sum_ * (1.0 / numsamples_);
+ }
+
+ // Return the mean of this sample set and compute the standard deviation at
+ // the same time.
+ VType Mean(VType *stddev) const {
+ if (numsamples_ == 0) return VType();
+ VType mean = sum_ * (1.0 / numsamples_);
+ if (stddev) {
+ VType avg_squares = sum_squares_ * (1.0 / numsamples_);
+ *stddev = Sqrt(avg_squares - Sqr(mean));
+ }
+ return mean;
+ }
+
+ // Return the standard deviation of the sample set
+ VType StdDev() const {
+ if (numsamples_ == 0) return VType();
+ VType mean = Mean();
+ VType avg_squares = sum_squares_ * (1.0 / numsamples_);
+ return Sqrt(avg_squares - Sqr(mean));
+ }
+
+ private:
+ static_assert(std::is_integral<NumType>::value &&
+ !std::is_same<NumType, bool>::value,
+ "NumType must be an integral type that is not bool.");
+ // Let i be the index of the samples provided (using +=)
+ // and weight[i],value[i] be the data of sample #i
+ // then the variables have the following meaning:
+ NumType numsamples_; // sum of weight[i];
+ VType sum_; // sum of weight[i]*value[i];
+ VType sum_squares_; // sum of weight[i]*value[i]^2;
+
+ // Template function used to square a number.
+ // For a vector we square all components
+ template <typename SType>
+ static inline SType Sqr(const SType &dat) {
+ return dat * dat;
+ }
+
+ template <typename SType>
+ static inline Vector2<SType> Sqr(const Vector2<SType> &dat) {
+ return dat.MulComponents(dat);
+ }
+
+ template <typename SType>
+ static inline Vector3<SType> Sqr(const Vector3<SType> &dat) {
+ return dat.MulComponents(dat);
+ }
+
+ template <typename SType>
+ static inline Vector4<SType> Sqr(const Vector4<SType> &dat) {
+ return dat.MulComponents(dat);
+ }
+
+ // Template function used to take the square root of a number.
+ // For a vector we square all components
+ template <typename SType>
+ static inline SType Sqrt(const SType &dat) {
+ // Avoid NaN due to imprecision in the calculations
+ if (dat < 0) return 0;
+ return sqrt(dat);
+ }
+
+ template <typename SType>
+ static inline Vector2<SType> Sqrt(const Vector2<SType> &dat) {
+ // Avoid NaN due to imprecision in the calculations
+ return Max(dat, Vector2<SType>()).Sqrt();
+ }
+
+ template <typename SType>
+ static inline Vector3<SType> Sqrt(const Vector3<SType> &dat) {
+ // Avoid NaN due to imprecision in the calculations
+ return Max(dat, Vector3<SType>()).Sqrt();
+ }
+
+ template <typename SType>
+ static inline Vector4<SType> Sqrt(const Vector4<SType> &dat) {
+ // Avoid NaN due to imprecision in the calculations
+ return Max(dat, Vector4<SType>()).Sqrt();
+ }
+};
+
+// Useful printing function
+template <typename VType, typename NumType>
+std::ostream &operator<<(std::ostream &out, const Stat1<VType, NumType> &s) {
+ out << "{ avg = " << s.Mean() << " std = " << s.StdDev()
+ << " nsamples = " << s.NumSamples() << "}";
+ return out;
+}
+
+// Stat1MinMax: same as Stat1, but it also
+// keeps the Min and Max values; the "-"
+// operator is disabled because it cannot be implemented
+// efficiently
+template <typename VType, typename NumType>
+class Stat1MinMax : public Stat1<VType, NumType> {
+ public:
+ typedef Stat1MinMax<VType, NumType> Self;
+
+ Stat1MinMax() { Clear(); }
+ // Create a sample of value dat and weight 1
+ explicit Stat1MinMax(const VType &dat) : Stat1<VType, NumType>(dat) {
+ max_ = dat;
+ min_ = dat;
+ }
+ // Create statistics for all the samples between begin (included)
+ // and end(excluded)
+ explicit Stat1MinMax(const VType *begin, const VType *end) {
+ Clear();
+ for (const VType *item = begin; item < end; ++item) {
+ (*this) += Stat1MinMax(*item);
+ }
+ }
+ // Create a sample of value dat and weight w
+ Stat1MinMax(const VType &dat, const NumType &w)
+ : Stat1<VType, NumType>(dat, w) {
+ max_ = dat;
+ min_ = dat;
+ }
+ // Copy operator
+ Stat1MinMax(const Self &stat) : Stat1<VType, NumType>(stat) {
+ max_ = stat.max_;
+ min_ = stat.min_;
+ }
+
+ void Clear() {
+ Stat1<VType, NumType>::Clear();
+ if (std::numeric_limits<VType>::has_infinity) {
+ min_ = std::numeric_limits<VType>::infinity();
+ max_ = -std::numeric_limits<VType>::infinity();
+ } else {
+ min_ = std::numeric_limits<VType>::max();
+ max_ = std::numeric_limits<VType>::min();
+ }
+ }
+
+ Self &operator=(const Self &stat) {
+ this->Stat1<VType, NumType>::operator=(stat);
+ max_ = stat.max_;
+ min_ = stat.min_;
+ return (*this);
+ }
+ // Merge statistics from two sample sets.
+ Self &operator+=(const Self &stat) {
+ this->Stat1<VType, NumType>::operator+=(stat);
+ if (stat.max_ > max_) max_ = stat.max_;
+ if (stat.min_ < min_) min_ = stat.min_;
+ return (*this);
+ }
+ // Multiply the weight of the set of samples by a factor k
+ Self &operator*=(const VType &stat) {
+ this->Stat1<VType, NumType>::operator*=(stat);
+ return (*this);
+ }
+ // Merge statistics from two sample sets.
+ Self operator+(const Self &stat) const { return Self(*this) += stat; }
+ // Multiply the weight of the set of samples by a factor k
+ Self operator*(const VType &k) const { return Self(*this) *= k; }
+
+ // Return the maximal value in this sample set
+ VType Max() const { return max_; }
+ // Return the minimal value in this sample set
+ VType Min() const { return min_; }
+
+ private:
+ // The - operation makes no sense with Min/Max
+ // unless we keep the full list of values (but we don't)
+ // make it private, and let it undefined so nobody can call it
+ Self &operator-=(const Self &stat); // senseless. let it undefined.
+
+ // The operation opposite to -
+ Self operator-(const Self &stat) const; // senseless. let it undefined.
+
+ // Let i be the index of the samples provided (using +=)
+ // and weight[i],value[i] be the data of sample #i
+ // then the variables have the following meaning:
+ VType max_; // max of value[i]
+ VType min_; // min of value[i]
+};
+
+// Useful printing function
+template <typename VType, typename NumType>
+std::ostream &operator<<(std::ostream &out,
+ const Stat1MinMax<VType, NumType> &s) {
+ out << "{ avg = " << s.Mean() << " std = " << s.StdDev()
+ << " nsamples = " << s.NumSamples() << " min = " << s.Min()
+ << " max = " << s.Max() << "}";
+ return out;
+}
+} // end namespace benchmark
+
+#endif // BENCHMARK_STAT_H_
diff --git a/3rdparty/benchmark/src/string_util.cc b/3rdparty/benchmark/src/string_util.cc
new file mode 100644
index 00000000000..30d130500d3
--- /dev/null
+++ b/3rdparty/benchmark/src/string_util.cc
@@ -0,0 +1,169 @@
+#include "string_util.h"
+
+#include <cmath>
+#include <cstdarg>
+#include <array>
+#include <memory>
+#include <sstream>
+#include <stdio.h>
+
+#include "arraysize.h"
+
+namespace benchmark {
+namespace {
+
+// kilo, Mega, Giga, Tera, Peta, Exa, Zetta, Yotta.
+const char kBigSIUnits[] = "kMGTPEZY";
+// Kibi, Mebi, Gibi, Tebi, Pebi, Exbi, Zebi, Yobi.
+const char kBigIECUnits[] = "KMGTPEZY";
+// milli, micro, nano, pico, femto, atto, zepto, yocto.
+const char kSmallSIUnits[] = "munpfazy";
+
+// We require that all three arrays have the same size.
+static_assert(arraysize(kBigSIUnits) == arraysize(kBigIECUnits),
+ "SI and IEC unit arrays must be the same size");
+static_assert(arraysize(kSmallSIUnits) == arraysize(kBigSIUnits),
+ "Small SI and Big SI unit arrays must be the same size");
+
+static const int64_t kUnitsSize = arraysize(kBigSIUnits);
+
+} // end anonymous namespace
+
+void ToExponentAndMantissa(double val, double thresh, int precision,
+ double one_k, std::string* mantissa,
+ int64_t* exponent) {
+ std::stringstream mantissa_stream;
+
+ if (val < 0) {
+ mantissa_stream << "-";
+ val = -val;
+ }
+
+ // Adjust threshold so that it never excludes things which can't be rendered
+ // in 'precision' digits.
+ const double adjusted_threshold =
+ std::max(thresh, 1.0 / std::pow(10.0, precision));
+ const double big_threshold = adjusted_threshold * one_k;
+ const double small_threshold = adjusted_threshold;
+
+ if (val > big_threshold) {
+ // Positive powers
+ double scaled = val;
+ for (size_t i = 0; i < arraysize(kBigSIUnits); ++i) {
+ scaled /= one_k;
+ if (scaled <= big_threshold) {
+ mantissa_stream << scaled;
+ *exponent = i + 1;
+ *mantissa = mantissa_stream.str();
+ return;
+ }
+ }
+ mantissa_stream << val;
+ *exponent = 0;
+ } else if (val < small_threshold) {
+ // Negative powers
+ double scaled = val;
+ for (size_t i = 0; i < arraysize(kSmallSIUnits); ++i) {
+ scaled *= one_k;
+ if (scaled >= small_threshold) {
+ mantissa_stream << scaled;
+ *exponent = -static_cast<int64_t>(i + 1);
+ *mantissa = mantissa_stream.str();
+ return;
+ }
+ }
+ mantissa_stream << val;
+ *exponent = 0;
+ } else {
+ mantissa_stream << val;
+ *exponent = 0;
+ }
+ *mantissa = mantissa_stream.str();
+}
+
+std::string ExponentToPrefix(int64_t exponent, bool iec) {
+ if (exponent == 0) return "";
+
+ const int64_t index = (exponent > 0 ? exponent - 1 : -exponent - 1);
+ if (index >= kUnitsSize) return "";
+
+ const char* array =
+ (exponent > 0 ? (iec ? kBigIECUnits : kBigSIUnits) : kSmallSIUnits);
+ if (iec)
+ return array[index] + std::string("i");
+ else
+ return std::string(1, array[index]);
+}
+
+std::string ToBinaryStringFullySpecified(double value, double threshold,
+ int precision) {
+ std::string mantissa;
+ int64_t exponent;
+ ToExponentAndMantissa(value, threshold, precision, 1024.0, &mantissa,
+ &exponent);
+ return mantissa + ExponentToPrefix(exponent, false);
+}
+
+void AppendHumanReadable(int n, std::string* str) {
+ std::stringstream ss;
+ // Round down to the nearest SI prefix.
+ ss << "/" << ToBinaryStringFullySpecified(n, 1.0, 0);
+ *str += ss.str();
+}
+
+std::string HumanReadableNumber(double n) {
+ // 1.1 means that figures up to 1.1k should be shown with the next unit down;
+ // this softens edge effects.
+ // 1 means that we should show one decimal place of precision.
+ return ToBinaryStringFullySpecified(n, 1.1, 1);
+}
+
+std::string StringPrintFImp(const char *msg, va_list args)
+{
+ // we might need a second shot at this, so pre-emptivly make a copy
+ va_list args_cp;
+ va_copy(args_cp, args);
+
+ // TODO(ericwf): use std::array for first attempt to avoid one memory
+ // allocation guess what the size might be
+ std::array<char, 256> local_buff;
+ std::size_t size = local_buff.size();
+ // 2015-10-08: vsnprintf is used instead of snd::vsnprintf due to a limitation in the android-ndk
+ auto ret = vsnprintf(local_buff.data(), size, msg, args_cp);
+
+ va_end(args_cp);
+
+ // handle empty expansion
+ if (ret == 0)
+ return std::string{};
+ if (static_cast<std::size_t>(ret) < size)
+ return std::string(local_buff.data());
+
+ // we did not provide a long enough buffer on our first attempt.
+ // add 1 to size to account for null-byte in size cast to prevent overflow
+ size = static_cast<std::size_t>(ret) + 1;
+ auto buff_ptr = std::unique_ptr<char[]>(new char[size]);
+ // 2015-10-08: vsnprintf is used instead of snd::vsnprintf due to a limitation in the android-ndk
+ ret = vsnprintf(buff_ptr.get(), size, msg, args);
+ return std::string(buff_ptr.get());
+}
+
+std::string StringPrintF(const char* format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ std::string tmp = StringPrintFImp(format, args);
+ va_end(args);
+ return tmp;
+}
+
+void ReplaceAll(std::string* str, const std::string& from,
+ const std::string& to) {
+ std::size_t start = 0;
+ while((start = str->find(from, start)) != std::string::npos) {
+ str->replace(start, from.length(), to);
+ start += to.length();
+ }
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/string_util.h b/3rdparty/benchmark/src/string_util.h
new file mode 100644
index 00000000000..b89fef5ff36
--- /dev/null
+++ b/3rdparty/benchmark/src/string_util.h
@@ -0,0 +1,44 @@
+#ifndef BENCHMARK_STRING_UTIL_H_
+#define BENCHMARK_STRING_UTIL_H_
+
+#include <string>
+#include <sstream>
+#include <utility>
+#include "internal_macros.h"
+
+namespace benchmark {
+
+void AppendHumanReadable(int n, std::string* str);
+
+std::string HumanReadableNumber(double n);
+
+std::string StringPrintF(const char* format, ...);
+
+inline std::ostream&
+StringCatImp(std::ostream& out) BENCHMARK_NOEXCEPT
+{
+ return out;
+}
+
+template <class First, class ...Rest>
+inline std::ostream&
+StringCatImp(std::ostream& out, First&& f, Rest&&... rest)
+{
+ out << std::forward<First>(f);
+ return StringCatImp(out, std::forward<Rest>(rest)...);
+}
+
+template<class ...Args>
+inline std::string StrCat(Args&&... args)
+{
+ std::ostringstream ss;
+ StringCatImp(ss, std::forward<Args>(args)...);
+ return ss.str();
+}
+
+void ReplaceAll(std::string* str, const std::string& from,
+ const std::string& to);
+
+} // end namespace benchmark
+
+#endif // BENCHMARK_STRING_UTIL_H_
diff --git a/3rdparty/benchmark/src/sysinfo.cc b/3rdparty/benchmark/src/sysinfo.cc
new file mode 100644
index 00000000000..d1f312024d3
--- /dev/null
+++ b/3rdparty/benchmark/src/sysinfo.cc
@@ -0,0 +1,416 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "sysinfo.h"
+#include "internal_macros.h"
+
+#ifdef BENCHMARK_OS_WINDOWS
+#include <Shlwapi.h>
+#include <Windows.h>
+#include <VersionHelpers.h>
+#else
+#include <fcntl.h>
+#include <sys/resource.h>
+#include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD
+#include <sys/time.h>
+#include <unistd.h>
+#if defined BENCHMARK_OS_FREEBSD || defined BENCHMARK_OS_MACOSX
+#include <sys/sysctl.h>
+#endif
+#endif
+
+#include <cerrno>
+#include <cstdio>
+#include <cstdint>
+#include <cstdlib>
+#include <cstring>
+#include <iostream>
+#include <limits>
+#include <mutex>
+
+#include "arraysize.h"
+#include "check.h"
+#include "cycleclock.h"
+#include "internal_macros.h"
+#include "log.h"
+#include "sleep.h"
+#include "string_util.h"
+
+namespace benchmark {
+namespace {
+std::once_flag cpuinfo_init;
+double cpuinfo_cycles_per_second = 1.0;
+int cpuinfo_num_cpus = 1; // Conservative guess
+std::mutex cputimens_mutex;
+
+#if !defined BENCHMARK_OS_MACOSX
+const int64_t estimate_time_ms = 1000;
+
+// Helper function estimates cycles/sec by observing cycles elapsed during
+// sleep(). Using small sleep time decreases accuracy significantly.
+int64_t EstimateCyclesPerSecond() {
+ const int64_t start_ticks = cycleclock::Now();
+ SleepForMilliseconds(estimate_time_ms);
+ return cycleclock::Now() - start_ticks;
+}
+#endif
+
+#if defined BENCHMARK_OS_LINUX || defined BENCHMARK_OS_CYGWIN
+// Helper function for reading an int from a file. Returns true if successful
+// and the memory location pointed to by value is set to the value read.
+bool ReadIntFromFile(const char* file, long* value) {
+ bool ret = false;
+ int fd = open(file, O_RDONLY);
+ if (fd != -1) {
+ char line[1024];
+ char* err;
+ memset(line, '\0', sizeof(line));
+ CHECK(read(fd, line, sizeof(line) - 1));
+ const long temp_value = strtol(line, &err, 10);
+ if (line[0] != '\0' && (*err == '\n' || *err == '\0')) {
+ *value = temp_value;
+ ret = true;
+ }
+ close(fd);
+ }
+ return ret;
+}
+#endif
+
+void InitializeSystemInfo() {
+#if defined BENCHMARK_OS_LINUX || defined BENCHMARK_OS_CYGWIN
+ char line[1024];
+ char* err;
+ long freq;
+
+ bool saw_mhz = false;
+
+ // If the kernel is exporting the tsc frequency use that. There are issues
+ // where cpuinfo_max_freq cannot be relied on because the BIOS may be
+ // exporintg an invalid p-state (on x86) or p-states may be used to put the
+ // processor in a new mode (turbo mode). Essentially, those frequencies
+ // cannot always be relied upon. The same reasons apply to /proc/cpuinfo as
+ // well.
+ if (!saw_mhz &&
+ ReadIntFromFile("/sys/devices/system/cpu/cpu0/tsc_freq_khz", &freq)) {
+ // The value is in kHz (as the file name suggests). For example, on a
+ // 2GHz warpstation, the file contains the value "2000000".
+ cpuinfo_cycles_per_second = freq * 1000.0;
+ saw_mhz = true;
+ }
+
+ // If CPU scaling is in effect, we want to use the *maximum* frequency,
+ // not whatever CPU speed some random processor happens to be using now.
+ if (!saw_mhz &&
+ ReadIntFromFile("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq",
+ &freq)) {
+ // The value is in kHz. For example, on a 2GHz warpstation, the file
+ // contains the value "2000000".
+ cpuinfo_cycles_per_second = freq * 1000.0;
+ saw_mhz = true;
+ }
+
+ // Read /proc/cpuinfo for other values, and if there is no cpuinfo_max_freq.
+ const char* pname = "/proc/cpuinfo";
+ int fd = open(pname, O_RDONLY);
+ if (fd == -1) {
+ perror(pname);
+ if (!saw_mhz) {
+ cpuinfo_cycles_per_second = static_cast<double>(EstimateCyclesPerSecond());
+ }
+ return;
+ }
+
+ double bogo_clock = 1.0;
+ bool saw_bogo = false;
+ long max_cpu_id = 0;
+ int num_cpus = 0;
+ line[0] = line[1] = '\0';
+ size_t chars_read = 0;
+ do { // we'll exit when the last read didn't read anything
+ // Move the next line to the beginning of the buffer
+ const size_t oldlinelen = strlen(line);
+ if (sizeof(line) == oldlinelen + 1) // oldlinelen took up entire line
+ line[0] = '\0';
+ else // still other lines left to save
+ memmove(line, line + oldlinelen + 1, sizeof(line) - (oldlinelen + 1));
+ // Terminate the new line, reading more if we can't find the newline
+ char* newline = strchr(line, '\n');
+ if (newline == nullptr) {
+ const size_t linelen = strlen(line);
+ const size_t bytes_to_read = sizeof(line) - 1 - linelen;
+ CHECK(bytes_to_read > 0); // because the memmove recovered >=1 bytes
+ chars_read = read(fd, line + linelen, bytes_to_read);
+ line[linelen + chars_read] = '\0';
+ newline = strchr(line, '\n');
+ }
+ if (newline != nullptr) *newline = '\0';
+
+ // When parsing the "cpu MHz" and "bogomips" (fallback) entries, we only
+ // accept postive values. Some environments (virtual machines) report zero,
+ // which would cause infinite looping in WallTime_Init.
+ if (!saw_mhz && strncasecmp(line, "cpu MHz", sizeof("cpu MHz") - 1) == 0) {
+ const char* freqstr = strchr(line, ':');
+ if (freqstr) {
+ cpuinfo_cycles_per_second = strtod(freqstr + 1, &err) * 1000000.0;
+ if (freqstr[1] != '\0' && *err == '\0' && cpuinfo_cycles_per_second > 0)
+ saw_mhz = true;
+ }
+ } else if (strncasecmp(line, "bogomips", sizeof("bogomips") - 1) == 0) {
+ const char* freqstr = strchr(line, ':');
+ if (freqstr) {
+ bogo_clock = strtod(freqstr + 1, &err) * 1000000.0;
+ if (freqstr[1] != '\0' && *err == '\0' && bogo_clock > 0)
+ saw_bogo = true;
+ }
+ } else if (strncasecmp(line, "processor", sizeof("processor") - 1) == 0) {
+ num_cpus++; // count up every time we see an "processor :" entry
+ const char* freqstr = strchr(line, ':');
+ if (freqstr) {
+ const long cpu_id = strtol(freqstr + 1, &err, 10);
+ if (freqstr[1] != '\0' && *err == '\0' && max_cpu_id < cpu_id)
+ max_cpu_id = cpu_id;
+ }
+ }
+ } while (chars_read > 0);
+ close(fd);
+
+ if (!saw_mhz) {
+ if (saw_bogo) {
+ // If we didn't find anything better, we'll use bogomips, but
+ // we're not happy about it.
+ cpuinfo_cycles_per_second = bogo_clock;
+ } else {
+ // If we don't even have bogomips, we'll use the slow estimation.
+ cpuinfo_cycles_per_second = static_cast<double>(EstimateCyclesPerSecond());
+ }
+ }
+ if (num_cpus == 0) {
+ fprintf(stderr, "Failed to read num. CPUs correctly from /proc/cpuinfo\n");
+ } else {
+ if ((max_cpu_id + 1) != num_cpus) {
+ fprintf(stderr,
+ "CPU ID assignments in /proc/cpuinfo seems messed up."
+ " This is usually caused by a bad BIOS.\n");
+ }
+ cpuinfo_num_cpus = num_cpus;
+ }
+
+#elif defined BENCHMARK_OS_FREEBSD
+// For this sysctl to work, the machine must be configured without
+// SMP, APIC, or APM support. hz should be 64-bit in freebsd 7.0
+// and later. Before that, it's a 32-bit quantity (and gives the
+// wrong answer on machines faster than 2^32 Hz). See
+// http://lists.freebsd.org/pipermail/freebsd-i386/2004-November/001846.html
+// But also compare FreeBSD 7.0:
+// http://fxr.watson.org/fxr/source/i386/i386/tsc.c?v=RELENG70#L223
+// 231 error = sysctl_handle_quad(oidp, &freq, 0, req);
+// To FreeBSD 6.3 (it's the same in 6-STABLE):
+// http://fxr.watson.org/fxr/source/i386/i386/tsc.c?v=RELENG6#L131
+// 139 error = sysctl_handle_int(oidp, &freq, sizeof(freq), req);
+#if __FreeBSD__ >= 7
+ uint64_t hz = 0;
+#else
+ unsigned int hz = 0;
+#endif
+ size_t sz = sizeof(hz);
+ const char* sysctl_path = "machdep.tsc_freq";
+ if (sysctlbyname(sysctl_path, &hz, &sz, nullptr, 0) != 0) {
+ fprintf(stderr, "Unable to determine clock rate from sysctl: %s: %s\n",
+ sysctl_path, strerror(errno));
+ cpuinfo_cycles_per_second = static_cast<double>(EstimateCyclesPerSecond());
+ } else {
+ cpuinfo_cycles_per_second = hz;
+ }
+// TODO: also figure out cpuinfo_num_cpus
+
+#elif defined BENCHMARK_OS_WINDOWS
+ // In NT, read MHz from the registry. If we fail to do so or we're in win9x
+ // then make a crude estimate.
+ DWORD data, data_size = sizeof(data);
+ if (IsWindowsXPOrGreater() &&
+ SUCCEEDED(
+ SHGetValueA(HKEY_LOCAL_MACHINE,
+ "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
+ "~MHz", nullptr, &data, &data_size)))
+ cpuinfo_cycles_per_second = static_cast<double>((int64_t)data * (int64_t)(1000 * 1000)); // was mhz
+ else
+ cpuinfo_cycles_per_second = static_cast<double>(EstimateCyclesPerSecond());
+// TODO: also figure out cpuinfo_num_cpus
+
+#elif defined BENCHMARK_OS_MACOSX
+ // returning "mach time units" per second. the current number of elapsed
+ // mach time units can be found by calling uint64 mach_absolute_time();
+ // while not as precise as actual CPU cycles, it is accurate in the face
+ // of CPU frequency scaling and multi-cpu/core machines.
+ // Our mac users have these types of machines, and accuracy
+ // (i.e. correctness) trumps precision.
+ // See cycleclock.h: CycleClock::Now(), which returns number of mach time
+ // units on Mac OS X.
+ mach_timebase_info_data_t timebase_info;
+ mach_timebase_info(&timebase_info);
+ double mach_time_units_per_nanosecond =
+ static_cast<double>(timebase_info.denom) /
+ static_cast<double>(timebase_info.numer);
+ cpuinfo_cycles_per_second = mach_time_units_per_nanosecond * 1e9;
+
+ int num_cpus = 0;
+ size_t size = sizeof(num_cpus);
+ int numcpus_name[] = {CTL_HW, HW_NCPU};
+ if (::sysctl(numcpus_name, arraysize(numcpus_name), &num_cpus, &size, nullptr, 0) ==
+ 0 &&
+ (size == sizeof(num_cpus)))
+ cpuinfo_num_cpus = num_cpus;
+
+#else
+ // Generic cycles per second counter
+ cpuinfo_cycles_per_second = static_cast<double>(EstimateCyclesPerSecond());
+#endif
+}
+} // end namespace
+
+// getrusage() based implementation of MyCPUUsage
+static double MyCPUUsageRUsage() {
+#ifndef BENCHMARK_OS_WINDOWS
+ struct rusage ru;
+ if (getrusage(RUSAGE_SELF, &ru) == 0) {
+ return (static_cast<double>(ru.ru_utime.tv_sec) +
+ static_cast<double>(ru.ru_utime.tv_usec) * 1e-6 +
+ static_cast<double>(ru.ru_stime.tv_sec) +
+ static_cast<double>(ru.ru_stime.tv_usec) * 1e-6);
+ } else {
+ return 0.0;
+ }
+#else
+ HANDLE proc = GetCurrentProcess();
+ FILETIME creation_time;
+ FILETIME exit_time;
+ FILETIME kernel_time;
+ FILETIME user_time;
+ ULARGE_INTEGER kernel;
+ ULARGE_INTEGER user;
+ GetProcessTimes(proc, &creation_time, &exit_time, &kernel_time, &user_time);
+ kernel.HighPart = kernel_time.dwHighDateTime;
+ kernel.LowPart = kernel_time.dwLowDateTime;
+ user.HighPart = user_time.dwHighDateTime;
+ user.LowPart = user_time.dwLowDateTime;
+ return (static_cast<double>(kernel.QuadPart) +
+ static_cast<double>(user.QuadPart)) * 1e-7;
+#endif // OS_WINDOWS
+}
+
+#ifndef BENCHMARK_OS_WINDOWS
+static bool MyCPUUsageCPUTimeNsLocked(double* cputime) {
+ static int cputime_fd = -1;
+ if (cputime_fd == -1) {
+ cputime_fd = open("/proc/self/cputime_ns", O_RDONLY);
+ if (cputime_fd < 0) {
+ cputime_fd = -1;
+ return false;
+ }
+ }
+ char buff[64];
+ memset(buff, 0, sizeof(buff));
+ if (pread(cputime_fd, buff, sizeof(buff) - 1, 0) <= 0) {
+ close(cputime_fd);
+ cputime_fd = -1;
+ return false;
+ }
+ unsigned long long result = strtoull(buff, nullptr, 0);
+ if (result == (std::numeric_limits<unsigned long long>::max)()) {
+ close(cputime_fd);
+ cputime_fd = -1;
+ return false;
+ }
+ *cputime = static_cast<double>(result) / 1e9;
+ return true;
+}
+#endif // OS_WINDOWS
+
+double MyCPUUsage() {
+#ifndef BENCHMARK_OS_WINDOWS
+ {
+ std::lock_guard<std::mutex> l(cputimens_mutex);
+ static bool use_cputime_ns = true;
+ if (use_cputime_ns) {
+ double value;
+ if (MyCPUUsageCPUTimeNsLocked(&value)) {
+ return value;
+ }
+ // Once MyCPUUsageCPUTimeNsLocked fails once fall back to getrusage().
+ VLOG(1) << "Reading /proc/self/cputime_ns failed. Using getrusage().\n";
+ use_cputime_ns = false;
+ }
+ }
+#endif // OS_WINDOWS
+ return MyCPUUsageRUsage();
+}
+
+double ChildrenCPUUsage() {
+#ifndef BENCHMARK_OS_WINDOWS
+ struct rusage ru;
+ if (getrusage(RUSAGE_CHILDREN, &ru) == 0) {
+ return (static_cast<double>(ru.ru_utime.tv_sec) +
+ static_cast<double>(ru.ru_utime.tv_usec) * 1e-6 +
+ static_cast<double>(ru.ru_stime.tv_sec) +
+ static_cast<double>(ru.ru_stime.tv_usec) * 1e-6);
+ } else {
+ return 0.0;
+ }
+#else
+ // TODO: Not sure what this even means on Windows
+ return 0.0;
+#endif // OS_WINDOWS
+}
+
+double CyclesPerSecond(void) {
+ std::call_once(cpuinfo_init, InitializeSystemInfo);
+ return cpuinfo_cycles_per_second;
+}
+
+int NumCPUs(void) {
+ std::call_once(cpuinfo_init, InitializeSystemInfo);
+ return cpuinfo_num_cpus;
+}
+
+// The ""'s catch people who don't pass in a literal for "str"
+#define strliterallen(str) (sizeof("" str "") - 1)
+
+// Must use a string literal for prefix.
+#define memprefix(str, len, prefix) \
+ ((((len) >= strliterallen(prefix)) && \
+ std::memcmp(str, prefix, strliterallen(prefix)) == 0) \
+ ? str + strliterallen(prefix) \
+ : nullptr)
+
+bool CpuScalingEnabled() {
+#ifndef BENCHMARK_OS_WINDOWS
+ // On Linux, the CPUfreq subsystem exposes CPU information as files on the
+ // local file system. If reading the exported files fails, then we may not be
+ // running on Linux, so we silently ignore all the read errors.
+ for (int cpu = 0, num_cpus = NumCPUs(); cpu < num_cpus; ++cpu) {
+ std::string governor_file = StrCat("/sys/devices/system/cpu/cpu", cpu,
+ "/cpufreq/scaling_governor");
+ FILE* file = fopen(governor_file.c_str(), "r");
+ if (!file) break;
+ char buff[16];
+ size_t bytes_read = fread(buff, 1, sizeof(buff), file);
+ fclose(file);
+ if (memprefix(buff, bytes_read, "performance") == nullptr) return true;
+ }
+#endif
+ return false;
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/sysinfo.h b/3rdparty/benchmark/src/sysinfo.h
new file mode 100644
index 00000000000..eaf77e07ccb
--- /dev/null
+++ b/3rdparty/benchmark/src/sysinfo.h
@@ -0,0 +1,12 @@
+#ifndef BENCHMARK_SYSINFO_H_
+#define BENCHMARK_SYSINFO_H_
+
+namespace benchmark {
+double MyCPUUsage();
+double ChildrenCPUUsage();
+int NumCPUs();
+double CyclesPerSecond();
+bool CpuScalingEnabled();
+} // end namespace benchmark
+
+#endif // BENCHMARK_SYSINFO_H_
diff --git a/3rdparty/benchmark/src/walltime.cc b/3rdparty/benchmark/src/walltime.cc
new file mode 100644
index 00000000000..4bdbaa59859
--- /dev/null
+++ b/3rdparty/benchmark/src/walltime.cc
@@ -0,0 +1,263 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "benchmark/macros.h"
+#include "internal_macros.h"
+#include "walltime.h"
+
+#if defined(BENCHMARK_OS_WINDOWS)
+#include <time.h>
+#include <winsock.h> // for timeval
+#else
+#include <sys/time.h>
+#endif
+
+#include <cstdio>
+#include <cstdint>
+#include <cstring>
+#include <ctime>
+
+#include <atomic>
+#include <chrono>
+#include <limits>
+
+#include "arraysize.h"
+#include "check.h"
+#include "cycleclock.h"
+#include "log.h"
+#include "sysinfo.h"
+
+namespace benchmark {
+namespace walltime {
+
+namespace {
+
+#if defined(HAVE_STEADY_CLOCK)
+template <bool HighResIsSteady = std::chrono::high_resolution_clock::is_steady>
+struct ChooseSteadyClock {
+ typedef std::chrono::high_resolution_clock type;
+};
+
+template <>
+struct ChooseSteadyClock<false> {
+ typedef std::chrono::steady_clock type;
+};
+#endif
+
+struct ChooseClockType {
+#if defined(HAVE_STEADY_CLOCK)
+ typedef ChooseSteadyClock<>::type type;
+#else
+ typedef std::chrono::high_resolution_clock type;
+#endif
+};
+
+class WallTimeImp
+{
+public:
+ WallTime Now();
+
+ static WallTimeImp& GetWallTimeImp() {
+ static WallTimeImp* imp = new WallTimeImp();
+ return *imp;
+ }
+
+private:
+ WallTimeImp();
+ // Helper routines to load/store a float from an AtomicWord. Required because
+ // g++ < 4.7 doesn't support std::atomic<float> correctly. I cannot wait to
+ // get rid of this horror show.
+ void SetDrift(float f) {
+ int32_t w;
+ memcpy(&w, &f, sizeof(f));
+ std::atomic_store(&drift_adjust_, w);
+ }
+
+ float GetDrift() const {
+ float f;
+ int32_t w = std::atomic_load(&drift_adjust_);
+ memcpy(&f, &w, sizeof(f));
+ return f;
+ }
+
+ WallTime Slow() const {
+ struct timeval tv;
+#if defined(BENCHMARK_OS_WINDOWS)
+ FILETIME file_time;
+ SYSTEMTIME system_time;
+ ULARGE_INTEGER ularge;
+ const unsigned __int64 epoch = 116444736000000000LL;
+
+ GetSystemTime(&system_time);
+ SystemTimeToFileTime(&system_time, &file_time);
+ ularge.LowPart = file_time.dwLowDateTime;
+ ularge.HighPart = file_time.dwHighDateTime;
+
+ tv.tv_sec = (long)((ularge.QuadPart - epoch) / (10L * 1000 * 1000));
+ tv.tv_usec = (long)(system_time.wMilliseconds * 1000);
+#else
+ gettimeofday(&tv, nullptr);
+#endif
+ return tv.tv_sec + tv.tv_usec * 1e-6;
+ }
+
+private:
+ static_assert(sizeof(float) <= sizeof(int32_t),
+ "type sizes don't allow the drift_adjust hack");
+
+ WallTime base_walltime_;
+ int64_t base_cycletime_;
+ int64_t cycles_per_second_;
+ double seconds_per_cycle_;
+ uint32_t last_adjust_time_;
+ std::atomic<int32_t> drift_adjust_;
+ int64_t max_interval_cycles_;
+
+ BENCHMARK_DISALLOW_COPY_AND_ASSIGN(WallTimeImp);
+};
+
+
+WallTime WallTimeImp::Now() {
+ WallTime now = 0.0;
+ WallTime result = 0.0;
+ int64_t ct = 0;
+ uint32_t top_bits = 0;
+ do {
+ ct = cycleclock::Now();
+ int64_t cycle_delta = ct - base_cycletime_;
+ result = base_walltime_ + cycle_delta * seconds_per_cycle_;
+
+ top_bits = static_cast<uint32_t>(uint64_t(ct) >> 32);
+ // Recompute drift no more often than every 2^32 cycles.
+ // I.e., @2GHz, ~ every two seconds
+ if (top_bits == last_adjust_time_) { // don't need to recompute drift
+ return result + GetDrift();
+ }
+
+ now = Slow();
+ } while (cycleclock::Now() - ct > max_interval_cycles_);
+ // We are now sure that "now" and "result" were produced within
+ // kMaxErrorInterval of one another.
+
+ SetDrift(static_cast<float>(now - result));
+ last_adjust_time_ = top_bits;
+ return now;
+}
+
+
+WallTimeImp::WallTimeImp()
+ : base_walltime_(0.0), base_cycletime_(0),
+ cycles_per_second_(0), seconds_per_cycle_(0.0),
+ last_adjust_time_(0), drift_adjust_(0),
+ max_interval_cycles_(0) {
+ const double kMaxErrorInterval = 100e-6;
+ cycles_per_second_ = static_cast<int64_t>(CyclesPerSecond());
+ CHECK(cycles_per_second_ != 0);
+ seconds_per_cycle_ = 1.0 / cycles_per_second_;
+ max_interval_cycles_ =
+ static_cast<int64_t>(cycles_per_second_ * kMaxErrorInterval);
+ do {
+ base_cycletime_ = cycleclock::Now();
+ base_walltime_ = Slow();
+ } while (cycleclock::Now() - base_cycletime_ > max_interval_cycles_);
+ // We are now sure that "base_walltime" and "base_cycletime" were produced
+ // within kMaxErrorInterval of one another.
+
+ SetDrift(0.0);
+ last_adjust_time_ = static_cast<uint32_t>(uint64_t(base_cycletime_) >> 32);
+}
+
+WallTime CPUWalltimeNow() {
+ static WallTimeImp& imp = WallTimeImp::GetWallTimeImp();
+ return imp.Now();
+}
+
+WallTime ChronoWalltimeNow() {
+ typedef ChooseClockType::type Clock;
+ typedef std::chrono::duration<WallTime, std::chrono::seconds::period>
+ FPSeconds;
+ static_assert(std::chrono::treat_as_floating_point<WallTime>::value,
+ "This type must be treated as a floating point type.");
+ auto now = Clock::now().time_since_epoch();
+ return std::chrono::duration_cast<FPSeconds>(now).count();
+}
+
+bool UseCpuCycleClock() {
+ bool useWallTime = !CpuScalingEnabled();
+ if (useWallTime) {
+ VLOG(1) << "Using the CPU cycle clock to provide walltime::Now().\n";
+ } else {
+ VLOG(1) << "Using std::chrono to provide walltime::Now().\n";
+ }
+ return useWallTime;
+}
+
+
+} // end anonymous namespace
+
+// WallTimeImp doesn't work when CPU Scaling is enabled. If CPU Scaling is
+// enabled at the start of the program then std::chrono::system_clock is used
+// instead.
+WallTime Now()
+{
+ static bool useCPUClock = UseCpuCycleClock();
+ if (useCPUClock) {
+ return CPUWalltimeNow();
+ } else {
+ return ChronoWalltimeNow();
+ }
+}
+
+} // end namespace walltime
+
+
+namespace {
+
+std::string DateTimeString(bool local) {
+ typedef std::chrono::system_clock Clock;
+ std::time_t now = Clock::to_time_t(Clock::now());
+ char storage[128];
+ std::size_t written;
+
+ if (local) {
+#if defined(BENCHMARK_OS_WINDOWS)
+ written = std::strftime(storage, sizeof(storage), "%x %X", ::localtime(&now));
+#else
+ std::tm timeinfo;
+ std::memset(&timeinfo, 0, sizeof(std::tm));
+ ::localtime_r(&now, &timeinfo);
+ written = std::strftime(storage, sizeof(storage), "%F %T", &timeinfo);
+#endif
+ } else {
+#if defined(BENCHMARK_OS_WINDOWS)
+ written = std::strftime(storage, sizeof(storage), "%x %X", ::gmtime(&now));
+#else
+ std::tm timeinfo;
+ std::memset(&timeinfo, 0, sizeof(std::tm));
+ ::gmtime_r(&now, &timeinfo);
+ written = std::strftime(storage, sizeof(storage), "%F %T", &timeinfo);
+#endif
+ }
+ CHECK(written < arraysize(storage));
+ ((void)written); // prevent unused variable in optimized mode.
+ return std::string(storage);
+}
+
+} // end namespace
+
+std::string LocalDateTimeString() {
+ return DateTimeString(true);
+}
+
+} // end namespace benchmark
diff --git a/3rdparty/benchmark/src/walltime.h b/3rdparty/benchmark/src/walltime.h
new file mode 100644
index 00000000000..38c26f33213
--- /dev/null
+++ b/3rdparty/benchmark/src/walltime.h
@@ -0,0 +1,17 @@
+#ifndef BENCHMARK_WALLTIME_H_
+#define BENCHMARK_WALLTIME_H_
+
+#include <string>
+
+namespace benchmark {
+typedef double WallTime;
+
+namespace walltime {
+WallTime Now();
+} // end namespace walltime
+
+std::string LocalDateTimeString();
+
+} // end namespace benchmark
+
+#endif // BENCHMARK_WALLTIME_H_
diff --git a/3rdparty/benchmark/test/CMakeLists.txt b/3rdparty/benchmark/test/CMakeLists.txt
new file mode 100644
index 00000000000..7e4f4854710
--- /dev/null
+++ b/3rdparty/benchmark/test/CMakeLists.txt
@@ -0,0 +1,89 @@
+# Enable the tests
+
+find_package(Threads REQUIRED)
+
+set(CXX03_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REPLACE "-std=c++11" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}")
+string(REPLACE "-std=c++0x" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}")
+
+macro(compile_benchmark_test name)
+ add_executable(${name} "${name}.cc")
+ target_link_libraries(${name} benchmark ${CMAKE_THREAD_LIBS_INIT})
+endmacro(compile_benchmark_test)
+
+# Demonstration executable
+compile_benchmark_test(benchmark_test)
+add_test(benchmark benchmark_test --benchmark_min_time=0.01)
+
+compile_benchmark_test(filter_test)
+macro(add_filter_test name filter expect)
+ add_test(${name} filter_test --benchmark_min_time=0.01 --benchmark_filter=${filter} ${expect})
+endmacro(add_filter_test)
+
+add_filter_test(filter_simple "Foo" 3)
+add_filter_test(filter_suffix "BM_.*" 4)
+add_filter_test(filter_regex_all ".*" 5)
+add_filter_test(filter_regex_blank "" 5)
+add_filter_test(filter_regex_none "monkey" 0)
+add_filter_test(filter_regex_wildcard ".*Foo.*" 3)
+add_filter_test(filter_regex_begin "^BM_.*" 4)
+add_filter_test(filter_regex_begin2 "^N" 1)
+add_filter_test(filter_regex_end ".*Ba$" 1)
+
+compile_benchmark_test(options_test)
+add_test(options_benchmarks options_test --benchmark_min_time=0.01)
+
+compile_benchmark_test(basic_test)
+add_test(basic_benchmark basic_test --benchmark_min_time=0.01)
+
+compile_benchmark_test(fixture_test)
+add_test(fixture_test fixture_test --benchmark_min_time=0.01)
+
+compile_benchmark_test(cxx03_test)
+set_target_properties(cxx03_test
+ PROPERTIES COMPILE_FLAGS "${CXX03_FLAGS}")
+add_test(cxx03 cxx03_test --benchmark_min_time=0.01)
+
+# Add the coverage command(s)
+if(CMAKE_BUILD_TYPE)
+ string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
+endif()
+if (${CMAKE_BUILD_TYPE_LOWER} MATCHES "coverage")
+ find_program(GCOV gcov)
+ find_program(LCOV lcov)
+ find_program(GENHTML genhtml)
+ find_program(CTEST ctest)
+ if (GCOV AND LCOV AND GENHTML AND CTEST AND HAVE_CXX_FLAG_COVERAGE)
+ add_custom_command(
+ OUTPUT ${CMAKE_BINARY_DIR}/lcov/index.html
+ COMMAND ${LCOV} -q -z -d .
+ COMMAND ${LCOV} -q --no-external -c -b "${CMAKE_SOURCE_DIR}" -d . -o before.lcov -i
+ COMMAND ${CTEST} --force-new-ctest-process
+ COMMAND ${LCOV} -q --no-external -c -b "${CMAKE_SOURCE_DIR}" -d . -o after.lcov
+ COMMAND ${LCOV} -q -a before.lcov -a after.lcov --output-file final.lcov
+ COMMAND ${LCOV} -q -r final.lcov "'${CMAKE_SOURCE_DIR}/test/*'" -o final.lcov
+ COMMAND ${GENHTML} final.lcov -o lcov --demangle-cpp --sort -p "${CMAKE_BINARY_DIR}" -t benchmark
+ DEPENDS filter_test benchmark_test options_test basic_test fixture_test cxx03_test
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMENT "Running LCOV"
+ )
+ add_custom_target(coverage
+ DEPENDS ${CMAKE_BINARY_DIR}/lcov/index.html
+ COMMENT "LCOV report at lcov/index.html"
+ )
+ message(STATUS "Coverage command added")
+ else()
+ if (HAVE_CXX_FLAG_COVERAGE)
+ set(CXX_FLAG_COVERAGE_MESSAGE supported)
+ else()
+ set(CXX_FLAG_COVERAGE_MESSAGE unavailable)
+ endif()
+ message(WARNING
+ "Coverage not available:\n"
+ " gcov: ${GCOV}\n"
+ " lcov: ${LCOV}\n"
+ " genhtml: ${GENHTML}\n"
+ " ctest: ${CTEST}\n"
+ " --coverage flag: ${CXX_FLAG_COVERAGE_MESSAGE}")
+ endif()
+endif()
diff --git a/3rdparty/benchmark/test/basic_test.cc b/3rdparty/benchmark/test/basic_test.cc
new file mode 100644
index 00000000000..3435415447f
--- /dev/null
+++ b/3rdparty/benchmark/test/basic_test.cc
@@ -0,0 +1,102 @@
+
+#include "benchmark/benchmark_api.h"
+
+#define BASIC_BENCHMARK_TEST(x) \
+ BENCHMARK(x)->Arg(8)->Arg(512)->Arg(8192)
+
+void BM_empty(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ benchmark::DoNotOptimize(state.iterations());
+ }
+}
+BENCHMARK(BM_empty);
+BENCHMARK(BM_empty)->ThreadPerCpu();
+
+void BM_spin_empty(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ for (int x = 0; x < state.range_x(); ++x) {
+ benchmark::DoNotOptimize(x);
+ }
+ }
+}
+BASIC_BENCHMARK_TEST(BM_spin_empty);
+BASIC_BENCHMARK_TEST(BM_spin_empty)->ThreadPerCpu();
+
+void BM_spin_pause_before(benchmark::State& state) {
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+ while(state.KeepRunning()) {
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+ }
+}
+BASIC_BENCHMARK_TEST(BM_spin_pause_before);
+BASIC_BENCHMARK_TEST(BM_spin_pause_before)->ThreadPerCpu();
+
+
+void BM_spin_pause_during(benchmark::State& state) {
+ while(state.KeepRunning()) {
+ state.PauseTiming();
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+ state.ResumeTiming();
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+ }
+}
+BASIC_BENCHMARK_TEST(BM_spin_pause_during);
+BASIC_BENCHMARK_TEST(BM_spin_pause_during)->ThreadPerCpu();
+
+void BM_pause_during(benchmark::State& state) {
+ while(state.KeepRunning()) {
+ state.PauseTiming();
+ state.ResumeTiming();
+ }
+}
+BENCHMARK(BM_pause_during);
+BENCHMARK(BM_pause_during)->ThreadPerCpu();
+BENCHMARK(BM_pause_during)->UseRealTime();
+BENCHMARK(BM_pause_during)->UseRealTime()->ThreadPerCpu();
+
+void BM_spin_pause_after(benchmark::State& state) {
+ while(state.KeepRunning()) {
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+ }
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+}
+BASIC_BENCHMARK_TEST(BM_spin_pause_after);
+BASIC_BENCHMARK_TEST(BM_spin_pause_after)->ThreadPerCpu();
+
+
+void BM_spin_pause_before_and_after(benchmark::State& state) {
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+ while(state.KeepRunning()) {
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+ }
+ for (int i = 0; i < state.range_x(); ++i) {
+ benchmark::DoNotOptimize(i);
+ }
+}
+BASIC_BENCHMARK_TEST(BM_spin_pause_before_and_after);
+BASIC_BENCHMARK_TEST(BM_spin_pause_before_and_after)->ThreadPerCpu();
+
+
+void BM_empty_stop_start(benchmark::State& state) {
+ while (state.KeepRunning()) { }
+}
+BENCHMARK(BM_empty_stop_start);
+BENCHMARK(BM_empty_stop_start)->ThreadPerCpu();
+
+BENCHMARK_MAIN()
diff --git a/3rdparty/benchmark/test/benchmark_test.cc b/3rdparty/benchmark/test/benchmark_test.cc
new file mode 100644
index 00000000000..2d268ce4121
--- /dev/null
+++ b/3rdparty/benchmark/test/benchmark_test.cc
@@ -0,0 +1,154 @@
+#include "benchmark/benchmark.h"
+
+#include <assert.h>
+#include <math.h>
+#include <stdint.h>
+
+#include <cstdlib>
+#include <iostream>
+#include <limits>
+#include <list>
+#include <map>
+#include <mutex>
+#include <set>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#if defined(__GNUC__)
+# define BENCHMARK_NOINLINE __attribute__((noinline))
+#else
+# define BENCHMARK_NOINLINE
+#endif
+
+namespace {
+
+int BENCHMARK_NOINLINE Factorial(uint32_t n) {
+ return (n == 1) ? 1 : n * Factorial(n - 1);
+}
+
+double CalculatePi(int depth) {
+ double pi = 0.0;
+ for (int i = 0; i < depth; ++i) {
+ double numerator = static_cast<double>(((i % 2) * 2) - 1);
+ double denominator = static_cast<double>((2 * i) - 1);
+ pi += numerator / denominator;
+ }
+ return (pi - 1.0) * 4;
+}
+
+std::set<int> ConstructRandomSet(int size) {
+ std::set<int> s;
+ for (int i = 0; i < size; ++i)
+ s.insert(i);
+ return s;
+}
+
+std::mutex test_vector_mu;
+std::vector<int>* test_vector = nullptr;
+
+} // end namespace
+
+static void BM_Factorial(benchmark::State& state) {
+ int fac_42 = 0;
+ while (state.KeepRunning())
+ fac_42 = Factorial(8);
+ // Prevent compiler optimizations
+ std::stringstream ss;
+ ss << fac_42;
+ state.SetLabel(ss.str());
+}
+BENCHMARK(BM_Factorial);
+BENCHMARK(BM_Factorial)->UseRealTime();
+
+static void BM_CalculatePiRange(benchmark::State& state) {
+ double pi = 0.0;
+ while (state.KeepRunning())
+ pi = CalculatePi(state.range_x());
+ std::stringstream ss;
+ ss << pi;
+ state.SetLabel(ss.str());
+}
+BENCHMARK_RANGE(BM_CalculatePiRange, 1, 1024 * 1024);
+
+static void BM_CalculatePi(benchmark::State& state) {
+ static const int depth = 1024;
+ while (state.KeepRunning()) {
+ benchmark::DoNotOptimize(CalculatePi(depth));
+ }
+}
+BENCHMARK(BM_CalculatePi)->Threads(8);
+BENCHMARK(BM_CalculatePi)->ThreadRange(1, 32);
+BENCHMARK(BM_CalculatePi)->ThreadPerCpu();
+
+static void BM_SetInsert(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ state.PauseTiming();
+ std::set<int> data = ConstructRandomSet(state.range_x());
+ state.ResumeTiming();
+ for (int j = 0; j < state.range_y(); ++j)
+ data.insert(rand());
+ }
+ state.SetItemsProcessed(state.iterations() * state.range_y());
+ state.SetBytesProcessed(state.iterations() * state.range_y() * sizeof(int));
+}
+BENCHMARK(BM_SetInsert)->RangePair(1<<10,8<<10, 1,10);
+
+template<typename Container, typename ValueType = typename Container::value_type>
+static void BM_Sequential(benchmark::State& state) {
+ ValueType v = 42;
+ while (state.KeepRunning()) {
+ Container c;
+ for (int i = state.range_x(); --i; )
+ c.push_back(v);
+ }
+ const size_t items_processed = state.iterations() * state.range_x();
+ state.SetItemsProcessed(items_processed);
+ state.SetBytesProcessed(items_processed * sizeof(v));
+}
+BENCHMARK_TEMPLATE2(BM_Sequential, std::vector<int>, int)->Range(1 << 0, 1 << 10);
+BENCHMARK_TEMPLATE(BM_Sequential, std::list<int>)->Range(1 << 0, 1 << 10);
+// Test the variadic version of BENCHMARK_TEMPLATE in C++11 and beyond.
+#if __cplusplus >= 201103L
+BENCHMARK_TEMPLATE(BM_Sequential, std::vector<int>, int)->Arg(512);
+#endif
+
+static void BM_StringCompare(benchmark::State& state) {
+ std::string s1(state.range_x(), '-');
+ std::string s2(state.range_x(), '-');
+ while (state.KeepRunning())
+ benchmark::DoNotOptimize(s1.compare(s2));
+}
+BENCHMARK(BM_StringCompare)->Range(1, 1<<20);
+
+static void BM_SetupTeardown(benchmark::State& state) {
+ if (state.thread_index == 0) {
+ // No need to lock test_vector_mu here as this is running single-threaded.
+ test_vector = new std::vector<int>();
+ }
+ int i = 0;
+ while (state.KeepRunning()) {
+ std::lock_guard<std::mutex> l(test_vector_mu);
+ if (i%2 == 0)
+ test_vector->push_back(i);
+ else
+ test_vector->pop_back();
+ ++i;
+ }
+ if (state.thread_index == 0) {
+ delete test_vector;
+ }
+}
+BENCHMARK(BM_SetupTeardown)->ThreadPerCpu();
+
+static void BM_LongTest(benchmark::State& state) {
+ double tracker = 0.0;
+ while (state.KeepRunning()) {
+ for (int i = 0; i < state.range_x(); ++i)
+ benchmark::DoNotOptimize(tracker += i);
+ }
+}
+BENCHMARK(BM_LongTest)->Range(1<<16,1<<28);
+
+BENCHMARK_MAIN()
+
diff --git a/3rdparty/benchmark/test/cxx03_test.cc b/3rdparty/benchmark/test/cxx03_test.cc
new file mode 100644
index 00000000000..56779d66021
--- /dev/null
+++ b/3rdparty/benchmark/test/cxx03_test.cc
@@ -0,0 +1,31 @@
+
+#include <cstddef>
+
+#include "benchmark/benchmark.h"
+
+#if __cplusplus >= 201103L
+#error C++11 or greater detected. Should be C++03.
+#endif
+
+void BM_empty(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ volatile std::size_t x = state.iterations();
+ ((void)x);
+ }
+}
+BENCHMARK(BM_empty);
+
+template <class T, class U>
+void BM_template2(benchmark::State& state) {
+ BM_empty(state);
+}
+BENCHMARK_TEMPLATE2(BM_template2, int, long);
+
+template <class T>
+void BM_template1(benchmark::State& state) {
+ BM_empty(state);
+}
+BENCHMARK_TEMPLATE(BM_template1, long);
+BENCHMARK_TEMPLATE1(BM_template1, int);
+
+BENCHMARK_MAIN()
diff --git a/3rdparty/benchmark/test/filter_test.cc b/3rdparty/benchmark/test/filter_test.cc
new file mode 100644
index 00000000000..2a278ff4a77
--- /dev/null
+++ b/3rdparty/benchmark/test/filter_test.cc
@@ -0,0 +1,91 @@
+#include "benchmark/benchmark.h"
+
+#include <cassert>
+#include <cmath>
+#include <cstdint>
+#include <cstdlib>
+
+#include <iostream>
+#include <limits>
+#include <sstream>
+#include <string>
+
+namespace {
+
+class TestReporter : public benchmark::ConsoleReporter {
+ public:
+ virtual bool ReportContext(const Context& context) {
+ return ConsoleReporter::ReportContext(context);
+ };
+
+ virtual void ReportRuns(const std::vector<Run>& report) {
+ ++count_;
+ ConsoleReporter::ReportRuns(report);
+ };
+
+ TestReporter() : count_(0) {}
+
+ virtual ~TestReporter() {}
+
+ size_t GetCount() const {
+ return count_;
+ }
+
+ private:
+ mutable size_t count_;
+};
+
+} // end namespace
+
+
+static void NoPrefix(benchmark::State& state) {
+ while (state.KeepRunning()) {}
+}
+BENCHMARK(NoPrefix);
+
+static void BM_Foo(benchmark::State& state) {
+ while (state.KeepRunning()) {}
+}
+BENCHMARK(BM_Foo);
+
+
+static void BM_Bar(benchmark::State& state) {
+ while (state.KeepRunning()) {}
+}
+BENCHMARK(BM_Bar);
+
+
+static void BM_FooBar(benchmark::State& state) {
+ while (state.KeepRunning()) {}
+}
+BENCHMARK(BM_FooBar);
+
+
+static void BM_FooBa(benchmark::State& state) {
+ while (state.KeepRunning()) {}
+}
+BENCHMARK(BM_FooBa);
+
+
+
+int main(int argc, char* argv[]) {
+ benchmark::Initialize(&argc, argv);
+
+ TestReporter test_reporter;
+ benchmark::RunSpecifiedBenchmarks(&test_reporter);
+
+ if (argc == 2) {
+ // Make sure we ran all of the tests
+ std::stringstream ss(argv[1]);
+ size_t expected;
+ ss >> expected;
+
+ const size_t count = test_reporter.GetCount();
+ if (count != expected) {
+ std::cerr << "ERROR: Expected " << expected << " tests to be ran but only "
+ << count << " completed" << std::endl;
+ return -1;
+ }
+ }
+ return 0;
+}
diff --git a/3rdparty/benchmark/test/fixture_test.cc b/3rdparty/benchmark/test/fixture_test.cc
new file mode 100644
index 00000000000..8aea6ef0601
--- /dev/null
+++ b/3rdparty/benchmark/test/fixture_test.cc
@@ -0,0 +1,42 @@
+
+#include "benchmark/benchmark.h"
+
+#include <cassert>
+
+class MyFixture : public ::benchmark::Fixture
+{
+public:
+ void SetUp() {
+ data = new int(42);
+ }
+
+ void TearDown() {
+ assert(data != nullptr);
+ delete data;
+ data = nullptr;
+ }
+
+ ~MyFixture() {
+ assert(data == nullptr);
+ }
+
+ int* data;
+};
+
+
+BENCHMARK_F(MyFixture, Foo)(benchmark::State& st) {
+ assert(data != nullptr);
+ assert(*data == 42);
+ while (st.KeepRunning()) {
+ }
+}
+
+BENCHMARK_DEFINE_F(MyFixture, Bar)(benchmark::State& st) {
+ while (st.KeepRunning()) {
+ }
+ st.SetItemsProcessed(st.range_x());
+}
+BENCHMARK_REGISTER_F(MyFixture, Bar)->Arg(42);
+
+
+BENCHMARK_MAIN()
diff --git a/3rdparty/benchmark/test/options_test.cc b/3rdparty/benchmark/test/options_test.cc
new file mode 100644
index 00000000000..d4c682d4ece
--- /dev/null
+++ b/3rdparty/benchmark/test/options_test.cc
@@ -0,0 +1,26 @@
+#include "benchmark/benchmark_api.h"
+
+void BM_basic(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ }
+}
+BENCHMARK(BM_basic);
+BENCHMARK(BM_basic)->Arg(42);
+BENCHMARK(BM_basic)->Range(1, 8);
+BENCHMARK(BM_basic)->DenseRange(10, 15);
+BENCHMARK(BM_basic)->ArgPair(42, 42);
+BENCHMARK(BM_basic)->RangePair(64, 512, 64, 512);
+BENCHMARK(BM_basic)->MinTime(0.7);
+BENCHMARK(BM_basic)->UseRealTime();
+BENCHMARK(BM_basic)->ThreadRange(2, 4);
+BENCHMARK(BM_basic)->ThreadPerCpu();
+
+void CustomArgs(benchmark::internal::Benchmark* b) {
+ for (int i = 0; i < 10; ++i) {
+ b->Arg(i);
+ }
+}
+
+BENCHMARK(BM_basic)->Apply(CustomArgs);
+
+BENCHMARK_MAIN()
diff --git a/3rdparty/bgfx/.appveyor.yml b/3rdparty/bgfx/.appveyor.yml
new file mode 100644
index 00000000000..852cf22cf98
--- /dev/null
+++ b/3rdparty/bgfx/.appveyor.yml
@@ -0,0 +1,22 @@
+shallow_clone: true
+
+os:
+ - Visual Studio 2015
+
+environment:
+ matrix:
+ - TOOLSET: vs2010
+ - TOOLSET: vs2012
+ - TOOLSET: vs2013
+ - TOOLSET: vs2015
+
+configuration:
+ - Debug
+ - Release
+
+install:
+ - git clone https://github.com/bkaradzic/bx ..\bx
+ - ..\bx\tools\bin\windows\genie --with-tools %TOOLSET%
+
+build:
+ project: .build/projects/$(TOOLSET)/bgfx.sln
diff --git a/3rdparty/bgfx/.travis.yml b/3rdparty/bgfx/.travis.yml
new file mode 100644
index 00000000000..8c081703032
--- /dev/null
+++ b/3rdparty/bgfx/.travis.yml
@@ -0,0 +1,22 @@
+language: cpp
+matrix:
+ include:
+ - compiler: gcc
+ os: linux
+ - compiler: clang
+ os: osx
+
+before_script:
+ git clone https://github.com/bkaradzic/bx ../bx
+
+script:
+ make build
+
+branches:
+ only:
+ - master
+
+notifications:
+ email: false
+
+osx_image: xcode7.3
diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h
index 17e646e0773..7daa83b3604 100644
--- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h
+++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h
@@ -42,6 +42,7 @@
#define VS2008_SAL_COMPAT
// BK - SAL compatibility for VS2008
+#if _MSC_VER < 1600
#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
extern "C++" { \
inline ENUMTYPE operator | (ENUMTYPE _a, ENUMTYPE _b) { return ENUMTYPE ( ( (int) _a) | ( (int)_b) ); } \
@@ -52,6 +53,7 @@
inline ENUMTYPE operator ^ (ENUMTYPE _a, ENUMTYPE _b) { return ENUMTYPE ( ( (int) _a) ^ ( (int)_b) ); } \
inline ENUMTYPE operator ^= (ENUMTYPE &_a, ENUMTYPE _b) { return (ENUMTYPE &)( ( (int &)_a) ^= ( (int)_b) ); } \
}
+#endif // _MSC_VER < 1600
#undef _Out_
#define _Out_
diff --git a/3rdparty/bgfx/3rdparty/etc2/LICENSE.txt b/3rdparty/bgfx/3rdparty/etc2/LICENSE.txt
new file mode 100644
index 00000000000..2254f9ece88
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/LICENSE.txt
@@ -0,0 +1,24 @@
+Copyright (c) 2013, Bartosz Taudul <wolf.pld@gmail.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/3rdparty/bgfx/3rdparty/etc2/Math.hpp b/3rdparty/bgfx/3rdparty/etc2/Math.hpp
new file mode 100644
index 00000000000..3a92a2e7317
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/Math.hpp
@@ -0,0 +1,90 @@
+#ifndef __DARKRL__MATH_HPP__
+#define __DARKRL__MATH_HPP__
+
+#include <algorithm>
+#include <math.h>
+
+#include "Types.hpp"
+
+template<typename T>
+inline T AlignPOT( T val )
+{
+ if( val == 0 ) return 1;
+ val--;
+ for( unsigned int i=1; i<sizeof( T ) * 8; i <<= 1 )
+ {
+ val |= val >> i;
+ }
+ return val + 1;
+}
+
+inline int CountSetBits( uint32 val )
+{
+ val -= ( val >> 1 ) & 0x55555555;
+ val = ( ( val >> 2 ) & 0x33333333 ) + ( val & 0x33333333 );
+ val = ( ( val >> 4 ) + val ) & 0x0f0f0f0f;
+ val += val >> 8;
+ val += val >> 16;
+ return val & 0x0000003f;
+}
+
+inline int CountLeadingZeros( uint32 val )
+{
+ val |= val >> 1;
+ val |= val >> 2;
+ val |= val >> 4;
+ val |= val >> 8;
+ val |= val >> 16;
+ return 32 - CountSetBits( val );
+}
+
+inline float sRGB2linear( float v )
+{
+ const float a = 0.055f;
+ if( v <= 0.04045f )
+ {
+ return v / 12.92f;
+ }
+ else
+ {
+ return powf( ( v + a ) / ( 1 + a ), 2.4f );
+ }
+}
+
+inline float linear2sRGB( float v )
+{
+ const float a = 0.055f;
+ if( v <= 0.0031308f )
+ {
+ return 12.92f * v;
+ }
+ else
+ {
+ return ( 1 + a ) * pow( v, 1/2.4f ) - a;
+ }
+}
+
+template<class T>
+inline T SmoothStep( T x )
+{
+ return x*x*(3-2*x);
+}
+
+inline uint8 clampu8( int32 val )
+{
+ return std::min( std::max( 0, val ), 255 );
+}
+
+template<class T>
+inline T sq( T val )
+{
+ return val * val;
+}
+
+static inline int mul8bit( int a, int b )
+{
+ int t = a*b + 128;
+ return ( t + ( t >> 8 ) ) >> 8;
+}
+
+#endif
diff --git a/3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp b/3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp
new file mode 100644
index 00000000000..7e6addbcdc2
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp
@@ -0,0 +1,51 @@
+#ifndef __PROCESSCOMMON_HPP__
+#define __PROCESSCOMMON_HPP__
+
+#include <assert.h>
+#include <stddef.h>
+
+#include "Types.hpp"
+
+template<class T>
+static size_t GetLeastError( const T* err, size_t num )
+{
+ size_t idx = 0;
+ for( size_t i=1; i<num; i++ )
+ {
+ if( err[i] < err[idx] )
+ {
+ idx = i;
+ }
+ }
+ return idx;
+}
+
+static uint64 FixByteOrder( uint64 d )
+{
+ return ( ( d & 0x00000000FFFFFFFF ) ) |
+ ( ( d & 0xFF00000000000000 ) >> 24 ) |
+ ( ( d & 0x000000FF00000000 ) << 24 ) |
+ ( ( d & 0x00FF000000000000 ) >> 8 ) |
+ ( ( d & 0x0000FF0000000000 ) << 8 );
+}
+
+template<class T, class S>
+static uint64 EncodeSelectors( uint64 d, const T terr[2][8], const S tsel[16][8], const uint32* id )
+{
+ size_t tidx[2];
+ tidx[0] = GetLeastError( terr[0], 8 );
+ tidx[1] = GetLeastError( terr[1], 8 );
+
+ d |= tidx[0] << 26;
+ d |= tidx[1] << 29;
+ for( int i=0; i<16; i++ )
+ {
+ uint64 t = tsel[i][tidx[id[i]%2]];
+ d |= ( t & 0x1 ) << ( i + 32 );
+ d |= ( t & 0x2 ) << ( i + 47 );
+ }
+
+ return d;
+}
+
+#endif
diff --git a/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp b/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp
new file mode 100644
index 00000000000..de03845c838
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp
@@ -0,0 +1,719 @@
+#include <string.h>
+
+#include "Math.hpp"
+#include "ProcessCommon.hpp"
+#include "ProcessRGB.hpp"
+#include "Tables.hpp"
+#include "Types.hpp"
+#include "Vector.hpp"
+
+#include <bx/endian.h>
+
+#ifdef __SSE4_1__
+# ifdef _MSC_VER
+# include <intrin.h>
+# include <Windows.h>
+# else
+# include <x86intrin.h>
+# endif
+#endif
+
+namespace
+{
+
+typedef uint16 v4i[4];
+
+void Average( const uint8* data, v4i* a )
+{
+#ifdef __SSE4_1__
+ __m128i d0 = _mm_loadu_si128(((__m128i*)data) + 0);
+ __m128i d1 = _mm_loadu_si128(((__m128i*)data) + 1);
+ __m128i d2 = _mm_loadu_si128(((__m128i*)data) + 2);
+ __m128i d3 = _mm_loadu_si128(((__m128i*)data) + 3);
+
+ __m128i d0l = _mm_unpacklo_epi8(d0, _mm_setzero_si128());
+ __m128i d0h = _mm_unpackhi_epi8(d0, _mm_setzero_si128());
+ __m128i d1l = _mm_unpacklo_epi8(d1, _mm_setzero_si128());
+ __m128i d1h = _mm_unpackhi_epi8(d1, _mm_setzero_si128());
+ __m128i d2l = _mm_unpacklo_epi8(d2, _mm_setzero_si128());
+ __m128i d2h = _mm_unpackhi_epi8(d2, _mm_setzero_si128());
+ __m128i d3l = _mm_unpacklo_epi8(d3, _mm_setzero_si128());
+ __m128i d3h = _mm_unpackhi_epi8(d3, _mm_setzero_si128());
+
+ __m128i sum0 = _mm_add_epi16(d0l, d1l);
+ __m128i sum1 = _mm_add_epi16(d0h, d1h);
+ __m128i sum2 = _mm_add_epi16(d2l, d3l);
+ __m128i sum3 = _mm_add_epi16(d2h, d3h);
+
+ __m128i sum0l = _mm_unpacklo_epi16(sum0, _mm_setzero_si128());
+ __m128i sum0h = _mm_unpackhi_epi16(sum0, _mm_setzero_si128());
+ __m128i sum1l = _mm_unpacklo_epi16(sum1, _mm_setzero_si128());
+ __m128i sum1h = _mm_unpackhi_epi16(sum1, _mm_setzero_si128());
+ __m128i sum2l = _mm_unpacklo_epi16(sum2, _mm_setzero_si128());
+ __m128i sum2h = _mm_unpackhi_epi16(sum2, _mm_setzero_si128());
+ __m128i sum3l = _mm_unpacklo_epi16(sum3, _mm_setzero_si128());
+ __m128i sum3h = _mm_unpackhi_epi16(sum3, _mm_setzero_si128());
+
+ __m128i b0 = _mm_add_epi32(sum0l, sum0h);
+ __m128i b1 = _mm_add_epi32(sum1l, sum1h);
+ __m128i b2 = _mm_add_epi32(sum2l, sum2h);
+ __m128i b3 = _mm_add_epi32(sum3l, sum3h);
+
+ __m128i a0 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b2, b3), _mm_set1_epi32(4)), 3);
+ __m128i a1 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b0, b1), _mm_set1_epi32(4)), 3);
+ __m128i a2 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b1, b3), _mm_set1_epi32(4)), 3);
+ __m128i a3 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b0, b2), _mm_set1_epi32(4)), 3);
+
+ _mm_storeu_si128((__m128i*)&a[0], _mm_packus_epi32(_mm_shuffle_epi32(a0, _MM_SHUFFLE(3, 0, 1, 2)), _mm_shuffle_epi32(a1, _MM_SHUFFLE(3, 0, 1, 2))));
+ _mm_storeu_si128((__m128i*)&a[2], _mm_packus_epi32(_mm_shuffle_epi32(a2, _MM_SHUFFLE(3, 0, 1, 2)), _mm_shuffle_epi32(a3, _MM_SHUFFLE(3, 0, 1, 2))));
+#else
+ uint32 r[4];
+ uint32 g[4];
+ uint32 b[4];
+
+ memset(r, 0, sizeof(r));
+ memset(g, 0, sizeof(g));
+ memset(b, 0, sizeof(b));
+
+ for( int j=0; j<4; j++ )
+ {
+ for( int i=0; i<4; i++ )
+ {
+ int index = (j & 2) + (i >> 1);
+ b[index] += *data++;
+ g[index] += *data++;
+ r[index] += *data++;
+ data++;
+ }
+ }
+
+ a[0][0] = uint16( (r[2] + r[3] + 4) / 8 );
+ a[0][1] = uint16( (g[2] + g[3] + 4) / 8 );
+ a[0][2] = uint16( (b[2] + b[3] + 4) / 8 );
+ a[0][3] = 0;
+ a[1][0] = uint16( (r[0] + r[1] + 4) / 8 );
+ a[1][1] = uint16( (g[0] + g[1] + 4) / 8 );
+ a[1][2] = uint16( (b[0] + b[1] + 4) / 8 );
+ a[1][3] = 0;
+ a[2][0] = uint16( (r[1] + r[3] + 4) / 8 );
+ a[2][1] = uint16( (g[1] + g[3] + 4) / 8 );
+ a[2][2] = uint16( (b[1] + b[3] + 4) / 8 );
+ a[2][3] = 0;
+ a[3][0] = uint16( (r[0] + r[2] + 4) / 8 );
+ a[3][1] = uint16( (g[0] + g[2] + 4) / 8 );
+ a[3][2] = uint16( (b[0] + b[2] + 4) / 8 );
+ a[3][3] = 0;
+#endif
+}
+
+void CalcErrorBlock( const uint8* data, uint err[4][4] )
+{
+#ifdef __SSE4_1__
+ __m128i d0 = _mm_loadu_si128(((__m128i*)data) + 0);
+ __m128i d1 = _mm_loadu_si128(((__m128i*)data) + 1);
+ __m128i d2 = _mm_loadu_si128(((__m128i*)data) + 2);
+ __m128i d3 = _mm_loadu_si128(((__m128i*)data) + 3);
+
+ __m128i dm0 = _mm_and_si128(d0, _mm_set1_epi32(0x00FFFFFF));
+ __m128i dm1 = _mm_and_si128(d1, _mm_set1_epi32(0x00FFFFFF));
+ __m128i dm2 = _mm_and_si128(d2, _mm_set1_epi32(0x00FFFFFF));
+ __m128i dm3 = _mm_and_si128(d3, _mm_set1_epi32(0x00FFFFFF));
+
+ __m128i d0l = _mm_unpacklo_epi8(dm0, _mm_setzero_si128());
+ __m128i d0h = _mm_unpackhi_epi8(dm0, _mm_setzero_si128());
+ __m128i d1l = _mm_unpacklo_epi8(dm1, _mm_setzero_si128());
+ __m128i d1h = _mm_unpackhi_epi8(dm1, _mm_setzero_si128());
+ __m128i d2l = _mm_unpacklo_epi8(dm2, _mm_setzero_si128());
+ __m128i d2h = _mm_unpackhi_epi8(dm2, _mm_setzero_si128());
+ __m128i d3l = _mm_unpacklo_epi8(dm3, _mm_setzero_si128());
+ __m128i d3h = _mm_unpackhi_epi8(dm3, _mm_setzero_si128());
+
+ __m128i sum0 = _mm_add_epi16(d0l, d1l);
+ __m128i sum1 = _mm_add_epi16(d0h, d1h);
+ __m128i sum2 = _mm_add_epi16(d2l, d3l);
+ __m128i sum3 = _mm_add_epi16(d2h, d3h);
+
+ __m128i sum0l = _mm_unpacklo_epi16(sum0, _mm_setzero_si128());
+ __m128i sum0h = _mm_unpackhi_epi16(sum0, _mm_setzero_si128());
+ __m128i sum1l = _mm_unpacklo_epi16(sum1, _mm_setzero_si128());
+ __m128i sum1h = _mm_unpackhi_epi16(sum1, _mm_setzero_si128());
+ __m128i sum2l = _mm_unpacklo_epi16(sum2, _mm_setzero_si128());
+ __m128i sum2h = _mm_unpackhi_epi16(sum2, _mm_setzero_si128());
+ __m128i sum3l = _mm_unpacklo_epi16(sum3, _mm_setzero_si128());
+ __m128i sum3h = _mm_unpackhi_epi16(sum3, _mm_setzero_si128());
+
+ __m128i b0 = _mm_add_epi32(sum0l, sum0h);
+ __m128i b1 = _mm_add_epi32(sum1l, sum1h);
+ __m128i b2 = _mm_add_epi32(sum2l, sum2h);
+ __m128i b3 = _mm_add_epi32(sum3l, sum3h);
+
+ __m128i a0 = _mm_add_epi32(b2, b3);
+ __m128i a1 = _mm_add_epi32(b0, b1);
+ __m128i a2 = _mm_add_epi32(b1, b3);
+ __m128i a3 = _mm_add_epi32(b0, b2);
+
+ _mm_storeu_si128((__m128i*)&err[0], a0);
+ _mm_storeu_si128((__m128i*)&err[1], a1);
+ _mm_storeu_si128((__m128i*)&err[2], a2);
+ _mm_storeu_si128((__m128i*)&err[3], a3);
+#else
+ uint terr[4][4];
+
+ memset(terr, 0, 16 * sizeof(uint));
+
+ for( int j=0; j<4; j++ )
+ {
+ for( int i=0; i<4; i++ )
+ {
+ int index = (j & 2) + (i >> 1);
+ uint d = *data++;
+ terr[index][0] += d;
+ d = *data++;
+ terr[index][1] += d;
+ d = *data++;
+ terr[index][2] += d;
+ data++;
+ }
+ }
+
+ for( int i=0; i<3; i++ )
+ {
+ err[0][i] = terr[2][i] + terr[3][i];
+ err[1][i] = terr[0][i] + terr[1][i];
+ err[2][i] = terr[1][i] + terr[3][i];
+ err[3][i] = terr[0][i] + terr[2][i];
+ }
+ for( int i=0; i<4; i++ )
+ {
+ err[i][3] = 0;
+ }
+#endif
+}
+
+uint CalcError( const uint block[4], const v4i& average )
+{
+ uint err = 0x3FFFFFFF; // Big value to prevent negative values, but small enough to prevent overflow
+ err -= block[0] * 2 * average[2];
+ err -= block[1] * 2 * average[1];
+ err -= block[2] * 2 * average[0];
+ err += 8 * ( sq( average[0] ) + sq( average[1] ) + sq( average[2] ) );
+ return err;
+}
+
+void ProcessAverages( v4i* a )
+{
+#ifdef __SSE4_1__
+ for( int i=0; i<2; i++ )
+ {
+ __m128i d = _mm_loadu_si128((__m128i*)a[i*2].data());
+
+ __m128i t = _mm_add_epi16(_mm_mullo_epi16(d, _mm_set1_epi16(31)), _mm_set1_epi16(128));
+
+ __m128i c = _mm_srli_epi16(_mm_add_epi16(t, _mm_srli_epi16(t, 8)), 8);
+
+ __m128i c1 = _mm_shuffle_epi32(c, _MM_SHUFFLE(3, 2, 3, 2));
+ __m128i diff = _mm_sub_epi16(c, c1);
+ diff = _mm_max_epi16(diff, _mm_set1_epi16(-4));
+ diff = _mm_min_epi16(diff, _mm_set1_epi16(3));
+
+ __m128i co = _mm_add_epi16(c1, diff);
+
+ c = _mm_blend_epi16(co, c, 0xF0);
+
+ __m128i a0 = _mm_or_si128(_mm_slli_epi16(c, 3), _mm_srli_epi16(c, 2));
+
+ _mm_storeu_si128((__m128i*)a[4+i*2].data(), a0);
+ }
+
+ for( int i=0; i<2; i++ )
+ {
+ __m128i d = _mm_loadu_si128((__m128i*)a[i*2].data());
+
+ __m128i t0 = _mm_add_epi16(_mm_mullo_epi16(d, _mm_set1_epi16(15)), _mm_set1_epi16(128));
+ __m128i t1 = _mm_srli_epi16(_mm_add_epi16(t0, _mm_srli_epi16(t0, 8)), 8);
+
+ __m128i t2 = _mm_or_si128(t1, _mm_slli_epi16(t1, 4));
+
+ _mm_storeu_si128((__m128i*)a[i*2].data(), t2);
+ }
+#else
+ for( int i=0; i<2; i++ )
+ {
+ for( int j=0; j<3; j++ )
+ {
+ int32 c1 = mul8bit( a[i*2+1][j], 31 );
+ int32 c2 = mul8bit( a[i*2][j], 31 );
+
+ int32 diff = c2 - c1;
+ if( diff > 3 ) diff = 3;
+ else if( diff < -4 ) diff = -4;
+
+ int32 co = c1 + diff;
+
+ a[5+i*2][j] = ( c1 << 3 ) | ( c1 >> 2 );
+ a[4+i*2][j] = ( co << 3 ) | ( co >> 2 );
+ }
+ }
+
+ for( int i=0; i<4; i++ )
+ {
+ a[i][0] = g_avg2[mul8bit( a[i][0], 15 )];
+ a[i][1] = g_avg2[mul8bit( a[i][1], 15 )];
+ a[i][2] = g_avg2[mul8bit( a[i][2], 15 )];
+ }
+#endif
+}
+
+void EncodeAverages( uint64& _d, const v4i* a, size_t idx )
+{
+ uint64 d = _d;
+ d |= ( idx << 24 );
+ size_t base = idx << 1;
+
+ if( ( idx & 0x2 ) == 0 )
+ {
+ for( int i=0; i<3; i++ )
+ {
+ d |= uint64( a[base+0][i] >> 4 ) << ( i*8 );
+ d |= uint64( a[base+1][i] >> 4 ) << ( i*8 + 4 );
+ }
+ }
+ else
+ {
+ for( int i=0; i<3; i++ )
+ {
+ d |= uint64( a[base+1][i] & 0xF8 ) << ( i*8 );
+ int32 c = ( ( a[base+0][i] & 0xF8 ) - ( a[base+1][i] & 0xF8 ) ) >> 3;
+ c &= ~0xFFFFFFF8;
+ d |= ((uint64)c) << ( i*8 );
+ }
+ }
+ _d = d;
+}
+
+uint64 CheckSolid( const uint8* src )
+{
+#ifdef __SSE4_1__
+ __m128i d0 = _mm_loadu_si128(((__m128i*)src) + 0);
+ __m128i d1 = _mm_loadu_si128(((__m128i*)src) + 1);
+ __m128i d2 = _mm_loadu_si128(((__m128i*)src) + 2);
+ __m128i d3 = _mm_loadu_si128(((__m128i*)src) + 3);
+
+ __m128i c = _mm_shuffle_epi32(d0, _MM_SHUFFLE(0, 0, 0, 0));
+
+ __m128i c0 = _mm_cmpeq_epi8(d0, c);
+ __m128i c1 = _mm_cmpeq_epi8(d1, c);
+ __m128i c2 = _mm_cmpeq_epi8(d2, c);
+ __m128i c3 = _mm_cmpeq_epi8(d3, c);
+
+ __m128i m0 = _mm_and_si128(c0, c1);
+ __m128i m1 = _mm_and_si128(c2, c3);
+ __m128i m = _mm_and_si128(m0, m1);
+
+ if (!_mm_testc_si128(m, _mm_set1_epi32(-1)))
+ {
+ return 0;
+ }
+#else
+ const uint8* ptr = src + 4;
+ for( int i=1; i<16; i++ )
+ {
+ if( memcmp( src, ptr, 4 ) != 0 )
+ {
+ return 0;
+ }
+ ptr += 4;
+ }
+#endif
+ return 0x02000000 |
+ ( uint( src[0] & 0xF8 ) << 16 ) |
+ ( uint( src[1] & 0xF8 ) << 8 ) |
+ ( uint( src[2] & 0xF8 ) );
+}
+
+void PrepareAverages( v4i a[8], const uint8* src, uint err[4] )
+{
+ Average( src, a );
+ ProcessAverages( a );
+
+ uint errblock[4][4];
+ CalcErrorBlock( src, errblock );
+
+ for( int i=0; i<4; i++ )
+ {
+ err[i/2] += CalcError( errblock[i], a[i] );
+ err[2+i/2] += CalcError( errblock[i], a[i+4] );
+ }
+}
+
+void FindBestFit( uint64 terr[2][8], uint16 tsel[16][8], v4i a[8], const uint32* id, const uint8* data )
+{
+ for( size_t i=0; i<16; i++ )
+ {
+ uint16* sel = tsel[i];
+ uint bid = id[i];
+ uint64* ter = terr[bid%2];
+
+ uint8 b = *data++;
+ uint8 g = *data++;
+ uint8 r = *data++;
+ data++;
+
+ int dr = a[bid][0] - r;
+ int dg = a[bid][1] - g;
+ int db = a[bid][2] - b;
+
+#ifdef __SSE4_1__
+ // Reference implementation
+
+ __m128i pix = _mm_set1_epi32(dr * 77 + dg * 151 + db * 28);
+ // Taking the absolute value is way faster. The values are only used to sort, so the result will be the same.
+ __m128i error0 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[0]));
+ __m128i error1 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[1]));
+ __m128i error2 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[0]));
+ __m128i error3 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[1]));
+
+ __m128i index0 = _mm_and_si128(_mm_cmplt_epi32(error1, error0), _mm_set1_epi32(1));
+ __m128i minError0 = _mm_min_epi32(error0, error1);
+
+ __m128i index1 = _mm_sub_epi32(_mm_set1_epi32(2), _mm_cmplt_epi32(error3, error2));
+ __m128i minError1 = _mm_min_epi32(error2, error3);
+
+ __m128i minIndex0 = _mm_blendv_epi8(index0, index1, _mm_cmplt_epi32(minError1, minError0));
+ __m128i minError = _mm_min_epi32(minError0, minError1);
+
+ // Squaring the minimum error to produce correct values when adding
+ __m128i minErrorLow = _mm_shuffle_epi32(minError, _MM_SHUFFLE(1, 1, 0, 0));
+ __m128i squareErrorLow = _mm_mul_epi32(minErrorLow, minErrorLow);
+ squareErrorLow = _mm_add_epi64(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 0));
+ _mm_storeu_si128(((__m128i*)ter) + 0, squareErrorLow);
+ __m128i minErrorHigh = _mm_shuffle_epi32(minError, _MM_SHUFFLE(3, 3, 2, 2));
+ __m128i squareErrorHigh = _mm_mul_epi32(minErrorHigh, minErrorHigh);
+ squareErrorHigh = _mm_add_epi64(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 1));
+ _mm_storeu_si128(((__m128i*)ter) + 1, squareErrorHigh);
+
+ // Taking the absolute value is way faster. The values are only used to sort, so the result will be the same.
+ error0 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[2]));
+ error1 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[3]));
+ error2 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[2]));
+ error3 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[3]));
+
+ index0 = _mm_and_si128(_mm_cmplt_epi32(error1, error0), _mm_set1_epi32(1));
+ minError0 = _mm_min_epi32(error0, error1);
+
+ index1 = _mm_sub_epi32(_mm_set1_epi32(2), _mm_cmplt_epi32(error3, error2));
+ minError1 = _mm_min_epi32(error2, error3);
+
+ __m128i minIndex1 = _mm_blendv_epi8(index0, index1, _mm_cmplt_epi32(minError1, minError0));
+ minError = _mm_min_epi32(minError0, minError1);
+
+ // Squaring the minimum error to produce correct values when adding
+ minErrorLow = _mm_shuffle_epi32(minError, _MM_SHUFFLE(1, 1, 0, 0));
+ squareErrorLow = _mm_mul_epi32(minErrorLow, minErrorLow);
+ squareErrorLow = _mm_add_epi64(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 2));
+ _mm_storeu_si128(((__m128i*)ter) + 2, squareErrorLow);
+ minErrorHigh = _mm_shuffle_epi32(minError, _MM_SHUFFLE(3, 3, 2, 2));
+ squareErrorHigh = _mm_mul_epi32(minErrorHigh, minErrorHigh);
+ squareErrorHigh = _mm_add_epi64(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 3));
+ _mm_storeu_si128(((__m128i*)ter) + 3, squareErrorHigh);
+ __m128i minIndex = _mm_packs_epi32(minIndex0, minIndex1);
+ _mm_storeu_si128((__m128i*)sel, minIndex);
+#else
+ int pix = dr * 77 + dg * 151 + db * 28;
+
+ for( int t=0; t<8; t++ )
+ {
+ const int64* tab = g_table256[t];
+ uint idx = 0;
+ uint64 err = sq( tab[0] + pix );
+ for( int j=1; j<4; j++ )
+ {
+ uint64 local = sq( tab[j] + pix );
+ if( local < err )
+ {
+ err = local;
+ idx = j;
+ }
+ }
+ *sel++ = idx;
+ *ter++ += err;
+ }
+#endif
+ }
+}
+
+#ifdef __SSE4_1__
+// Non-reference implementation, but faster. Produces same results as the AVX2 version
+void FindBestFit( uint32 terr[2][8], uint16 tsel[16][8], v4i a[8], const uint32* id, const uint8* data )
+{
+ for( size_t i=0; i<16; i++ )
+ {
+ uint16* sel = tsel[i];
+ uint bid = id[i];
+ uint32* ter = terr[bid%2];
+
+ uint8 b = *data++;
+ uint8 g = *data++;
+ uint8 r = *data++;
+ data++;
+
+ int dr = a[bid][0] - r;
+ int dg = a[bid][1] - g;
+ int db = a[bid][2] - b;
+
+ // The scaling values are divided by two and rounded, to allow the differences to be in the range of signed int16
+ // This produces slightly different results, but is significant faster
+ __m128i pixel = _mm_set1_epi16(dr * 38 + dg * 76 + db * 14);
+ __m128i pix = _mm_abs_epi16(pixel);
+
+ // Taking the absolute value is way faster. The values are only used to sort, so the result will be the same.
+ // Since the selector table is symmetrical, we need to calculate the difference only for half of the entries.
+ __m128i error0 = _mm_abs_epi16(_mm_sub_epi16(pix, g_table128_SIMD[0]));
+ __m128i error1 = _mm_abs_epi16(_mm_sub_epi16(pix, g_table128_SIMD[1]));
+
+ __m128i index = _mm_and_si128(_mm_cmplt_epi16(error1, error0), _mm_set1_epi16(1));
+ __m128i minError = _mm_min_epi16(error0, error1);
+
+ // Exploiting symmetry of the selector table and use the sign bit
+ // This produces slightly different results, but is needed to produce same results as AVX2 implementation
+ __m128i indexBit = _mm_andnot_si128(_mm_srli_epi16(pixel, 15), _mm_set1_epi8(-1));
+ __m128i minIndex = _mm_or_si128(index, _mm_add_epi16(indexBit, indexBit));
+
+ // Squaring the minimum error to produce correct values when adding
+ __m128i squareErrorLo = _mm_mullo_epi16(minError, minError);
+ __m128i squareErrorHi = _mm_mulhi_epi16(minError, minError);
+
+ __m128i squareErrorLow = _mm_unpacklo_epi16(squareErrorLo, squareErrorHi);
+ __m128i squareErrorHigh = _mm_unpackhi_epi16(squareErrorLo, squareErrorHi);
+
+ squareErrorLow = _mm_add_epi32(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 0));
+ _mm_storeu_si128(((__m128i*)ter) + 0, squareErrorLow);
+ squareErrorHigh = _mm_add_epi32(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 1));
+ _mm_storeu_si128(((__m128i*)ter) + 1, squareErrorHigh);
+
+ _mm_storeu_si128((__m128i*)sel, minIndex);
+ }
+}
+#endif
+
+uint8_t convert6(float f)
+{
+ int i = (std::min(std::max(static_cast<int>(f), 0), 1023) - 15) >> 1;
+ return (i + 11 - ((i + 11) >> 7) - ((i + 4) >> 7)) >> 3;
+}
+
+uint8_t convert7(float f)
+{
+ int i = (std::min(std::max(static_cast<int>(f), 0), 1023) - 15) >> 1;
+ return (i + 9 - ((i + 9) >> 8) - ((i + 6) >> 8)) >> 2;
+}
+
+std::pair<uint64, uint64> Planar(const uint8* src)
+{
+ int32 r = 0;
+ int32 g = 0;
+ int32 b = 0;
+
+ for (int i = 0; i < 16; ++i)
+ {
+ b += src[i * 4 + 0];
+ g += src[i * 4 + 1];
+ r += src[i * 4 + 2];
+ }
+
+ int32 difRyz = 0;
+ int32 difGyz = 0;
+ int32 difByz = 0;
+ int32 difRxz = 0;
+ int32 difGxz = 0;
+ int32 difBxz = 0;
+
+ const int32 scaling[] = { -255, -85, 85, 255 };
+
+ for (int i = 0; i < 16; ++i)
+ {
+ int32 difB = (static_cast<int>(src[i * 4 + 0]) << 4) - b;
+ int32 difG = (static_cast<int>(src[i * 4 + 1]) << 4) - g;
+ int32 difR = (static_cast<int>(src[i * 4 + 2]) << 4) - r;
+
+ difRyz += difR * scaling[i % 4];
+ difGyz += difG * scaling[i % 4];
+ difByz += difB * scaling[i % 4];
+
+ difRxz += difR * scaling[i / 4];
+ difGxz += difG * scaling[i / 4];
+ difBxz += difB * scaling[i / 4];
+ }
+
+ const float scale = -4.0f / ((255 * 255 * 8.0f + 85 * 85 * 8.0f) * 16.0f);
+
+ float aR = difRxz * scale;
+ float aG = difGxz * scale;
+ float aB = difBxz * scale;
+
+ float bR = difRyz * scale;
+ float bG = difGyz * scale;
+ float bB = difByz * scale;
+
+ float dR = r * (4.0f / 16.0f);
+ float dG = g * (4.0f / 16.0f);
+ float dB = b * (4.0f / 16.0f);
+
+ // calculating the three colors RGBO, RGBH, and RGBV. RGB = df - af * x - bf * y;
+ float cofR = (aR * 255.0f + (bR * 255.0f + dR));
+ float cofG = (aG * 255.0f + (bG * 255.0f + dG));
+ float cofB = (aB * 255.0f + (bB * 255.0f + dB));
+ float chfR = (aR * -425.0f + (bR * 255.0f + dR));
+ float chfG = (aG * -425.0f + (bG * 255.0f + dG));
+ float chfB = (aB * -425.0f + (bB * 255.0f + dB));
+ float cvfR = (aR * 255.0f + (bR * -425.0f + dR));
+ float cvfG = (aG * 255.0f + (bG * -425.0f + dG));
+ float cvfB = (aB * 255.0f + (bB * -425.0f + dB));
+
+ // convert to r6g7b6
+ int32 coR = convert6(cofR);
+ int32 coG = convert7(cofG);
+ int32 coB = convert6(cofB);
+ int32 chR = convert6(chfR);
+ int32 chG = convert7(chfG);
+ int32 chB = convert6(chfB);
+ int32 cvR = convert6(cvfR);
+ int32 cvG = convert7(cvfG);
+ int32 cvB = convert6(cvfB);
+
+ // Error calculation
+ int32 ro0 = coR;
+ int32 go0 = coG;
+ int32 bo0 = coB;
+ int32 ro1 = (ro0 >> 4) | (ro0 << 2);
+ int32 go1 = (go0 >> 6) | (go0 << 1);
+ int32 bo1 = (bo0 >> 4) | (bo0 << 2);
+ int32 ro2 = (ro1 << 2) + 2;
+ int32 go2 = (go1 << 2) + 2;
+ int32 bo2 = (bo1 << 2) + 2;
+
+ int32 rh0 = chR;
+ int32 gh0 = chG;
+ int32 bh0 = chB;
+ int32 rh1 = (rh0 >> 4) | (rh0 << 2);
+ int32 gh1 = (gh0 >> 6) | (gh0 << 1);
+ int32 bh1 = (bh0 >> 4) | (bh0 << 2);
+
+ int32 rh2 = rh1 - ro1;
+ int32 gh2 = gh1 - go1;
+ int32 bh2 = bh1 - bo1;
+
+ int32 rv0 = cvR;
+ int32 gv0 = cvG;
+ int32 bv0 = cvB;
+ int32 rv1 = (rv0 >> 4) | (rv0 << 2);
+ int32 gv1 = (gv0 >> 6) | (gv0 << 1);
+ int32 bv1 = (bv0 >> 4) | (bv0 << 2);
+
+ int32 rv2 = rv1 - ro1;
+ int32 gv2 = gv1 - go1;
+ int32 bv2 = bv1 - bo1;
+
+ uint64 error = 0;
+
+ for (int i = 0; i < 16; ++i)
+ {
+ int32 cR = clampu8((rh2 * (i / 4) + rv2 * (i % 4) + ro2) >> 2);
+ int32 cG = clampu8((gh2 * (i / 4) + gv2 * (i % 4) + go2) >> 2);
+ int32 cB = clampu8((bh2 * (i / 4) + bv2 * (i % 4) + bo2) >> 2);
+
+ int32 difB = static_cast<int>(src[i * 4 + 0]) - cB;
+ int32 difG = static_cast<int>(src[i * 4 + 1]) - cG;
+ int32 difR = static_cast<int>(src[i * 4 + 2]) - cR;
+
+ int32 dif = difR * 38 + difG * 76 + difB * 14;
+
+ error += dif * dif;
+ }
+
+ /**/
+ uint32 rgbv = cvB | (cvG << 6) | (cvR << 13);
+ uint32 rgbh = chB | (chG << 6) | (chR << 13);
+ uint32 hi = rgbv | ((rgbh & 0x1FFF) << 19);
+ uint32 lo = (chR & 0x1) | 0x2 | ((chR << 1) & 0x7C);
+ lo |= ((coB & 0x07) << 7) | ((coB & 0x18) << 8) | ((coB & 0x20) << 11);
+ lo |= ((coG & 0x3F) << 17) | ((coG & 0x40) << 18);
+ lo |= coR << 25;
+
+ const int32 idx = (coR & 0x20) | ((coG & 0x20) >> 1) | ((coB & 0x1E) >> 1);
+
+ lo |= g_flags[idx];
+
+ uint64 result = static_cast<uint32>(bx::endianSwap(lo));
+ result |= static_cast<uint64>(static_cast<uint32>(bx::endianSwap(hi))) << 32;
+
+ return std::make_pair(result, error);
+}
+
+template<class T, class S>
+uint64 EncodeSelectors( uint64 d, const T terr[2][8], const S tsel[16][8], const uint32* id, const uint64 value, const uint64 error)
+{
+ size_t tidx[2];
+ tidx[0] = GetLeastError( terr[0], 8 );
+ tidx[1] = GetLeastError( terr[1], 8 );
+
+ if ((terr[0][tidx[0]] + terr[1][tidx[1]]) >= error)
+ {
+ return value;
+ }
+
+ d |= tidx[0] << 26;
+ d |= tidx[1] << 29;
+ for( int i=0; i<16; i++ )
+ {
+ uint64 t = tsel[i][tidx[id[i]%2]];
+ d |= ( t & 0x1 ) << ( i + 32 );
+ d |= ( t & 0x2 ) << ( i + 47 );
+ }
+
+ return FixByteOrder(d);
+}
+}
+
+uint64 ProcessRGB( const uint8* src )
+{
+ uint64 d = CheckSolid( src );
+ if( d != 0 ) return d;
+
+ v4i a[8];
+ uint err[4] = {};
+ PrepareAverages( a, src, err );
+ size_t idx = GetLeastError( err, 4 );
+ EncodeAverages( d, a, idx );
+
+#if defined __SSE4_1__ && !defined REFERENCE_IMPLEMENTATION
+ uint32 terr[2][8] = {};
+#else
+ uint64 terr[2][8] = {};
+#endif
+ uint16 tsel[16][8];
+ const uint32* id = g_id[idx];
+ FindBestFit( terr, tsel, a, id, src );
+
+ return FixByteOrder( EncodeSelectors( d, terr, tsel, id ) );
+}
+
+uint64 ProcessRGB_ETC2( const uint8* src )
+{
+ std::pair<uint64, uint64> result = Planar( src );
+
+ uint64 d = 0;
+
+ v4i a[8];
+ uint err[4] = {};
+ PrepareAverages( a, src, err );
+ size_t idx = GetLeastError( err, 4 );
+ EncodeAverages( d, a, idx );
+
+ uint64 terr[2][8] = {};
+ uint16 tsel[16][8];
+ const uint32* id = g_id[idx];
+ FindBestFit( terr, tsel, a, id, src );
+
+ return EncodeSelectors( d, terr, tsel, id, result.first, result.second );
+}
diff --git a/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp b/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp
new file mode 100644
index 00000000000..21434a3b267
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp
@@ -0,0 +1,9 @@
+#ifndef __PROCESSRGB_HPP__
+#define __PROCESSRGB_HPP__
+
+#include "Types.hpp"
+
+uint64 ProcessRGB( const uint8* src );
+uint64 ProcessRGB_ETC2( const uint8* src );
+
+#endif
diff --git a/3rdparty/bgfx/3rdparty/etc2/Tables.cpp b/3rdparty/bgfx/3rdparty/etc2/Tables.cpp
new file mode 100644
index 00000000000..968fbf5838c
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/Tables.cpp
@@ -0,0 +1,109 @@
+#include "Tables.hpp"
+
+const int32 g_table[8][4] = {
+ { 2, 8, -2, -8 },
+ { 5, 17, -5, -17 },
+ { 9, 29, -9, -29 },
+ { 13, 42, -13, -42 },
+ { 18, 60, -18, -60 },
+ { 24, 80, -24, -80 },
+ { 33, 106, -33, -106 },
+ { 47, 183, -47, -183 }
+};
+
+const int64 g_table256[8][4] = {
+ { 2*256, 8*256, -2*256, -8*256 },
+ { 5*256, 17*256, -5*256, -17*256 },
+ { 9*256, 29*256, -9*256, -29*256 },
+ { 13*256, 42*256, -13*256, -42*256 },
+ { 18*256, 60*256, -18*256, -60*256 },
+ { 24*256, 80*256, -24*256, -80*256 },
+ { 33*256, 106*256, -33*256, -106*256 },
+ { 47*256, 183*256, -47*256, -183*256 }
+};
+
+const uint32 g_id[4][16] = {
+ { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2 },
+ { 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4 },
+ { 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6 }
+};
+
+const uint32 g_avg2[16] = {
+ 0x00,
+ 0x11,
+ 0x22,
+ 0x33,
+ 0x44,
+ 0x55,
+ 0x66,
+ 0x77,
+ 0x88,
+ 0x99,
+ 0xAA,
+ 0xBB,
+ 0xCC,
+ 0xDD,
+ 0xEE,
+ 0xFF
+};
+
+const uint32 g_flags[64] = {
+ 0x80800402, 0x80800402, 0x80800402, 0x80800402,
+ 0x80800402, 0x80800402, 0x80800402, 0x8080E002,
+ 0x80800402, 0x80800402, 0x8080E002, 0x8080E002,
+ 0x80800402, 0x8080E002, 0x8080E002, 0x8080E002,
+ 0x80000402, 0x80000402, 0x80000402, 0x80000402,
+ 0x80000402, 0x80000402, 0x80000402, 0x8000E002,
+ 0x80000402, 0x80000402, 0x8000E002, 0x8000E002,
+ 0x80000402, 0x8000E002, 0x8000E002, 0x8000E002,
+ 0x00800402, 0x00800402, 0x00800402, 0x00800402,
+ 0x00800402, 0x00800402, 0x00800402, 0x0080E002,
+ 0x00800402, 0x00800402, 0x0080E002, 0x0080E002,
+ 0x00800402, 0x0080E002, 0x0080E002, 0x0080E002,
+ 0x00000402, 0x00000402, 0x00000402, 0x00000402,
+ 0x00000402, 0x00000402, 0x00000402, 0x0000E002,
+ 0x00000402, 0x00000402, 0x0000E002, 0x0000E002,
+ 0x00000402, 0x0000E002, 0x0000E002, 0x0000E002
+};
+
+#ifdef __SSE4_1__
+const uint8 g_flags_AVX2[64] =
+{
+ 0x63, 0x63, 0x63, 0x63,
+ 0x63, 0x63, 0x63, 0x7D,
+ 0x63, 0x63, 0x7D, 0x7D,
+ 0x63, 0x7D, 0x7D, 0x7D,
+ 0x43, 0x43, 0x43, 0x43,
+ 0x43, 0x43, 0x43, 0x5D,
+ 0x43, 0x43, 0x5D, 0x5D,
+ 0x43, 0x5D, 0x5D, 0x5D,
+ 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x3D,
+ 0x23, 0x23, 0x3D, 0x3D,
+ 0x23, 0x3D, 0x3D, 0x3D,
+ 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x1D,
+ 0x03, 0x03, 0x1D, 0x1D,
+ 0x03, 0x1D, 0x1D, 0x1D,
+};
+
+const __m128i g_table_SIMD[2] =
+{
+ _mm_setr_epi16( 2, 5, 9, 13, 18, 24, 33, 47),
+ _mm_setr_epi16( 8, 17, 29, 42, 60, 80, 106, 183)
+};
+const __m128i g_table128_SIMD[2] =
+{
+ _mm_setr_epi16( 2*128, 5*128, 9*128, 13*128, 18*128, 24*128, 33*128, 47*128),
+ _mm_setr_epi16( 8*128, 17*128, 29*128, 42*128, 60*128, 80*128, 106*128, 183*128)
+};
+const __m128i g_table256_SIMD[4] =
+{
+ _mm_setr_epi32( 2*256, 5*256, 9*256, 13*256),
+ _mm_setr_epi32( 8*256, 17*256, 29*256, 42*256),
+ _mm_setr_epi32( 18*256, 24*256, 33*256, 47*256),
+ _mm_setr_epi32( 60*256, 80*256, 106*256, 183*256)
+};
+#endif
+
diff --git a/3rdparty/bgfx/3rdparty/etc2/Tables.hpp b/3rdparty/bgfx/3rdparty/etc2/Tables.hpp
new file mode 100644
index 00000000000..b570526dc57
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/Tables.hpp
@@ -0,0 +1,25 @@
+#ifndef __TABLES_HPP__
+#define __TABLES_HPP__
+
+#include "Types.hpp"
+#ifdef __SSE4_1__
+#include <smmintrin.h>
+#endif
+
+extern const int32 g_table[8][4];
+extern const int64 g_table256[8][4];
+
+extern const uint32 g_id[4][16];
+
+extern const uint32 g_avg2[16];
+
+extern const uint32 g_flags[64];
+
+#ifdef __SSE4_1__
+extern const uint8 g_flags_AVX2[64];
+extern const __m128i g_table_SIMD[2];
+extern const __m128i g_table128_SIMD[2];
+extern const __m128i g_table256_SIMD[4];
+#endif
+
+#endif
diff --git a/3rdparty/bgfx/3rdparty/etc2/Types.hpp b/3rdparty/bgfx/3rdparty/etc2/Types.hpp
new file mode 100644
index 00000000000..b31da22e4d8
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/Types.hpp
@@ -0,0 +1,17 @@
+#ifndef __DARKRL__TYPES_HPP__
+#define __DARKRL__TYPES_HPP__
+
+#include <stdint.h>
+
+typedef int8_t int8;
+typedef uint8_t uint8;
+typedef int16_t int16;
+typedef uint16_t uint16;
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef int64_t int64;
+typedef uint64_t uint64;
+
+typedef unsigned int uint;
+
+#endif
diff --git a/3rdparty/bgfx/3rdparty/etc2/Vector.hpp b/3rdparty/bgfx/3rdparty/etc2/Vector.hpp
new file mode 100644
index 00000000000..3005fdc5395
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/etc2/Vector.hpp
@@ -0,0 +1,222 @@
+#ifndef __DARKRL__VECTOR_HPP__
+#define __DARKRL__VECTOR_HPP__
+
+#include <assert.h>
+#include <algorithm>
+#include <math.h>
+
+#include "Math.hpp"
+#include "Types.hpp"
+
+template<class T>
+struct Vector2
+{
+ Vector2() : x( 0 ), y( 0 ) {}
+ Vector2( T v ) : x( v ), y( v ) {}
+ Vector2( T _x, T _y ) : x( _x ), y( _y ) {}
+
+ bool operator==( const Vector2<T>& rhs ) const { return x == rhs.x && y == rhs.y; }
+ bool operator!=( const Vector2<T>& rhs ) const { return !( *this == rhs ); }
+
+ Vector2<T>& operator+=( const Vector2<T>& rhs )
+ {
+ x += rhs.x;
+ y += rhs.y;
+ return *this;
+ }
+ Vector2<T>& operator-=( const Vector2<T>& rhs )
+ {
+ x -= rhs.x;
+ y -= rhs.y;
+ return *this;
+ }
+ Vector2<T>& operator*=( const Vector2<T>& rhs )
+ {
+ x *= rhs.x;
+ y *= rhs.y;
+ return *this;
+ }
+
+ T x, y;
+};
+
+template<class T>
+Vector2<T> operator+( const Vector2<T>& lhs, const Vector2<T>& rhs )
+{
+ return Vector2<T>( lhs.x + rhs.x, lhs.y + rhs.y );
+}
+
+template<class T>
+Vector2<T> operator-( const Vector2<T>& lhs, const Vector2<T>& rhs )
+{
+ return Vector2<T>( lhs.x - rhs.x, lhs.y - rhs.y );
+}
+
+template<class T>
+Vector2<T> operator*( const Vector2<T>& lhs, const float& rhs )
+{
+ return Vector2<T>( lhs.x * rhs, lhs.y * rhs );
+}
+
+template<class T>
+Vector2<T> operator/( const Vector2<T>& lhs, const T& rhs )
+{
+ return Vector2<T>( lhs.x / rhs, lhs.y / rhs );
+}
+
+
+typedef Vector2<int32> v2i;
+typedef Vector2<float> v2f;
+
+
+template<class T>
+struct Vector3
+{
+ Vector3() : x( 0 ), y( 0 ), z( 0 ) {}
+ Vector3( T v ) : x( v ), y( v ), z( v ) {}
+ Vector3( T _x, T _y, T _z ) : x( _x ), y( _y ), z( _z ) {}
+ template<class Y>
+ Vector3( const Vector3<Y>& v ) : x( T( v.x ) ), y( T( v.y ) ), z( T( v.z ) ) {}
+
+ T Luminance() const { return T( x * 0.3f + y * 0.59f + z * 0.11f ); }
+ void Clamp()
+ {
+ x = std::min( T(1), std::max( T(0), x ) );
+ y = std::min( T(1), std::max( T(0), y ) );
+ z = std::min( T(1), std::max( T(0), z ) );
+ }
+
+ bool operator==( const Vector3<T>& rhs ) const { return x == rhs.x && y == rhs.y && z == rhs.z; }
+ bool operator!=( const Vector2<T>& rhs ) const { return !( *this == rhs ); }
+
+ T& operator[]( uint idx ) { assert( idx < 3 ); return ((T*)this)[idx]; }
+ const T& operator[]( uint idx ) const { assert( idx < 3 ); return ((T*)this)[idx]; }
+
+ Vector3<T> operator+=( const Vector3<T>& rhs )
+ {
+ x += rhs.x;
+ y += rhs.y;
+ z += rhs.z;
+ return *this;
+ }
+
+ Vector3<T> operator*=( const Vector3<T>& rhs )
+ {
+ x *= rhs.x;
+ y *= rhs.y;
+ z *= rhs.z;
+ return *this;
+ }
+
+ Vector3<T> operator*=( const float& rhs )
+ {
+ x *= rhs;
+ y *= rhs;
+ z *= rhs;
+ return *this;
+ }
+
+ T x, y, z;
+ T padding;
+};
+
+template<class T>
+Vector3<T> operator+( const Vector3<T>& lhs, const Vector3<T>& rhs )
+{
+ return Vector3<T>( lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z );
+}
+
+template<class T>
+Vector3<T> operator-( const Vector3<T>& lhs, const Vector3<T>& rhs )
+{
+ return Vector3<T>( lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z );
+}
+
+template<class T>
+Vector3<T> operator*( const Vector3<T>& lhs, const Vector3<T>& rhs )
+{
+ return Vector3<T>( lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z );
+}
+
+template<class T>
+Vector3<T> operator*( const Vector3<T>& lhs, const float& rhs )
+{
+ return Vector3<T>( T( lhs.x * rhs ), T( lhs.y * rhs ), T( lhs.z * rhs ) );
+}
+
+template<class T>
+Vector3<T> operator/( const Vector3<T>& lhs, const T& rhs )
+{
+ return Vector3<T>( lhs.x / rhs, lhs.y / rhs, lhs.z / rhs );
+}
+
+template<class T>
+bool operator<( const Vector3<T>& lhs, const Vector3<T>& rhs )
+{
+ return lhs.Luminance() < rhs.Luminance();
+}
+
+typedef Vector3<int32> v3i;
+typedef Vector3<float> v3f;
+typedef Vector3<uint8> v3b;
+
+
+static inline v3b v3f_to_v3b( const v3f& v )
+{
+ return v3b( uint8( std::min( 1.f, v.x ) * 255 ), uint8( std::min( 1.f, v.y ) * 255 ), uint8( std::min( 1.f, v.z ) * 255 ) );
+}
+
+template<class T>
+Vector3<T> Mix( const Vector3<T>& v1, const Vector3<T>& v2, float amount )
+{
+ return v1 + ( v2 - v1 ) * amount;
+}
+
+template<>
+inline v3b Mix( const v3b& v1, const v3b& v2, float amount )
+{
+ return v3b( v3f( v1 ) + ( v3f( v2 ) - v3f( v1 ) ) * amount );
+}
+
+template<class T>
+Vector3<T> Desaturate( const Vector3<T>& v )
+{
+ T l = v.Luminance();
+ return Vector3<T>( l, l, l );
+}
+
+template<class T>
+Vector3<T> Desaturate( const Vector3<T>& v, float mul )
+{
+ T l = T( v.Luminance() * mul );
+ return Vector3<T>( l, l, l );
+}
+
+template<class T>
+Vector3<T> pow( const Vector3<T>& base, float exponent )
+{
+ return Vector3<T>(
+ pow( base.x, exponent ),
+ pow( base.y, exponent ),
+ pow( base.z, exponent ) );
+}
+
+template<class T>
+Vector3<T> sRGB2linear( const Vector3<T>& v )
+{
+ return Vector3<T>(
+ sRGB2linear( v.x ),
+ sRGB2linear( v.y ),
+ sRGB2linear( v.z ) );
+}
+
+template<class T>
+Vector3<T> linear2sRGB( const Vector3<T>& v )
+{
+ return Vector3<T>(
+ linear2sRGB( v.x ),
+ linear2sRGB( v.y ),
+ linear2sRGB( v.z ) );
+}
+
+#endif
diff --git a/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp b/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp
index 0dd59c63cbe..3d23d2ba0ab 100644
--- a/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp
+++ b/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp
@@ -293,7 +293,7 @@ namespace Forsyth
assert(vertexData.activeFaceListSize > 0);
uint* begin = &activeFaceList[vertexData.activeFaceListStart];
- uint* end = &activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize];
+ uint* end = &(activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize - 1]) + 1;
uint* it = std::find(begin, end, bestFace);
assert(it != end);
std::swap(*it, *(end-1));
diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore
index 1c9b0ddd6db..722300c5026 100644
--- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore
+++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore
@@ -1,7 +1,5 @@
glcpp
glcpp-parse.output
-glcpp-parse.c
-glcpp-parse.h
*.o
*.lo
diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp
index f9988a31f61..9f7071d9564 100644
--- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp
+++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp
@@ -1020,7 +1020,17 @@ void ir_print_metal_visitor::visit(ir_expression *ir)
const bool halfCast = (arg_prec == glsl_precision_medium || arg_prec == glsl_precision_low);
buffer.asprintf_append (halfCast ? "((half)1.0/(" : "(1.0/(");
} else {
- buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]);
+ switch(ir->operation) {
+ case ir_unop_dFdy:
+ case ir_unop_dFdy_coarse:
+ case ir_unop_dFdy_fine:
+ buffer.asprintf_append ("%s(-", operator_glsl_strs[ir->operation]);
+ break;
+
+ default:
+ buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]);
+ break;
+ }
}
if (ir->operands[0])
ir->operands[0]->accept(this);
diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore b/3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore
new file mode 100644
index 00000000000..31b83a9bc9a
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore
@@ -0,0 +1,58 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+.idea/
diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py b/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py
new file mode 100644
index 00000000000..09eae5c4566
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py
@@ -0,0 +1,183 @@
+#!/usr/bin/python
+# Convert Font Awesome, Google Material Design and Kenney Game icon font
+# parameters to C++11 and C89 compatible formats.
+#
+#------------------------------------------------------------------------------
+# 1 - Source material
+#
+# 1.1 - Font Awesome - https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml
+# 1.2 - Material Design - https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints
+# 1.3 - Kenney icons - https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css
+#
+#------------------------------------------------------------------------------
+# 2 - Data samples
+#
+# 2.1 - Font Awesome
+# - input: - name: Music
+# id: music
+# unicode: f001
+# created: 1.0
+# filter:
+# - note
+# - sound
+# categories:
+# - Web Application Icons
+# - output C++11: #define ICON_FA_MUSIC u8"\uf001"
+# - output C89: #define ICON_FA_MUSIC "\xEF\x80\x81"
+#
+# 2.2 - Google Material Design icons
+# - input: 3d_rotation e84d
+# - output C++11: #define ICON_MD_3D_ROTATION u8"\ue84d"
+# - output C89: #define ICON_MD_3D_ROTATION "\xEE\xA1\x8D"
+#
+# 2.3 - Kenney Game icons
+# - input: .ki-home:before{ content: "\e900"; }
+# - output C++11: #define ICON_KI_HOME u8"\ue900"
+# - output C89: #define ICON_KI_HOME "\xEE\xA4\x80"
+#
+# 2.4 - All fonts
+# - computed min and max unicode fonts ICON_MIN and ICON_MAX
+# - output: #define ICON_MIN_FA 0xf000
+# #define ICON_MAX_FA 0xf295
+#
+#------------------------------------------------------------------------------
+# 3 - Script dependencies
+#
+# 3.1 - Python 2.7 - https://www.python.org/download/releases/2.7/
+# 3.2 - Requests - http://docs.python-requests.org/
+# 3.3 - PyYAML - http://pyyaml.org/
+#
+#------------------------------------------------------------------------------
+
+
+import requests
+import yaml
+
+
+LINE_FORMAT_MINMAX = '#define ICON_{!s}_{!s} 0x{!s}\n'
+
+UNICODE_MIN = 'ffff'
+UNICODE_MAX = '0'
+TIMEOUT = 2
+
+MESSAGE_SUCCESS = '{!s} fonts - conversion success: {!s}'
+MESSAGE_ERROR = '{!s} fonts - error \n\t{!s}'
+
+
+def get_prelude( url ):
+ prelude = '// Generated by GenerateIconFontCppHeaders.py \n// from {!s}\n#pragma once\n\n'.format( url )
+ return prelude
+
+
+def line_format( font_abbr, font, unicode, cpp11 = True ):
+ if cpp11:
+ result = '#define ICON_{!s}_{!s} u8"\u{!s}"\n'.format( font_abbr, font, unicode )
+ else:
+ unicode_base = ''.join([ '{0:x}'.format( ord( x )) for x in unichr( int( unicode, 16 )).encode( 'utf-8' )]).upper()
+ unicode = '\\x' + unicode_base[ :2 ] + '\\x' + unicode_base[ 2:4 ] + '\\x' + unicode_base[ 4: ]
+ result = '#define ICON_{!s}_{!s} "{!s}"\n'.format( font_abbr, font, unicode )
+ return result
+
+
+def convert_font_awesome( font_name, font_abbr, source_url, output_file, cpp11 ):
+ try:
+ response = requests.get( source_url, timeout = TIMEOUT )
+ if response.status_code == 200:
+ input = yaml.safe_load( response.content )
+ min = UNICODE_MIN
+ max = UNICODE_MAX
+ output_fonts = ''
+ for item in input[ 'icons' ]:
+ font = ''
+ for char in item[ 'id' ]:
+ font += '_' if ( char == '-' ) else str.upper( char )
+ unicode = item[ 'unicode' ]
+ if unicode < min:
+ min = unicode
+ elif unicode >= max:
+ max = unicode
+ output_fonts += line_format( font_abbr, font, unicode, cpp11 )
+ output = get_prelude( source_url ) + \
+ LINE_FORMAT_MINMAX.format( 'MIN', font_abbr, min ) + \
+ LINE_FORMAT_MINMAX.format( 'MAX', font_abbr, max ) + \
+ output_fonts
+ with open( output_file, 'w' ) as f:
+ f.write( output )
+ print( MESSAGE_SUCCESS.format( font_name, output_file ))
+ except Exception as e:
+ print( MESSAGE_ERROR.format( font_name, e ))
+
+
+def convert_material_design( font_name, font_abbr, source_url, output_file, cpp11 ):
+ try:
+ response = requests.get( source_url, timeout = TIMEOUT )
+ if response.status_code == 200:
+ input = str.split( response.content, '\n' )
+ min = UNICODE_MIN
+ max = UNICODE_MAX
+ output_fonts = ''
+ for line in input:
+ words = str.split( line )
+ if words:
+ font = ''
+ for char in words[ 0 ]:
+ font += '_' if ( char == '-' ) else str.upper( char )
+ unicode = words[ 1 ]
+ if unicode < min:
+ min = unicode
+ elif unicode >= max:
+ max = unicode
+ output_fonts += line_format( font_abbr, font, unicode, cpp11 )
+ output = get_prelude( source_url ) + \
+ LINE_FORMAT_MINMAX.format( 'MIN', font_abbr, min ) + \
+ LINE_FORMAT_MINMAX.format( 'MAX', font_abbr, max ) + \
+ output_fonts
+ with open( output_file, 'w' ) as f:
+ f.write( output )
+ print( MESSAGE_SUCCESS.format( font_name, output_file ))
+ except Exception as e:
+ print( MESSAGE_ERROR.format( font_name, e ))
+
+
+def convert_kenney( font_name, font_abbr, source_url, output_file, cpp11 ):
+ try:
+ response = requests.get( source_url, timeout = TIMEOUT )
+ if response.status_code == 200:
+ input = str.split( response.content, '\n' )
+ min = UNICODE_MIN
+ max = UNICODE_MAX
+ output_fonts = ''
+ font_begin= '.ki-'
+ font_end = ':before'
+ unicode_begin = '"\\'
+ unicode_end = '";'
+ for line in input:
+ words = str.split( line )
+ if words:
+ if font_begin in words[ 0 ]:
+ font = ''
+ word = words[ 0 ][( words[ 0 ].find( font_begin ) + len( font_begin )) : ( words[ 0 ].find( font_end ))]
+ for char in word:
+ font += '_' if ( char == '-' ) else str.upper( char )
+ unicode = str( words[ 2 ][( words[ 2 ].find( unicode_begin ) + len( unicode_begin )) : words[ 2 ].find( unicode_end )])
+ if unicode < min:
+ min = unicode
+ elif unicode >= max:
+ max = unicode
+ output_fonts += line_format( font_abbr, font, unicode, cpp11 )
+ output = get_prelude( source_url ) + \
+ LINE_FORMAT_MINMAX.format( 'MIN', font_abbr, min ) + \
+ LINE_FORMAT_MINMAX.format( 'MAX', font_abbr, max ) + \
+ output_fonts
+ with open( output_file, 'w' ) as f:
+ f.write( output )
+ print( MESSAGE_SUCCESS.format( font_name, output_file ))
+ except Exception as e:
+ print( MESSAGE_ERROR.format( font_name, e ))
+
+
+# Main
+
+convert_font_awesome( 'Font Awesome', 'FA', 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml', 'icons_font_awesome.h', False )
+convert_material_design( 'Material Design', 'MD', 'https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints', 'icons_material_design.h', False )
+convert_kenney( 'Kenney', 'KI', 'https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css', 'icons_kenney.h', False )
diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE b/3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE
new file mode 100644
index 00000000000..f54b795b715
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Juliette Foucaut
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/README.md b/3rdparty/bgfx/3rdparty/iconfontheaders/README.md
new file mode 100644
index 00000000000..2170dee402f
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/iconfontheaders/README.md
@@ -0,0 +1,29 @@
+# IconFontCHeaders
+C++11 and C89 headers for icon fonts Font Awesome, Google Material Design icons and Kenney game icons.
+
+A set of header files for using icon fonts in C and C++, along with the python generator used to create the files.
+
+Each header contains defines for one font, with each icon code point defined as ICON_*, along with the min and max code points for font loading purposes.
+
+## Fonts
+
+* [Font Awesome](http://fortawesome.github.io/Font-Awesome/) - [github repository](https://github.com/FortAwesome/Font-Awesome/)
+* [Google Material Design icons](https://design.google.com/icons/) - [github repository](https://github.com/google/material-design-icons/)
+* [Kenney Game icons](http://kenney.nl/assets/game-icons) and [Game icons expansion](http://kenney.nl/assets/game-icons-expansion) - [github repository](https://github.com/SamBrishes/kenney-icon-font)
+
+## Usage
+
+Using [dear imgui](https://github.com/ocornut/imgui) as an example UI library:
+
+ #include "IconsFontAwesome.h"
+
+ ImGuiIO& io = ImGui::GetIO();
+ io.Fonts->AddFontDefault();
+
+ // merge in icons from Font Awesome
+ static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
+ ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true;
+ io.Fonts->AddFontFromFileTTF( fontFile.c_str(), 16.0f, &icons_config, icons_ranges);
+
+ // in an imgui window somewhere...
+ ImGui::Text( ICON_FA_FILE " File" ); // use string literal concatenation, ouputs a file icon and File as a string.
diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome.h
new file mode 100644
index 00000000000..346358f0044
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome.h
@@ -0,0 +1,611 @@
+// Generated by GenerateIconFontCppHeaders.py
+// from https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml
+#pragma once
+
+#define ICON_MIN_FA 0xf000
+#define ICON_MAX_FA 0xf295
+#define ICON_FA_GLASS "\xEF\x80\x80"
+#define ICON_FA_MUSIC "\xEF\x80\x81"
+#define ICON_FA_SEARCH "\xEF\x80\x82"
+#define ICON_FA_ENVELOPE_O "\xEF\x80\x83"
+#define ICON_FA_HEART "\xEF\x80\x84"
+#define ICON_FA_STAR "\xEF\x80\x85"
+#define ICON_FA_STAR_O "\xEF\x80\x86"
+#define ICON_FA_USER "\xEF\x80\x87"
+#define ICON_FA_FILM "\xEF\x80\x88"
+#define ICON_FA_TH_LARGE "\xEF\x80\x89"
+#define ICON_FA_TH "\xEF\x80\x8A"
+#define ICON_FA_TH_LIST "\xEF\x80\x8B"
+#define ICON_FA_CHECK "\xEF\x80\x8C"
+#define ICON_FA_TIMES "\xEF\x80\x8D"
+#define ICON_FA_SEARCH_PLUS "\xEF\x80\x8E"
+#define ICON_FA_SEARCH_MINUS "\xEF\x80\x90"
+#define ICON_FA_POWER_OFF "\xEF\x80\x91"
+#define ICON_FA_SIGNAL "\xEF\x80\x92"
+#define ICON_FA_COG "\xEF\x80\x93"
+#define ICON_FA_TRASH_O "\xEF\x80\x94"
+#define ICON_FA_HOME "\xEF\x80\x95"
+#define ICON_FA_FILE_O "\xEF\x80\x96"
+#define ICON_FA_CLOCK_O "\xEF\x80\x97"
+#define ICON_FA_ROAD "\xEF\x80\x98"
+#define ICON_FA_DOWNLOAD "\xEF\x80\x99"
+#define ICON_FA_ARROW_CIRCLE_O_DOWN "\xEF\x80\x9A"
+#define ICON_FA_ARROW_CIRCLE_O_UP "\xEF\x80\x9B"
+#define ICON_FA_INBOX "\xEF\x80\x9C"
+#define ICON_FA_PLAY_CIRCLE_O "\xEF\x80\x9D"
+#define ICON_FA_REPEAT "\xEF\x80\x9E"
+#define ICON_FA_REFRESH "\xEF\x80\xA1"
+#define ICON_FA_LIST_ALT "\xEF\x80\xA2"
+#define ICON_FA_LOCK "\xEF\x80\xA3"
+#define ICON_FA_FLAG "\xEF\x80\xA4"
+#define ICON_FA_HEADPHONES "\xEF\x80\xA5"
+#define ICON_FA_VOLUME_OFF "\xEF\x80\xA6"
+#define ICON_FA_VOLUME_DOWN "\xEF\x80\xA7"
+#define ICON_FA_VOLUME_UP "\xEF\x80\xA8"
+#define ICON_FA_QRCODE "\xEF\x80\xA9"
+#define ICON_FA_BARCODE "\xEF\x80\xAA"
+#define ICON_FA_TAG "\xEF\x80\xAB"
+#define ICON_FA_TAGS "\xEF\x80\xAC"
+#define ICON_FA_BOOK "\xEF\x80\xAD"
+#define ICON_FA_BOOKMARK "\xEF\x80\xAE"
+#define ICON_FA_PRINT "\xEF\x80\xAF"
+#define ICON_FA_CAMERA "\xEF\x80\xB0"
+#define ICON_FA_FONT "\xEF\x80\xB1"
+#define ICON_FA_BOLD "\xEF\x80\xB2"
+#define ICON_FA_ITALIC "\xEF\x80\xB3"
+#define ICON_FA_TEXT_HEIGHT "\xEF\x80\xB4"
+#define ICON_FA_TEXT_WIDTH "\xEF\x80\xB5"
+#define ICON_FA_ALIGN_LEFT "\xEF\x80\xB6"
+#define ICON_FA_ALIGN_CENTER "\xEF\x80\xB7"
+#define ICON_FA_ALIGN_RIGHT "\xEF\x80\xB8"
+#define ICON_FA_ALIGN_JUSTIFY "\xEF\x80\xB9"
+#define ICON_FA_LIST "\xEF\x80\xBA"
+#define ICON_FA_OUTDENT "\xEF\x80\xBB"
+#define ICON_FA_INDENT "\xEF\x80\xBC"
+#define ICON_FA_VIDEO_CAMERA "\xEF\x80\xBD"
+#define ICON_FA_PICTURE_O "\xEF\x80\xBE"
+#define ICON_FA_PENCIL "\xEF\x81\x80"
+#define ICON_FA_MAP_MARKER "\xEF\x81\x81"
+#define ICON_FA_ADJUST "\xEF\x81\x82"
+#define ICON_FA_TINT "\xEF\x81\x83"
+#define ICON_FA_PENCIL_SQUARE_O "\xEF\x81\x84"
+#define ICON_FA_SHARE_SQUARE_O "\xEF\x81\x85"
+#define ICON_FA_CHECK_SQUARE_O "\xEF\x81\x86"
+#define ICON_FA_ARROWS "\xEF\x81\x87"
+#define ICON_FA_STEP_BACKWARD "\xEF\x81\x88"
+#define ICON_FA_FAST_BACKWARD "\xEF\x81\x89"
+#define ICON_FA_BACKWARD "\xEF\x81\x8A"
+#define ICON_FA_PLAY "\xEF\x81\x8B"
+#define ICON_FA_PAUSE "\xEF\x81\x8C"
+#define ICON_FA_STOP "\xEF\x81\x8D"
+#define ICON_FA_FORWARD "\xEF\x81\x8E"
+#define ICON_FA_FAST_FORWARD "\xEF\x81\x90"
+#define ICON_FA_STEP_FORWARD "\xEF\x81\x91"
+#define ICON_FA_EJECT "\xEF\x81\x92"
+#define ICON_FA_CHEVRON_LEFT "\xEF\x81\x93"
+#define ICON_FA_CHEVRON_RIGHT "\xEF\x81\x94"
+#define ICON_FA_PLUS_CIRCLE "\xEF\x81\x95"
+#define ICON_FA_MINUS_CIRCLE "\xEF\x81\x96"
+#define ICON_FA_TIMES_CIRCLE "\xEF\x81\x97"
+#define ICON_FA_CHECK_CIRCLE "\xEF\x81\x98"
+#define ICON_FA_QUESTION_CIRCLE "\xEF\x81\x99"
+#define ICON_FA_INFO_CIRCLE "\xEF\x81\x9A"
+#define ICON_FA_CROSSHAIRS "\xEF\x81\x9B"
+#define ICON_FA_TIMES_CIRCLE_O "\xEF\x81\x9C"
+#define ICON_FA_CHECK_CIRCLE_O "\xEF\x81\x9D"
+#define ICON_FA_BAN "\xEF\x81\x9E"
+#define ICON_FA_ARROW_LEFT "\xEF\x81\xA0"
+#define ICON_FA_ARROW_RIGHT "\xEF\x81\xA1"
+#define ICON_FA_ARROW_UP "\xEF\x81\xA2"
+#define ICON_FA_ARROW_DOWN "\xEF\x81\xA3"
+#define ICON_FA_SHARE "\xEF\x81\xA4"
+#define ICON_FA_EXPAND "\xEF\x81\xA5"
+#define ICON_FA_COMPRESS "\xEF\x81\xA6"
+#define ICON_FA_PLUS "\xEF\x81\xA7"
+#define ICON_FA_MINUS "\xEF\x81\xA8"
+#define ICON_FA_ASTERISK "\xEF\x81\xA9"
+#define ICON_FA_EXCLAMATION_CIRCLE "\xEF\x81\xAA"
+#define ICON_FA_GIFT "\xEF\x81\xAB"
+#define ICON_FA_LEAF "\xEF\x81\xAC"
+#define ICON_FA_FIRE "\xEF\x81\xAD"
+#define ICON_FA_EYE "\xEF\x81\xAE"
+#define ICON_FA_EYE_SLASH "\xEF\x81\xB0"
+#define ICON_FA_EXCLAMATION_TRIANGLE "\xEF\x81\xB1"
+#define ICON_FA_PLANE "\xEF\x81\xB2"
+#define ICON_FA_CALENDAR "\xEF\x81\xB3"
+#define ICON_FA_RANDOM "\xEF\x81\xB4"
+#define ICON_FA_COMMENT "\xEF\x81\xB5"
+#define ICON_FA_MAGNET "\xEF\x81\xB6"
+#define ICON_FA_CHEVRON_UP "\xEF\x81\xB7"
+#define ICON_FA_CHEVRON_DOWN "\xEF\x81\xB8"
+#define ICON_FA_RETWEET "\xEF\x81\xB9"
+#define ICON_FA_SHOPPING_CART "\xEF\x81\xBA"
+#define ICON_FA_FOLDER "\xEF\x81\xBB"
+#define ICON_FA_FOLDER_OPEN "\xEF\x81\xBC"
+#define ICON_FA_ARROWS_V "\xEF\x81\xBD"
+#define ICON_FA_ARROWS_H "\xEF\x81\xBE"
+#define ICON_FA_BAR_CHART "\xEF\x82\x80"
+#define ICON_FA_TWITTER_SQUARE "\xEF\x82\x81"
+#define ICON_FA_FACEBOOK_SQUARE "\xEF\x82\x82"
+#define ICON_FA_CAMERA_RETRO "\xEF\x82\x83"
+#define ICON_FA_KEY "\xEF\x82\x84"
+#define ICON_FA_COGS "\xEF\x82\x85"
+#define ICON_FA_COMMENTS "\xEF\x82\x86"
+#define ICON_FA_THUMBS_O_UP "\xEF\x82\x87"
+#define ICON_FA_THUMBS_O_DOWN "\xEF\x82\x88"
+#define ICON_FA_STAR_HALF "\xEF\x82\x89"
+#define ICON_FA_HEART_O "\xEF\x82\x8A"
+#define ICON_FA_SIGN_OUT "\xEF\x82\x8B"
+#define ICON_FA_LINKEDIN_SQUARE "\xEF\x82\x8C"
+#define ICON_FA_THUMB_TACK "\xEF\x82\x8D"
+#define ICON_FA_EXTERNAL_LINK "\xEF\x82\x8E"
+#define ICON_FA_SIGN_IN "\xEF\x82\x90"
+#define ICON_FA_TROPHY "\xEF\x82\x91"
+#define ICON_FA_GITHUB_SQUARE "\xEF\x82\x92"
+#define ICON_FA_UPLOAD "\xEF\x82\x93"
+#define ICON_FA_LEMON_O "\xEF\x82\x94"
+#define ICON_FA_PHONE "\xEF\x82\x95"
+#define ICON_FA_SQUARE_O "\xEF\x82\x96"
+#define ICON_FA_BOOKMARK_O "\xEF\x82\x97"
+#define ICON_FA_PHONE_SQUARE "\xEF\x82\x98"
+#define ICON_FA_TWITTER "\xEF\x82\x99"
+#define ICON_FA_FACEBOOK "\xEF\x82\x9A"
+#define ICON_FA_GITHUB "\xEF\x82\x9B"
+#define ICON_FA_UNLOCK "\xEF\x82\x9C"
+#define ICON_FA_CREDIT_CARD "\xEF\x82\x9D"
+#define ICON_FA_RSS "\xEF\x82\x9E"
+#define ICON_FA_HDD_O "\xEF\x82\xA0"
+#define ICON_FA_BULLHORN "\xEF\x82\xA1"
+#define ICON_FA_BELL "\xEF\x83\xB3"
+#define ICON_FA_CERTIFICATE "\xEF\x82\xA3"
+#define ICON_FA_HAND_O_RIGHT "\xEF\x82\xA4"
+#define ICON_FA_HAND_O_LEFT "\xEF\x82\xA5"
+#define ICON_FA_HAND_O_UP "\xEF\x82\xA6"
+#define ICON_FA_HAND_O_DOWN "\xEF\x82\xA7"
+#define ICON_FA_ARROW_CIRCLE_LEFT "\xEF\x82\xA8"
+#define ICON_FA_ARROW_CIRCLE_RIGHT "\xEF\x82\xA9"
+#define ICON_FA_ARROW_CIRCLE_UP "\xEF\x82\xAA"
+#define ICON_FA_ARROW_CIRCLE_DOWN "\xEF\x82\xAB"
+#define ICON_FA_GLOBE "\xEF\x82\xAC"
+#define ICON_FA_WRENCH "\xEF\x82\xAD"
+#define ICON_FA_TASKS "\xEF\x82\xAE"
+#define ICON_FA_FILTER "\xEF\x82\xB0"
+#define ICON_FA_BRIEFCASE "\xEF\x82\xB1"
+#define ICON_FA_ARROWS_ALT "\xEF\x82\xB2"
+#define ICON_FA_USERS "\xEF\x83\x80"
+#define ICON_FA_LINK "\xEF\x83\x81"
+#define ICON_FA_CLOUD "\xEF\x83\x82"
+#define ICON_FA_FLASK "\xEF\x83\x83"
+#define ICON_FA_SCISSORS "\xEF\x83\x84"
+#define ICON_FA_FILES_O "\xEF\x83\x85"
+#define ICON_FA_PAPERCLIP "\xEF\x83\x86"
+#define ICON_FA_FLOPPY_O "\xEF\x83\x87"
+#define ICON_FA_SQUARE "\xEF\x83\x88"
+#define ICON_FA_BARS "\xEF\x83\x89"
+#define ICON_FA_LIST_UL "\xEF\x83\x8A"
+#define ICON_FA_LIST_OL "\xEF\x83\x8B"
+#define ICON_FA_STRIKETHROUGH "\xEF\x83\x8C"
+#define ICON_FA_UNDERLINE "\xEF\x83\x8D"
+#define ICON_FA_TABLE "\xEF\x83\x8E"
+#define ICON_FA_MAGIC "\xEF\x83\x90"
+#define ICON_FA_TRUCK "\xEF\x83\x91"
+#define ICON_FA_PINTEREST "\xEF\x83\x92"
+#define ICON_FA_PINTEREST_SQUARE "\xEF\x83\x93"
+#define ICON_FA_GOOGLE_PLUS_SQUARE "\xEF\x83\x94"
+#define ICON_FA_GOOGLE_PLUS "\xEF\x83\x95"
+#define ICON_FA_MONEY "\xEF\x83\x96"
+#define ICON_FA_CARET_DOWN "\xEF\x83\x97"
+#define ICON_FA_CARET_UP "\xEF\x83\x98"
+#define ICON_FA_CARET_LEFT "\xEF\x83\x99"
+#define ICON_FA_CARET_RIGHT "\xEF\x83\x9A"
+#define ICON_FA_COLUMNS "\xEF\x83\x9B"
+#define ICON_FA_SORT "\xEF\x83\x9C"
+#define ICON_FA_SORT_DESC "\xEF\x83\x9D"
+#define ICON_FA_SORT_ASC "\xEF\x83\x9E"
+#define ICON_FA_ENVELOPE "\xEF\x83\xA0"
+#define ICON_FA_LINKEDIN "\xEF\x83\xA1"
+#define ICON_FA_UNDO "\xEF\x83\xA2"
+#define ICON_FA_GAVEL "\xEF\x83\xA3"
+#define ICON_FA_TACHOMETER "\xEF\x83\xA4"
+#define ICON_FA_COMMENT_O "\xEF\x83\xA5"
+#define ICON_FA_COMMENTS_O "\xEF\x83\xA6"
+#define ICON_FA_BOLT "\xEF\x83\xA7"
+#define ICON_FA_SITEMAP "\xEF\x83\xA8"
+#define ICON_FA_UMBRELLA "\xEF\x83\xA9"
+#define ICON_FA_CLIPBOARD "\xEF\x83\xAA"
+#define ICON_FA_LIGHTBULB_O "\xEF\x83\xAB"
+#define ICON_FA_EXCHANGE "\xEF\x83\xAC"
+#define ICON_FA_CLOUD_DOWNLOAD "\xEF\x83\xAD"
+#define ICON_FA_CLOUD_UPLOAD "\xEF\x83\xAE"
+#define ICON_FA_USER_MD "\xEF\x83\xB0"
+#define ICON_FA_STETHOSCOPE "\xEF\x83\xB1"
+#define ICON_FA_SUITCASE "\xEF\x83\xB2"
+#define ICON_FA_BELL_O "\xEF\x82\xA2"
+#define ICON_FA_COFFEE "\xEF\x83\xB4"
+#define ICON_FA_CUTLERY "\xEF\x83\xB5"
+#define ICON_FA_FILE_TEXT_O "\xEF\x83\xB6"
+#define ICON_FA_BUILDING_O "\xEF\x83\xB7"
+#define ICON_FA_HOSPITAL_O "\xEF\x83\xB8"
+#define ICON_FA_AMBULANCE "\xEF\x83\xB9"
+#define ICON_FA_MEDKIT "\xEF\x83\xBA"
+#define ICON_FA_FIGHTER_JET "\xEF\x83\xBB"
+#define ICON_FA_BEER "\xEF\x83\xBC"
+#define ICON_FA_H_SQUARE "\xEF\x83\xBD"
+#define ICON_FA_PLUS_SQUARE "\xEF\x83\xBE"
+#define ICON_FA_ANGLE_DOUBLE_LEFT "\xEF\x84\x80"
+#define ICON_FA_ANGLE_DOUBLE_RIGHT "\xEF\x84\x81"
+#define ICON_FA_ANGLE_DOUBLE_UP "\xEF\x84\x82"
+#define ICON_FA_ANGLE_DOUBLE_DOWN "\xEF\x84\x83"
+#define ICON_FA_ANGLE_LEFT "\xEF\x84\x84"
+#define ICON_FA_ANGLE_RIGHT "\xEF\x84\x85"
+#define ICON_FA_ANGLE_UP "\xEF\x84\x86"
+#define ICON_FA_ANGLE_DOWN "\xEF\x84\x87"
+#define ICON_FA_DESKTOP "\xEF\x84\x88"
+#define ICON_FA_LAPTOP "\xEF\x84\x89"
+#define ICON_FA_TABLET "\xEF\x84\x8A"
+#define ICON_FA_MOBILE "\xEF\x84\x8B"
+#define ICON_FA_CIRCLE_O "\xEF\x84\x8C"
+#define ICON_FA_QUOTE_LEFT "\xEF\x84\x8D"
+#define ICON_FA_QUOTE_RIGHT "\xEF\x84\x8E"
+#define ICON_FA_SPINNER "\xEF\x84\x90"
+#define ICON_FA_CIRCLE "\xEF\x84\x91"
+#define ICON_FA_REPLY "\xEF\x84\x92"
+#define ICON_FA_GITHUB_ALT "\xEF\x84\x93"
+#define ICON_FA_FOLDER_O "\xEF\x84\x94"
+#define ICON_FA_FOLDER_OPEN_O "\xEF\x84\x95"
+#define ICON_FA_SMILE_O "\xEF\x84\x98"
+#define ICON_FA_FROWN_O "\xEF\x84\x99"
+#define ICON_FA_MEH_O "\xEF\x84\x9A"
+#define ICON_FA_GAMEPAD "\xEF\x84\x9B"
+#define ICON_FA_KEYBOARD_O "\xEF\x84\x9C"
+#define ICON_FA_FLAG_O "\xEF\x84\x9D"
+#define ICON_FA_FLAG_CHECKERED "\xEF\x84\x9E"
+#define ICON_FA_TERMINAL "\xEF\x84\xA0"
+#define ICON_FA_CODE "\xEF\x84\xA1"
+#define ICON_FA_REPLY_ALL "\xEF\x84\xA2"
+#define ICON_FA_STAR_HALF_O "\xEF\x84\xA3"
+#define ICON_FA_LOCATION_ARROW "\xEF\x84\xA4"
+#define ICON_FA_CROP "\xEF\x84\xA5"
+#define ICON_FA_CODE_FORK "\xEF\x84\xA6"
+#define ICON_FA_CHAIN_BROKEN "\xEF\x84\xA7"
+#define ICON_FA_QUESTION "\xEF\x84\xA8"
+#define ICON_FA_INFO "\xEF\x84\xA9"
+#define ICON_FA_EXCLAMATION "\xEF\x84\xAA"
+#define ICON_FA_SUPERSCRIPT "\xEF\x84\xAB"
+#define ICON_FA_SUBSCRIPT "\xEF\x84\xAC"
+#define ICON_FA_ERASER "\xEF\x84\xAD"
+#define ICON_FA_PUZZLE_PIECE "\xEF\x84\xAE"
+#define ICON_FA_MICROPHONE "\xEF\x84\xB0"
+#define ICON_FA_MICROPHONE_SLASH "\xEF\x84\xB1"
+#define ICON_FA_SHIELD "\xEF\x84\xB2"
+#define ICON_FA_CALENDAR_O "\xEF\x84\xB3"
+#define ICON_FA_FIRE_EXTINGUISHER "\xEF\x84\xB4"
+#define ICON_FA_ROCKET "\xEF\x84\xB5"
+#define ICON_FA_MAXCDN "\xEF\x84\xB6"
+#define ICON_FA_CHEVRON_CIRCLE_LEFT "\xEF\x84\xB7"
+#define ICON_FA_CHEVRON_CIRCLE_RIGHT "\xEF\x84\xB8"
+#define ICON_FA_CHEVRON_CIRCLE_UP "\xEF\x84\xB9"
+#define ICON_FA_CHEVRON_CIRCLE_DOWN "\xEF\x84\xBA"
+#define ICON_FA_HTML5 "\xEF\x84\xBB"
+#define ICON_FA_CSS3 "\xEF\x84\xBC"
+#define ICON_FA_ANCHOR "\xEF\x84\xBD"
+#define ICON_FA_UNLOCK_ALT "\xEF\x84\xBE"
+#define ICON_FA_BULLSEYE "\xEF\x85\x80"
+#define ICON_FA_ELLIPSIS_H "\xEF\x85\x81"
+#define ICON_FA_ELLIPSIS_V "\xEF\x85\x82"
+#define ICON_FA_RSS_SQUARE "\xEF\x85\x83"
+#define ICON_FA_PLAY_CIRCLE "\xEF\x85\x84"
+#define ICON_FA_TICKET "\xEF\x85\x85"
+#define ICON_FA_MINUS_SQUARE "\xEF\x85\x86"
+#define ICON_FA_MINUS_SQUARE_O "\xEF\x85\x87"
+#define ICON_FA_LEVEL_UP "\xEF\x85\x88"
+#define ICON_FA_LEVEL_DOWN "\xEF\x85\x89"
+#define ICON_FA_CHECK_SQUARE "\xEF\x85\x8A"
+#define ICON_FA_PENCIL_SQUARE "\xEF\x85\x8B"
+#define ICON_FA_EXTERNAL_LINK_SQUARE "\xEF\x85\x8C"
+#define ICON_FA_SHARE_SQUARE "\xEF\x85\x8D"
+#define ICON_FA_COMPASS "\xEF\x85\x8E"
+#define ICON_FA_CARET_SQUARE_O_DOWN "\xEF\x85\x90"
+#define ICON_FA_CARET_SQUARE_O_UP "\xEF\x85\x91"
+#define ICON_FA_CARET_SQUARE_O_RIGHT "\xEF\x85\x92"
+#define ICON_FA_EUR "\xEF\x85\x93"
+#define ICON_FA_GBP "\xEF\x85\x94"
+#define ICON_FA_USD "\xEF\x85\x95"
+#define ICON_FA_INR "\xEF\x85\x96"
+#define ICON_FA_JPY "\xEF\x85\x97"
+#define ICON_FA_RUB "\xEF\x85\x98"
+#define ICON_FA_KRW "\xEF\x85\x99"
+#define ICON_FA_BTC "\xEF\x85\x9A"
+#define ICON_FA_FILE "\xEF\x85\x9B"
+#define ICON_FA_FILE_TEXT "\xEF\x85\x9C"
+#define ICON_FA_SORT_ALPHA_ASC "\xEF\x85\x9D"
+#define ICON_FA_SORT_ALPHA_DESC "\xEF\x85\x9E"
+#define ICON_FA_SORT_AMOUNT_ASC "\xEF\x85\xA0"
+#define ICON_FA_SORT_AMOUNT_DESC "\xEF\x85\xA1"
+#define ICON_FA_SORT_NUMERIC_ASC "\xEF\x85\xA2"
+#define ICON_FA_SORT_NUMERIC_DESC "\xEF\x85\xA3"
+#define ICON_FA_THUMBS_UP "\xEF\x85\xA4"
+#define ICON_FA_THUMBS_DOWN "\xEF\x85\xA5"
+#define ICON_FA_YOUTUBE_SQUARE "\xEF\x85\xA6"
+#define ICON_FA_YOUTUBE "\xEF\x85\xA7"
+#define ICON_FA_XING "\xEF\x85\xA8"
+#define ICON_FA_XING_SQUARE "\xEF\x85\xA9"
+#define ICON_FA_YOUTUBE_PLAY "\xEF\x85\xAA"
+#define ICON_FA_DROPBOX "\xEF\x85\xAB"
+#define ICON_FA_STACK_OVERFLOW "\xEF\x85\xAC"
+#define ICON_FA_INSTAGRAM "\xEF\x85\xAD"
+#define ICON_FA_FLICKR "\xEF\x85\xAE"
+#define ICON_FA_ADN "\xEF\x85\xB0"
+#define ICON_FA_BITBUCKET "\xEF\x85\xB1"
+#define ICON_FA_BITBUCKET_SQUARE "\xEF\x85\xB2"
+#define ICON_FA_TUMBLR "\xEF\x85\xB3"
+#define ICON_FA_TUMBLR_SQUARE "\xEF\x85\xB4"
+#define ICON_FA_LONG_ARROW_DOWN "\xEF\x85\xB5"
+#define ICON_FA_LONG_ARROW_UP "\xEF\x85\xB6"
+#define ICON_FA_LONG_ARROW_LEFT "\xEF\x85\xB7"
+#define ICON_FA_LONG_ARROW_RIGHT "\xEF\x85\xB8"
+#define ICON_FA_APPLE "\xEF\x85\xB9"
+#define ICON_FA_WINDOWS "\xEF\x85\xBA"
+#define ICON_FA_ANDROID "\xEF\x85\xBB"
+#define ICON_FA_LINUX "\xEF\x85\xBC"
+#define ICON_FA_DRIBBBLE "\xEF\x85\xBD"
+#define ICON_FA_SKYPE "\xEF\x85\xBE"
+#define ICON_FA_FOURSQUARE "\xEF\x86\x80"
+#define ICON_FA_TRELLO "\xEF\x86\x81"
+#define ICON_FA_FEMALE "\xEF\x86\x82"
+#define ICON_FA_MALE "\xEF\x86\x83"
+#define ICON_FA_GRATIPAY "\xEF\x86\x84"
+#define ICON_FA_SUN_O "\xEF\x86\x85"
+#define ICON_FA_MOON_O "\xEF\x86\x86"
+#define ICON_FA_ARCHIVE "\xEF\x86\x87"
+#define ICON_FA_BUG "\xEF\x86\x88"
+#define ICON_FA_VK "\xEF\x86\x89"
+#define ICON_FA_WEIBO "\xEF\x86\x8A"
+#define ICON_FA_RENREN "\xEF\x86\x8B"
+#define ICON_FA_PAGELINES "\xEF\x86\x8C"
+#define ICON_FA_STACK_EXCHANGE "\xEF\x86\x8D"
+#define ICON_FA_ARROW_CIRCLE_O_RIGHT "\xEF\x86\x8E"
+#define ICON_FA_ARROW_CIRCLE_O_LEFT "\xEF\x86\x90"
+#define ICON_FA_CARET_SQUARE_O_LEFT "\xEF\x86\x91"
+#define ICON_FA_DOT_CIRCLE_O "\xEF\x86\x92"
+#define ICON_FA_WHEELCHAIR "\xEF\x86\x93"
+#define ICON_FA_VIMEO_SQUARE "\xEF\x86\x94"
+#define ICON_FA_TRY "\xEF\x86\x95"
+#define ICON_FA_PLUS_SQUARE_O "\xEF\x86\x96"
+#define ICON_FA_SPACE_SHUTTLE "\xEF\x86\x97"
+#define ICON_FA_SLACK "\xEF\x86\x98"
+#define ICON_FA_ENVELOPE_SQUARE "\xEF\x86\x99"
+#define ICON_FA_WORDPRESS "\xEF\x86\x9A"
+#define ICON_FA_OPENID "\xEF\x86\x9B"
+#define ICON_FA_UNIVERSITY "\xEF\x86\x9C"
+#define ICON_FA_GRADUATION_CAP "\xEF\x86\x9D"
+#define ICON_FA_YAHOO "\xEF\x86\x9E"
+#define ICON_FA_GOOGLE "\xEF\x86\xA0"
+#define ICON_FA_REDDIT "\xEF\x86\xA1"
+#define ICON_FA_REDDIT_SQUARE "\xEF\x86\xA2"
+#define ICON_FA_STUMBLEUPON_CIRCLE "\xEF\x86\xA3"
+#define ICON_FA_STUMBLEUPON "\xEF\x86\xA4"
+#define ICON_FA_DELICIOUS "\xEF\x86\xA5"
+#define ICON_FA_DIGG "\xEF\x86\xA6"
+#define ICON_FA_PIED_PIPER "\xEF\x86\xA7"
+#define ICON_FA_PIED_PIPER_ALT "\xEF\x86\xA8"
+#define ICON_FA_DRUPAL "\xEF\x86\xA9"
+#define ICON_FA_JOOMLA "\xEF\x86\xAA"
+#define ICON_FA_LANGUAGE "\xEF\x86\xAB"
+#define ICON_FA_FAX "\xEF\x86\xAC"
+#define ICON_FA_BUILDING "\xEF\x86\xAD"
+#define ICON_FA_CHILD "\xEF\x86\xAE"
+#define ICON_FA_PAW "\xEF\x86\xB0"
+#define ICON_FA_SPOON "\xEF\x86\xB1"
+#define ICON_FA_CUBE "\xEF\x86\xB2"
+#define ICON_FA_CUBES "\xEF\x86\xB3"
+#define ICON_FA_BEHANCE "\xEF\x86\xB4"
+#define ICON_FA_BEHANCE_SQUARE "\xEF\x86\xB5"
+#define ICON_FA_STEAM "\xEF\x86\xB6"
+#define ICON_FA_STEAM_SQUARE "\xEF\x86\xB7"
+#define ICON_FA_RECYCLE "\xEF\x86\xB8"
+#define ICON_FA_CAR "\xEF\x86\xB9"
+#define ICON_FA_TAXI "\xEF\x86\xBA"
+#define ICON_FA_TREE "\xEF\x86\xBB"
+#define ICON_FA_SPOTIFY "\xEF\x86\xBC"
+#define ICON_FA_DEVIANTART "\xEF\x86\xBD"
+#define ICON_FA_SOUNDCLOUD "\xEF\x86\xBE"
+#define ICON_FA_DATABASE "\xEF\x87\x80"
+#define ICON_FA_FILE_PDF_O "\xEF\x87\x81"
+#define ICON_FA_FILE_WORD_O "\xEF\x87\x82"
+#define ICON_FA_FILE_EXCEL_O "\xEF\x87\x83"
+#define ICON_FA_FILE_POWERPOINT_O "\xEF\x87\x84"
+#define ICON_FA_FILE_IMAGE_O "\xEF\x87\x85"
+#define ICON_FA_FILE_ARCHIVE_O "\xEF\x87\x86"
+#define ICON_FA_FILE_AUDIO_O "\xEF\x87\x87"
+#define ICON_FA_FILE_VIDEO_O "\xEF\x87\x88"
+#define ICON_FA_FILE_CODE_O "\xEF\x87\x89"
+#define ICON_FA_VINE "\xEF\x87\x8A"
+#define ICON_FA_CODEPEN "\xEF\x87\x8B"
+#define ICON_FA_JSFIDDLE "\xEF\x87\x8C"
+#define ICON_FA_LIFE_RING "\xEF\x87\x8D"
+#define ICON_FA_CIRCLE_O_NOTCH "\xEF\x87\x8E"
+#define ICON_FA_REBEL "\xEF\x87\x90"
+#define ICON_FA_EMPIRE "\xEF\x87\x91"
+#define ICON_FA_GIT_SQUARE "\xEF\x87\x92"
+#define ICON_FA_GIT "\xEF\x87\x93"
+#define ICON_FA_HACKER_NEWS "\xEF\x87\x94"
+#define ICON_FA_TENCENT_WEIBO "\xEF\x87\x95"
+#define ICON_FA_QQ "\xEF\x87\x96"
+#define ICON_FA_WEIXIN "\xEF\x87\x97"
+#define ICON_FA_PAPER_PLANE "\xEF\x87\x98"
+#define ICON_FA_PAPER_PLANE_O "\xEF\x87\x99"
+#define ICON_FA_HISTORY "\xEF\x87\x9A"
+#define ICON_FA_CIRCLE_THIN "\xEF\x87\x9B"
+#define ICON_FA_HEADER "\xEF\x87\x9C"
+#define ICON_FA_PARAGRAPH "\xEF\x87\x9D"
+#define ICON_FA_SLIDERS "\xEF\x87\x9E"
+#define ICON_FA_SHARE_ALT "\xEF\x87\xA0"
+#define ICON_FA_SHARE_ALT_SQUARE "\xEF\x87\xA1"
+#define ICON_FA_BOMB "\xEF\x87\xA2"
+#define ICON_FA_FUTBOL_O "\xEF\x87\xA3"
+#define ICON_FA_TTY "\xEF\x87\xA4"
+#define ICON_FA_BINOCULARS "\xEF\x87\xA5"
+#define ICON_FA_PLUG "\xEF\x87\xA6"
+#define ICON_FA_SLIDESHARE "\xEF\x87\xA7"
+#define ICON_FA_TWITCH "\xEF\x87\xA8"
+#define ICON_FA_YELP "\xEF\x87\xA9"
+#define ICON_FA_NEWSPAPER_O "\xEF\x87\xAA"
+#define ICON_FA_WIFI "\xEF\x87\xAB"
+#define ICON_FA_CALCULATOR "\xEF\x87\xAC"
+#define ICON_FA_PAYPAL "\xEF\x87\xAD"
+#define ICON_FA_GOOGLE_WALLET "\xEF\x87\xAE"
+#define ICON_FA_CC_VISA "\xEF\x87\xB0"
+#define ICON_FA_CC_MASTERCARD "\xEF\x87\xB1"
+#define ICON_FA_CC_DISCOVER "\xEF\x87\xB2"
+#define ICON_FA_CC_AMEX "\xEF\x87\xB3"
+#define ICON_FA_CC_PAYPAL "\xEF\x87\xB4"
+#define ICON_FA_CC_STRIPE "\xEF\x87\xB5"
+#define ICON_FA_BELL_SLASH "\xEF\x87\xB6"
+#define ICON_FA_BELL_SLASH_O "\xEF\x87\xB7"
+#define ICON_FA_TRASH "\xEF\x87\xB8"
+#define ICON_FA_COPYRIGHT "\xEF\x87\xB9"
+#define ICON_FA_AT "\xEF\x87\xBA"
+#define ICON_FA_EYEDROPPER "\xEF\x87\xBB"
+#define ICON_FA_PAINT_BRUSH "\xEF\x87\xBC"
+#define ICON_FA_BIRTHDAY_CAKE "\xEF\x87\xBD"
+#define ICON_FA_AREA_CHART "\xEF\x87\xBE"
+#define ICON_FA_PIE_CHART "\xEF\x88\x80"
+#define ICON_FA_LINE_CHART "\xEF\x88\x81"
+#define ICON_FA_LASTFM "\xEF\x88\x82"
+#define ICON_FA_LASTFM_SQUARE "\xEF\x88\x83"
+#define ICON_FA_TOGGLE_OFF "\xEF\x88\x84"
+#define ICON_FA_TOGGLE_ON "\xEF\x88\x85"
+#define ICON_FA_BICYCLE "\xEF\x88\x86"
+#define ICON_FA_BUS "\xEF\x88\x87"
+#define ICON_FA_IOXHOST "\xEF\x88\x88"
+#define ICON_FA_ANGELLIST "\xEF\x88\x89"
+#define ICON_FA_CC "\xEF\x88\x8A"
+#define ICON_FA_ILS "\xEF\x88\x8B"
+#define ICON_FA_MEANPATH "\xEF\x88\x8C"
+#define ICON_FA_BUYSELLADS "\xEF\x88\x8D"
+#define ICON_FA_CONNECTDEVELOP "\xEF\x88\x8E"
+#define ICON_FA_DASHCUBE "\xEF\x88\x90"
+#define ICON_FA_FORUMBEE "\xEF\x88\x91"
+#define ICON_FA_LEANPUB "\xEF\x88\x92"
+#define ICON_FA_SELLSY "\xEF\x88\x93"
+#define ICON_FA_SHIRTSINBULK "\xEF\x88\x94"
+#define ICON_FA_SIMPLYBUILT "\xEF\x88\x95"
+#define ICON_FA_SKYATLAS "\xEF\x88\x96"
+#define ICON_FA_CART_PLUS "\xEF\x88\x97"
+#define ICON_FA_CART_ARROW_DOWN "\xEF\x88\x98"
+#define ICON_FA_DIAMOND "\xEF\x88\x99"
+#define ICON_FA_SHIP "\xEF\x88\x9A"
+#define ICON_FA_USER_SECRET "\xEF\x88\x9B"
+#define ICON_FA_MOTORCYCLE "\xEF\x88\x9C"
+#define ICON_FA_STREET_VIEW "\xEF\x88\x9D"
+#define ICON_FA_HEARTBEAT "\xEF\x88\x9E"
+#define ICON_FA_VENUS "\xEF\x88\xA1"
+#define ICON_FA_MARS "\xEF\x88\xA2"
+#define ICON_FA_MERCURY "\xEF\x88\xA3"
+#define ICON_FA_TRANSGENDER "\xEF\x88\xA4"
+#define ICON_FA_TRANSGENDER_ALT "\xEF\x88\xA5"
+#define ICON_FA_VENUS_DOUBLE "\xEF\x88\xA6"
+#define ICON_FA_MARS_DOUBLE "\xEF\x88\xA7"
+#define ICON_FA_VENUS_MARS "\xEF\x88\xA8"
+#define ICON_FA_MARS_STROKE "\xEF\x88\xA9"
+#define ICON_FA_MARS_STROKE_V "\xEF\x88\xAA"
+#define ICON_FA_MARS_STROKE_H "\xEF\x88\xAB"
+#define ICON_FA_NEUTER "\xEF\x88\xAC"
+#define ICON_FA_GENDERLESS "\xEF\x88\xAD"
+#define ICON_FA_FACEBOOK_OFFICIAL "\xEF\x88\xB0"
+#define ICON_FA_PINTEREST_P "\xEF\x88\xB1"
+#define ICON_FA_WHATSAPP "\xEF\x88\xB2"
+#define ICON_FA_SERVER "\xEF\x88\xB3"
+#define ICON_FA_USER_PLUS "\xEF\x88\xB4"
+#define ICON_FA_USER_TIMES "\xEF\x88\xB5"
+#define ICON_FA_BED "\xEF\x88\xB6"
+#define ICON_FA_VIACOIN "\xEF\x88\xB7"
+#define ICON_FA_TRAIN "\xEF\x88\xB8"
+#define ICON_FA_SUBWAY "\xEF\x88\xB9"
+#define ICON_FA_MEDIUM "\xEF\x88\xBA"
+#define ICON_FA_Y_COMBINATOR "\xEF\x88\xBB"
+#define ICON_FA_OPTIN_MONSTER "\xEF\x88\xBC"
+#define ICON_FA_OPENCART "\xEF\x88\xBD"
+#define ICON_FA_EXPEDITEDSSL "\xEF\x88\xBE"
+#define ICON_FA_BATTERY_FULL "\xEF\x89\x80"
+#define ICON_FA_BATTERY_THREE_QUARTERS "\xEF\x89\x81"
+#define ICON_FA_BATTERY_HALF "\xEF\x89\x82"
+#define ICON_FA_BATTERY_QUARTER "\xEF\x89\x83"
+#define ICON_FA_BATTERY_EMPTY "\xEF\x89\x84"
+#define ICON_FA_MOUSE_POINTER "\xEF\x89\x85"
+#define ICON_FA_I_CURSOR "\xEF\x89\x86"
+#define ICON_FA_OBJECT_GROUP "\xEF\x89\x87"
+#define ICON_FA_OBJECT_UNGROUP "\xEF\x89\x88"
+#define ICON_FA_STICKY_NOTE "\xEF\x89\x89"
+#define ICON_FA_STICKY_NOTE_O "\xEF\x89\x8A"
+#define ICON_FA_CC_JCB "\xEF\x89\x8B"
+#define ICON_FA_CC_DINERS_CLUB "\xEF\x89\x8C"
+#define ICON_FA_CLONE "\xEF\x89\x8D"
+#define ICON_FA_BALANCE_SCALE "\xEF\x89\x8E"
+#define ICON_FA_HOURGLASS_O "\xEF\x89\x90"
+#define ICON_FA_HOURGLASS_START "\xEF\x89\x91"
+#define ICON_FA_HOURGLASS_HALF "\xEF\x89\x92"
+#define ICON_FA_HOURGLASS_END "\xEF\x89\x93"
+#define ICON_FA_HOURGLASS "\xEF\x89\x94"
+#define ICON_FA_HAND_ROCK_O "\xEF\x89\x95"
+#define ICON_FA_HAND_PAPER_O "\xEF\x89\x96"
+#define ICON_FA_HAND_SCISSORS_O "\xEF\x89\x97"
+#define ICON_FA_HAND_LIZARD_O "\xEF\x89\x98"
+#define ICON_FA_HAND_SPOCK_O "\xEF\x89\x99"
+#define ICON_FA_HAND_POINTER_O "\xEF\x89\x9A"
+#define ICON_FA_HAND_PEACE_O "\xEF\x89\x9B"
+#define ICON_FA_TRADEMARK "\xEF\x89\x9C"
+#define ICON_FA_REGISTERED "\xEF\x89\x9D"
+#define ICON_FA_CREATIVE_COMMONS "\xEF\x89\x9E"
+#define ICON_FA_GG "\xEF\x89\xA0"
+#define ICON_FA_GG_CIRCLE "\xEF\x89\xA1"
+#define ICON_FA_TRIPADVISOR "\xEF\x89\xA2"
+#define ICON_FA_ODNOKLASSNIKI "\xEF\x89\xA3"
+#define ICON_FA_ODNOKLASSNIKI_SQUARE "\xEF\x89\xA4"
+#define ICON_FA_GET_POCKET "\xEF\x89\xA5"
+#define ICON_FA_WIKIPEDIA_W "\xEF\x89\xA6"
+#define ICON_FA_SAFARI "\xEF\x89\xA7"
+#define ICON_FA_CHROME "\xEF\x89\xA8"
+#define ICON_FA_FIREFOX "\xEF\x89\xA9"
+#define ICON_FA_OPERA "\xEF\x89\xAA"
+#define ICON_FA_INTERNET_EXPLORER "\xEF\x89\xAB"
+#define ICON_FA_TELEVISION "\xEF\x89\xAC"
+#define ICON_FA_CONTAO "\xEF\x89\xAD"
+#define ICON_FA_500PX "\xEF\x89\xAE"
+#define ICON_FA_AMAZON "\xEF\x89\xB0"
+#define ICON_FA_CALENDAR_PLUS_O "\xEF\x89\xB1"
+#define ICON_FA_CALENDAR_MINUS_O "\xEF\x89\xB2"
+#define ICON_FA_CALENDAR_TIMES_O "\xEF\x89\xB3"
+#define ICON_FA_CALENDAR_CHECK_O "\xEF\x89\xB4"
+#define ICON_FA_INDUSTRY "\xEF\x89\xB5"
+#define ICON_FA_MAP_PIN "\xEF\x89\xB6"
+#define ICON_FA_MAP_SIGNS "\xEF\x89\xB7"
+#define ICON_FA_MAP_O "\xEF\x89\xB8"
+#define ICON_FA_MAP "\xEF\x89\xB9"
+#define ICON_FA_COMMENTING "\xEF\x89\xBA"
+#define ICON_FA_COMMENTING_O "\xEF\x89\xBB"
+#define ICON_FA_HOUZZ "\xEF\x89\xBC"
+#define ICON_FA_VIMEO "\xEF\x89\xBD"
+#define ICON_FA_BLACK_TIE "\xEF\x89\xBE"
+#define ICON_FA_FONTICONS "\xEF\x8A\x80"
+#define ICON_FA_REDDIT_ALIEN "\xEF\x8A\x81"
+#define ICON_FA_EDGE "\xEF\x8A\x82"
+#define ICON_FA_CREDIT_CARD_ALT "\xEF\x8A\x83"
+#define ICON_FA_CODIEPIE "\xEF\x8A\x84"
+#define ICON_FA_MODX "\xEF\x8A\x85"
+#define ICON_FA_FORT_AWESOME "\xEF\x8A\x86"
+#define ICON_FA_USB "\xEF\x8A\x87"
+#define ICON_FA_PRODUCT_HUNT "\xEF\x8A\x88"
+#define ICON_FA_MIXCLOUD "\xEF\x8A\x89"
+#define ICON_FA_SCRIBD "\xEF\x8A\x8A"
+#define ICON_FA_PAUSE_CIRCLE "\xEF\x8A\x8B"
+#define ICON_FA_PAUSE_CIRCLE_O "\xEF\x8A\x8C"
+#define ICON_FA_STOP_CIRCLE "\xEF\x8A\x8D"
+#define ICON_FA_STOP_CIRCLE_O "\xEF\x8A\x8E"
+#define ICON_FA_SHOPPING_BAG "\xEF\x8A\x90"
+#define ICON_FA_SHOPPING_BASKET "\xEF\x8A\x91"
+#define ICON_FA_HASHTAG "\xEF\x8A\x92"
+#define ICON_FA_BLUETOOTH "\xEF\x8A\x93"
+#define ICON_FA_BLUETOOTH_B "\xEF\x8A\x94"
+#define ICON_FA_PERCENT "\xEF\x8A\x95"
diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h
new file mode 100644
index 00000000000..dbbcb48d904
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h
@@ -0,0 +1,234 @@
+// Generated by GenerateIconFontCppHeaders.py
+// from https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css
+#pragma once
+
+#define ICON_MIN_KI 0xe900
+#define ICON_MAX_KI 0xe9e3
+#define ICON_KI_HOME "\xEE\xA4\x80"
+#define ICON_KI_ADJUST "\xEE\xA4\x81"
+#define ICON_KI_WRENCH "\xEE\xA4\x82"
+#define ICON_KI_COG "\xEE\xA4\x83"
+#define ICON_KI_OFF "\xEE\xA4\x84"
+#define ICON_KI_EXPAND "\xEE\xA4\x85"
+#define ICON_KI_REDUCE "\xEE\xA4\x86"
+#define ICON_KI_MOVIE "\xEE\xA4\x87"
+#define ICON_KI_FLAP "\xEE\xA4\x88"
+#define ICON_KI_SHOPPING_CART "\xEE\xA4\x89"
+#define ICON_KI_SHOPPING_CASE "\xEE\xA4\x8A"
+#define ICON_KI_EXTERNAL "\xEE\xA4\x8B"
+#define ICON_KI_NETWORK "\xEE\xA4\x8C"
+#define ICON_KI_CHECK "\xEE\xA4\x8D"
+#define ICON_KI_TIMES "\xEE\xA4\x8E"
+#define ICON_KI_TIMES_CIRCLE "\xEE\xA4\x8F"
+#define ICON_KI_PLUS "\xEE\xA4\x90"
+#define ICON_KI_PLUS_CIRCLE "\xEE\xA4\x91"
+#define ICON_KI_MINUS "\xEE\xA4\x92"
+#define ICON_KI_MINUS_CIRCLE "\xEE\xA4\x93"
+#define ICON_KI_INFO "\xEE\xA4\x94"
+#define ICON_KI_INFO_CIRCLE "\xEE\xA4\x95"
+#define ICON_KI_QUESTION "\xEE\xA4\x96"
+#define ICON_KI_QUESTION_CIRCLE "\xEE\xA4\x97"
+#define ICON_KI_EXLAMATION "\xEE\xA4\x98"
+#define ICON_KI_EXCLAMATION_CIRCLE "\xEE\xA4\x99"
+#define ICON_KI_EXCLAMATION_TRIANGLE "\xEE\xA4\x9A"
+#define ICON_KI_PAINT_BRUSH "\xEE\xA4\x9B"
+#define ICON_KI_PENCIL "\xEE\xA4\x9C"
+#define ICON_KI_CHECKBOX "\xEE\xA4\x9D"
+#define ICON_KI_CHECKBOX_CHECKED "\xEE\xA4\x9E"
+#define ICON_KI_RADIO "\xEE\xA4\x9F"
+#define ICON_KI_RADIO_CHECKED "\xEE\xA4\xA0"
+#define ICON_KI_SORT_VERTICAL "\xEE\xA4\xA1"
+#define ICON_KI_SORT_HORIZONTAL "\xEE\xA4\xA2"
+#define ICON_KI_GRID "\xEE\xA4\xA3"
+#define ICON_KI_LIST "\xEE\xA4\xA4"
+#define ICON_KI_ROWS "\xEE\xA4\xA5"
+#define ICON_KI_CELLS "\xEE\xA4\xA6"
+#define ICON_KI_SIGNAL_LOW "\xEE\xA4\xA7"
+#define ICON_KI_SIGNAL_MEDIUM "\xEE\xA4\xA8"
+#define ICON_KI_SIGNAL_HIGH "\xEE\xA4\xA9"
+#define ICON_KI_TRASH "\xEE\xA4\xAA"
+#define ICON_KI_TRASH_ALT "\xEE\xA4\xAB"
+#define ICON_KI_RELOAD_INVERSE "\xEE\xA4\xAC"
+#define ICON_KI_RELOAD "\xEE\xA4\xAD"
+#define ICON_KI_TOP "\xEE\xA4\xAE"
+#define ICON_KI_BOTTOM "\xEE\xA4\xAF"
+#define ICON_KI_UPLOAD "\xEE\xA4\xB0"
+#define ICON_KI_DOWNLOAD "\xEE\xA4\xB1"
+#define ICON_KI_CLOUD "\xEE\xA4\xB2"
+#define ICON_KI_CLOUD_UPLOAD "\xEE\xA4\xB3"
+#define ICON_KI_CLOUD_DOWNLOAD "\xEE\xA4\xB4"
+#define ICON_KI_SEARCH "\xEE\xA4\xB5"
+#define ICON_KI_SEARCH_PLUS "\xEE\xA4\xB6"
+#define ICON_KI_SEARCH_MINUS "\xEE\xA4\xB7"
+#define ICON_KI_SEARCH_EQUAL "\xEE\xA4\xB8"
+#define ICON_KI_LOCK "\xEE\xA4\xB9"
+#define ICON_KI_UNLOCK "\xEE\xA4\xBA"
+#define ICON_KI_USER "\xEE\xA4\xBB"
+#define ICON_KI_USERS "\xEE\xA4\xBC"
+#define ICON_KI_USERS_ALT "\xEE\xA4\xBD"
+#define ICON_KI_SIGN_IN "\xEE\xA4\xBE"
+#define ICON_KI_SIGN_IN_INVERSE "\xEE\xA4\xBF"
+#define ICON_KI_SIGN_OUT "\xEE\xA5\x80"
+#define ICON_KI_SIGN_OUT_INVERSE "\xEE\xA5\x81"
+#define ICON_KI_ARROW_TOP "\xEE\xA5\x82"
+#define ICON_KI_ARROW_RIGHT "\xEE\xA5\x83"
+#define ICON_KI_ARROW_BOTTOM "\xEE\xA5\x84"
+#define ICON_KI_ARROW_LEFT "\xEE\xA5\x85"
+#define ICON_KI_ARROW_TOP_LEFT "\xEE\xA5\x86"
+#define ICON_KI_ARROW_TOP_RIGHT "\xEE\xA5\x87"
+#define ICON_KI_ARROW_BOTTOM_RIGHT "\xEE\xA5\x88"
+#define ICON_KI_ARROW_BOTTOM_LEFT "\xEE\xA5\x89"
+#define ICON_KI_CARET_TOP "\xEE\xA5\x8A"
+#define ICON_KI_CARET_RIGHT "\xEE\xA5\x8B"
+#define ICON_KI_CARET_BOTTOM "\xEE\xA5\x8C"
+#define ICON_KI_CARET_LEFT "\xEE\xA5\x8D"
+#define ICON_KI_NEXT_ALT "\xEE\xA5\x8E"
+#define ICON_KI_NEXT "\xEE\xA5\x8F"
+#define ICON_KI_PREVIOUS "\xEE\xA5\x90"
+#define ICON_KI_PREVIOUS_ALT "\xEE\xA5\x91"
+#define ICON_KI_FILL "\xEE\xA5\x92"
+#define ICON_KI_ERASER "\xEE\xA5\x93"
+#define ICON_KI_SAVE "\xEE\xA5\x94"
+#define ICON_KI_STEP_BACKWARD "\xEE\xA5\x95"
+#define ICON_KI_BACKWARD "\xEE\xA5\x96"
+#define ICON_KI_PAUSE "\xEE\xA5\x97"
+#define ICON_KI_FORWARD "\xEE\xA5\x98"
+#define ICON_KI_STEP_FORWARD "\xEE\xA5\x99"
+#define ICON_KI_STOP "\xEE\xA5\x9A"
+#define ICON_KI_REC "\xEE\xA5\x9B"
+#define ICON_KI_CURSOR "\xEE\xA5\x9C"
+#define ICON_KI_POINTER "\xEE\xA5\x9D"
+#define ICON_KI_EXIT "\xEE\xA5\x9E"
+#define ICON_KI_FIGURE "\xEE\xA5\x9F"
+#define ICON_KI_CAR "\xEE\xA5\xA0"
+#define ICON_KI_COIN "\xEE\xA5\xA1"
+#define ICON_KI_KEY "\xEE\xA5\xA2"
+#define ICON_KI_CUB "\xEE\xA5\xA3"
+#define ICON_KI_DIAMOND "\xEE\xA5\xA4"
+#define ICON_KI_BADGE "\xEE\xA5\xA5"
+#define ICON_KI_BADGE_ALT "\xEE\xA5\xA6"
+#define ICON_KI_PODIUM "\xEE\xA5\xA7"
+#define ICON_KI_PODIUM_ALT "\xEE\xA5\xA8"
+#define ICON_KI_FLAG "\xEE\xA5\xA9"
+#define ICON_KI_FIST "\xEE\xA5\xAA"
+#define ICON_KI_FIST_CIRCLE "\xEE\xA5\xAB"
+#define ICON_KI_HEART "\xEE\xA5\xAC"
+#define ICON_KI_HEART_HALF "\xEE\xA5\xAD"
+#define ICON_KI_HEART_HALF_O "\xEE\xA5\xAE"
+#define ICON_KI_HEART_O "\xEE\xA5\xAF"
+#define ICON_KI_STAR "\xEE\xA5\xB0"
+#define ICON_KI_STAR_HALF "\xEE\xA5\xB1"
+#define ICON_KI_STAR_HALF_O "\xEE\xA5\xB2"
+#define ICON_KI_STAR_O "\xEE\xA5\xB3"
+#define ICON_KI_BUTTON_B "\xEE\xA5\xB4"
+#define ICON_KI_MUSIC_ON "\xEE\xA5\xB5"
+#define ICON_KI_MUSIC_OFF "\xEE\xA5\xB6"
+#define ICON_KI_SOUND_ON "\xEE\xA5\xB7"
+#define ICON_KI_SOUND_OFF "\xEE\xA5\xB8"
+#define ICON_KI_SOUND_OFF_ALT "\xEE\xA5\xB9"
+#define ICON_KI_ROBOT "\xEE\xA5\xBA"
+#define ICON_KI_COMPUTER "\xEE\xA5\xBB"
+#define ICON_KI_TABLET "\xEE\xA5\xBC"
+#define ICON_KI_SMARTPHONE "\xEE\xA5\xBD"
+#define ICON_KI_DEVICE "\xEE\xA5\xBE"
+#define ICON_KI_DEVICE_TILT_LEFT "\xEE\xA5\xBF"
+#define ICON_KI_DEVICE_TILT_RIGHT "\xEE\xA6\x80"
+#define ICON_KI_GAMEPAD "\xEE\xA6\x81"
+#define ICON_KI_GAMEPAD_ALT "\xEE\xA6\x82"
+#define ICON_KI_GAMEPAD_TILT_LEFT "\xEE\xA6\x83"
+#define ICON_KI_GAMEPAD_TILT_RIGHT "\xEE\xA6\x84"
+#define ICON_KI_PLAYER_ONE "\xEE\xA6\x85"
+#define ICON_KI_PLAYER_TWO "\xEE\xA6\x86"
+#define ICON_KI_PLAYER_THREE "\xEE\xA6\x87"
+#define ICON_KI_PLAYER_FOUR "\xEE\xA6\x88"
+#define ICON_KI_JOYSTICK "\xEE\xA6\x89"
+#define ICON_KI_JOYSTICK_ALT "\xEE\xA6\x8A"
+#define ICON_KI_JOYSTICK_LEFT "\xEE\xA6\x8B"
+#define ICON_KI_JOYSTICK_RIGHT "\xEE\xA6\x8C"
+#define ICON_KI_MOUSE_ALT "\xEE\xA6\x8D"
+#define ICON_KI_MOUSE "\xEE\xA6\x8E"
+#define ICON_KI_MOUSE_LEFT_BUTTON "\xEE\xA6\x8F"
+#define ICON_KI_MOUSE_RIGHT_BUTTON "\xEE\xA6\x90"
+#define ICON_KI_BUTTON_ONE "\xEE\xA6\x91"
+#define ICON_KI_BUTTON_TWO "\xEE\xA6\x92"
+#define ICON_KI_BUTTON_THREE "\xEE\xA6\x93"
+#define ICON_KI_BUTTON_A "\xEE\xA6\x94"
+#define ICON_KI_BUTTON_X "\xEE\xA6\x95"
+#define ICON_KI_BUTON_Y "\xEE\xA6\x96"
+#define ICON_KI_BUTTON_TIMES "\xEE\xA6\x97"
+#define ICON_KI_BUTTON_SQUARE "\xEE\xA6\x98"
+#define ICON_KI_BUTTON_CIRCLE "\xEE\xA6\x99"
+#define ICON_KI_BUTTON_TRIANGLE "\xEE\xA6\x9A"
+#define ICON_KI_BUTTON_LEFT "\xEE\xA6\x9B"
+#define ICON_KI_BUTTON_L "\xEE\xA6\x9C"
+#define ICON_KI_BUTTON_L1 "\xEE\xA6\x9D"
+#define ICON_KI_BUTTON_L2 "\xEE\xA6\x9E"
+#define ICON_KI_BUTTON_LB "\xEE\xA6\x9F"
+#define ICON_KI_BUTTON_LT "\xEE\xA6\xA0"
+#define ICON_KI_BUTTON_RT "\xEE\xA6\xA1"
+#define ICON_KI_BUTTON_RB "\xEE\xA6\xA2"
+#define ICON_KI_BUTTON_R2 "\xEE\xA6\xA3"
+#define ICON_KI_BUTTON_R1 "\xEE\xA6\xA4"
+#define ICON_KI_BUTTON_R "\xEE\xA6\xA5"
+#define ICON_KI_BUTTON_RIGHT "\xEE\xA6\xA6"
+#define ICON_KI_BUTTON_EMPTY "\xEE\xA6\xA7"
+#define ICON_KI_BUTTON_START "\xEE\xA6\xA8"
+#define ICON_KI_BUTTON_SELECT "\xEE\xA6\xA9"
+#define ICON_KI_DPAD "\xEE\xA6\xAA"
+#define ICON_KI_DPAD_ALT "\xEE\xA6\xAB"
+#define ICON_KI_DPAD_TOP "\xEE\xA6\xAC"
+#define ICON_KI_DPAD_RIGHT "\xEE\xA6\xAD"
+#define ICON_KI_DPAD_BOTTOM "\xEE\xA6\xAE"
+#define ICON_KI_DPAD_LEFT "\xEE\xA6\xAF"
+#define ICON_KI_KEY_LARGE "\xEE\xA6\xB0"
+#define ICON_KI_KEY_LARGE_3D "\xEE\xA6\xB1"
+#define ICON_KI_KEY_SMALL "\xEE\xA6\xB2"
+#define ICON_KI_KEY_SMALL_3D "\xEE\xA6\xB3"
+#define ICON_KI_STICK_LEFT_TOP "\xEE\xA6\xB4"
+#define ICON_KI_STICK_LEFT_SIDE "\xEE\xA6\xB5"
+#define ICON_KI_STICK_RIGHT_SIDE "\xEE\xA6\xB6"
+#define ICON_KI_STICK_RIGHT_TOP "\xEE\xA6\xB7"
+#define ICON_KI_STICK_SIDE "\xEE\xA6\xB8"
+#define ICON_KI_STICK_TILT_LEFT "\xEE\xA6\xB9"
+#define ICON_KI_STICK_TILT_RIGHT "\xEE\xA6\xBA"
+#define ICON_KI_MOVE_BL "\xEE\xA6\xBB"
+#define ICON_KI_MOVE_BR "\xEE\xA6\xBC"
+#define ICON_KI_MOVE_BT "\xEE\xA6\xBD"
+#define ICON_KI_MOVE_BT_ALT "\xEE\xA6\xBE"
+#define ICON_KI_MOVE_LB "\xEE\xA6\xBF"
+#define ICON_KI_MOVE_LR "\xEE\xA7\x80"
+#define ICON_KI_MOVE_LR_ALT "\xEE\xA7\x81"
+#define ICON_KI_MOVE_LT "\xEE\xA7\x82"
+#define ICON_KI_MOVE_RB "\xEE\xA7\x83"
+#define ICON_KI_MOVE_RL "\xEE\xA7\x84"
+#define ICON_KI_MOVE_RL_ALT "\xEE\xA7\x85"
+#define ICON_KI_MOVE_RT "\xEE\xA7\x86"
+#define ICON_KI_MOVE_TB "\xEE\xA7\x87"
+#define ICON_KI_MOVE_TB_ALT "\xEE\xA7\x88"
+#define ICON_KI_MOVE_TL "\xEE\xA7\x89"
+#define ICON_KI_MOVE_TR "\xEE\xA7\x8A"
+#define ICON_KI_STICK_MOVE_BL "\xEE\xA7\x8B"
+#define ICON_KI_STICK_MOVE_BR "\xEE\xA7\x8C"
+#define ICON_KI_STICK_MOVE_BT "\xEE\xA7\x8D"
+#define ICON_KI_STICK_MOVE_BT_ALT "\xEE\xA7\x8E"
+#define ICON_KI_STICK_MOVE_LB "\xEE\xA7\x8F"
+#define ICON_KI_STICK_MOVE_LR "\xEE\xA7\x90"
+#define ICON_KI_STICK_MOVE_LR_ALT "\xEE\xA7\x91"
+#define ICON_KI_STICK_MOVE_LT "\xEE\xA7\x92"
+#define ICON_KI_STICK_MOVE_RB "\xEE\xA7\x93"
+#define ICON_KI_STICK_MOVE_RL "\xEE\xA7\x94"
+#define ICON_KI_STICK_MOVE_RL_ALT "\xEE\xA7\x95"
+#define ICON_KI_STICK_MOVE_RT "\xEE\xA7\x96"
+#define ICON_KI_STICK_MOVE_TB "\xEE\xA7\x97"
+#define ICON_KI_STICK_MOVE_TB_ALT "\xEE\xA7\x98"
+#define ICON_KI_STICK_MOVE_TL "\xEE\xA7\x99"
+#define ICON_KI_STICK_MOVE_TR "\xEE\xA7\x9A"
+#define ICON_KI_GITHUB "\xEE\xA7\x9B"
+#define ICON_KI_GITHUB_ALT "\xEE\xA7\x9C"
+#define ICON_KI_TWITTER "\xEE\xA7\x9D"
+#define ICON_KI_FACEBOOK "\xEE\xA7\x9E"
+#define ICON_KI_GOOGLE_PLUS "\xEE\xA7\x9F"
+#define ICON_KI_YOUTUBE "\xEE\xA7\xA2"
+#define ICON_KI_WE_HEART "\xEE\xA7\xA3"
+#define ICON_KI_WOLFCMS "\xEE\xA7\xA0"
+#define ICON_KI_WOLFCMS_ALT "\xEE\xA7\xA1"
diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h
new file mode 100644
index 00000000000..00ec9f68e91
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h
@@ -0,0 +1,938 @@
+// Generated by GenerateIconFontCppHeaders.py
+// from https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints
+#pragma once
+
+#define ICON_MIN_MD 0xe000
+#define ICON_MAX_MD 0xeb4c
+#define ICON_MD_3D_ROTATION "\xEE\xA1\x8D"
+#define ICON_MD_AC_UNIT "\xEE\xAC\xBB"
+#define ICON_MD_ACCESS_ALARM "\xEE\x86\x90"
+#define ICON_MD_ACCESS_ALARMS "\xEE\x86\x91"
+#define ICON_MD_ACCESS_TIME "\xEE\x86\x92"
+#define ICON_MD_ACCESSIBILITY "\xEE\xA1\x8E"
+#define ICON_MD_ACCESSIBLE "\xEE\xA4\x94"
+#define ICON_MD_ACCOUNT_BALANCE "\xEE\xA1\x8F"
+#define ICON_MD_ACCOUNT_BALANCE_WALLET "\xEE\xA1\x90"
+#define ICON_MD_ACCOUNT_BOX "\xEE\xA1\x91"
+#define ICON_MD_ACCOUNT_CIRCLE "\xEE\xA1\x93"
+#define ICON_MD_ADB "\xEE\x98\x8E"
+#define ICON_MD_ADD "\xEE\x85\x85"
+#define ICON_MD_ADD_A_PHOTO "\xEE\x90\xB9"
+#define ICON_MD_ADD_ALARM "\xEE\x86\x93"
+#define ICON_MD_ADD_ALERT "\xEE\x80\x83"
+#define ICON_MD_ADD_BOX "\xEE\x85\x86"
+#define ICON_MD_ADD_CIRCLE "\xEE\x85\x87"
+#define ICON_MD_ADD_CIRCLE_OUTLINE "\xEE\x85\x88"
+#define ICON_MD_ADD_LOCATION "\xEE\x95\xA7"
+#define ICON_MD_ADD_SHOPPING_CART "\xEE\xA1\x94"
+#define ICON_MD_ADD_TO_PHOTOS "\xEE\x8E\x9D"
+#define ICON_MD_ADD_TO_QUEUE "\xEE\x81\x9C"
+#define ICON_MD_ADJUST "\xEE\x8E\x9E"
+#define ICON_MD_AIRLINE_SEAT_FLAT "\xEE\x98\xB0"
+#define ICON_MD_AIRLINE_SEAT_FLAT_ANGLED "\xEE\x98\xB1"
+#define ICON_MD_AIRLINE_SEAT_INDIVIDUAL_SUITE "\xEE\x98\xB2"
+#define ICON_MD_AIRLINE_SEAT_LEGROOM_EXTRA "\xEE\x98\xB3"
+#define ICON_MD_AIRLINE_SEAT_LEGROOM_NORMAL "\xEE\x98\xB4"
+#define ICON_MD_AIRLINE_SEAT_LEGROOM_REDUCED "\xEE\x98\xB5"
+#define ICON_MD_AIRLINE_SEAT_RECLINE_EXTRA "\xEE\x98\xB6"
+#define ICON_MD_AIRLINE_SEAT_RECLINE_NORMAL "\xEE\x98\xB7"
+#define ICON_MD_AIRPLANEMODE_ACTIVE "\xEE\x86\x95"
+#define ICON_MD_AIRPLANEMODE_INACTIVE "\xEE\x86\x94"
+#define ICON_MD_AIRPLAY "\xEE\x81\x95"
+#define ICON_MD_AIRPORT_SHUTTLE "\xEE\xAC\xBC"
+#define ICON_MD_ALARM "\xEE\xA1\x95"
+#define ICON_MD_ALARM_ADD "\xEE\xA1\x96"
+#define ICON_MD_ALARM_OFF "\xEE\xA1\x97"
+#define ICON_MD_ALARM_ON "\xEE\xA1\x98"
+#define ICON_MD_ALBUM "\xEE\x80\x99"
+#define ICON_MD_ALL_INCLUSIVE "\xEE\xAC\xBD"
+#define ICON_MD_ALL_OUT "\xEE\xA4\x8B"
+#define ICON_MD_ANDROID "\xEE\xA1\x99"
+#define ICON_MD_ANNOUNCEMENT "\xEE\xA1\x9A"
+#define ICON_MD_APPS "\xEE\x97\x83"
+#define ICON_MD_ARCHIVE "\xEE\x85\x89"
+#define ICON_MD_ARROW_BACK "\xEE\x97\x84"
+#define ICON_MD_ARROW_DOWNWARD "\xEE\x97\x9B"
+#define ICON_MD_ARROW_DROP_DOWN "\xEE\x97\x85"
+#define ICON_MD_ARROW_DROP_DOWN_CIRCLE "\xEE\x97\x86"
+#define ICON_MD_ARROW_DROP_UP "\xEE\x97\x87"
+#define ICON_MD_ARROW_FORWARD "\xEE\x97\x88"
+#define ICON_MD_ARROW_UPWARD "\xEE\x97\x98"
+#define ICON_MD_ART_TRACK "\xEE\x81\xA0"
+#define ICON_MD_ASPECT_RATIO "\xEE\xA1\x9B"
+#define ICON_MD_ASSESSMENT "\xEE\xA1\x9C"
+#define ICON_MD_ASSIGNMENT "\xEE\xA1\x9D"
+#define ICON_MD_ASSIGNMENT_IND "\xEE\xA1\x9E"
+#define ICON_MD_ASSIGNMENT_LATE "\xEE\xA1\x9F"
+#define ICON_MD_ASSIGNMENT_RETURN "\xEE\xA1\xA0"
+#define ICON_MD_ASSIGNMENT_RETURNED "\xEE\xA1\xA1"
+#define ICON_MD_ASSIGNMENT_TURNED_IN "\xEE\xA1\xA2"
+#define ICON_MD_ASSISTANT "\xEE\x8E\x9F"
+#define ICON_MD_ASSISTANT_PHOTO "\xEE\x8E\xA0"
+#define ICON_MD_ATTACH_FILE "\xEE\x88\xA6"
+#define ICON_MD_ATTACH_MONEY "\xEE\x88\xA7"
+#define ICON_MD_ATTACHMENT "\xEE\x8A\xBC"
+#define ICON_MD_AUDIOTRACK "\xEE\x8E\xA1"
+#define ICON_MD_AUTORENEW "\xEE\xA1\xA3"
+#define ICON_MD_AV_TIMER "\xEE\x80\x9B"
+#define ICON_MD_BACKSPACE "\xEE\x85\x8A"
+#define ICON_MD_BACKUP "\xEE\xA1\xA4"
+#define ICON_MD_BATTERY_ALERT "\xEE\x86\x9C"
+#define ICON_MD_BATTERY_CHARGING_FULL "\xEE\x86\xA3"
+#define ICON_MD_BATTERY_FULL "\xEE\x86\xA4"
+#define ICON_MD_BATTERY_STD "\xEE\x86\xA5"
+#define ICON_MD_BATTERY_UNKNOWN "\xEE\x86\xA6"
+#define ICON_MD_BEACH_ACCESS "\xEE\xAC\xBE"
+#define ICON_MD_BEENHERE "\xEE\x94\xAD"
+#define ICON_MD_BLOCK "\xEE\x85\x8B"
+#define ICON_MD_BLUETOOTH "\xEE\x86\xA7"
+#define ICON_MD_BLUETOOTH_AUDIO "\xEE\x98\x8F"
+#define ICON_MD_BLUETOOTH_CONNECTED "\xEE\x86\xA8"
+#define ICON_MD_BLUETOOTH_DISABLED "\xEE\x86\xA9"
+#define ICON_MD_BLUETOOTH_SEARCHING "\xEE\x86\xAA"
+#define ICON_MD_BLUR_CIRCULAR "\xEE\x8E\xA2"
+#define ICON_MD_BLUR_LINEAR "\xEE\x8E\xA3"
+#define ICON_MD_BLUR_OFF "\xEE\x8E\xA4"
+#define ICON_MD_BLUR_ON "\xEE\x8E\xA5"
+#define ICON_MD_BOOK "\xEE\xA1\xA5"
+#define ICON_MD_BOOKMARK "\xEE\xA1\xA6"
+#define ICON_MD_BOOKMARK_BORDER "\xEE\xA1\xA7"
+#define ICON_MD_BORDER_ALL "\xEE\x88\xA8"
+#define ICON_MD_BORDER_BOTTOM "\xEE\x88\xA9"
+#define ICON_MD_BORDER_CLEAR "\xEE\x88\xAA"
+#define ICON_MD_BORDER_COLOR "\xEE\x88\xAB"
+#define ICON_MD_BORDER_HORIZONTAL "\xEE\x88\xAC"
+#define ICON_MD_BORDER_INNER "\xEE\x88\xAD"
+#define ICON_MD_BORDER_LEFT "\xEE\x88\xAE"
+#define ICON_MD_BORDER_OUTER "\xEE\x88\xAF"
+#define ICON_MD_BORDER_RIGHT "\xEE\x88\xB0"
+#define ICON_MD_BORDER_STYLE "\xEE\x88\xB1"
+#define ICON_MD_BORDER_TOP "\xEE\x88\xB2"
+#define ICON_MD_BORDER_VERTICAL "\xEE\x88\xB3"
+#define ICON_MD_BRANDING_WATERMARK "\xEE\x81\xAB"
+#define ICON_MD_BRIGHTNESS_1 "\xEE\x8E\xA6"
+#define ICON_MD_BRIGHTNESS_2 "\xEE\x8E\xA7"
+#define ICON_MD_BRIGHTNESS_3 "\xEE\x8E\xA8"
+#define ICON_MD_BRIGHTNESS_4 "\xEE\x8E\xA9"
+#define ICON_MD_BRIGHTNESS_5 "\xEE\x8E\xAA"
+#define ICON_MD_BRIGHTNESS_6 "\xEE\x8E\xAB"
+#define ICON_MD_BRIGHTNESS_7 "\xEE\x8E\xAC"
+#define ICON_MD_BRIGHTNESS_AUTO "\xEE\x86\xAB"
+#define ICON_MD_BRIGHTNESS_HIGH "\xEE\x86\xAC"
+#define ICON_MD_BRIGHTNESS_LOW "\xEE\x86\xAD"
+#define ICON_MD_BRIGHTNESS_MEDIUM "\xEE\x86\xAE"
+#define ICON_MD_BROKEN_IMAGE "\xEE\x8E\xAD"
+#define ICON_MD_BRUSH "\xEE\x8E\xAE"
+#define ICON_MD_BUBBLE_CHART "\xEE\x9B\x9D"
+#define ICON_MD_BUG_REPORT "\xEE\xA1\xA8"
+#define ICON_MD_BUILD "\xEE\xA1\xA9"
+#define ICON_MD_BURST_MODE "\xEE\x90\xBC"
+#define ICON_MD_BUSINESS "\xEE\x82\xAF"
+#define ICON_MD_BUSINESS_CENTER "\xEE\xAC\xBF"
+#define ICON_MD_CACHED "\xEE\xA1\xAA"
+#define ICON_MD_CAKE "\xEE\x9F\xA9"
+#define ICON_MD_CALL "\xEE\x82\xB0"
+#define ICON_MD_CALL_END "\xEE\x82\xB1"
+#define ICON_MD_CALL_MADE "\xEE\x82\xB2"
+#define ICON_MD_CALL_MERGE "\xEE\x82\xB3"
+#define ICON_MD_CALL_MISSED "\xEE\x82\xB4"
+#define ICON_MD_CALL_MISSED_OUTGOING "\xEE\x83\xA4"
+#define ICON_MD_CALL_RECEIVED "\xEE\x82\xB5"
+#define ICON_MD_CALL_SPLIT "\xEE\x82\xB6"
+#define ICON_MD_CALL_TO_ACTION "\xEE\x81\xAC"
+#define ICON_MD_CAMERA "\xEE\x8E\xAF"
+#define ICON_MD_CAMERA_ALT "\xEE\x8E\xB0"
+#define ICON_MD_CAMERA_ENHANCE "\xEE\xA3\xBC"
+#define ICON_MD_CAMERA_FRONT "\xEE\x8E\xB1"
+#define ICON_MD_CAMERA_REAR "\xEE\x8E\xB2"
+#define ICON_MD_CAMERA_ROLL "\xEE\x8E\xB3"
+#define ICON_MD_CANCEL "\xEE\x97\x89"
+#define ICON_MD_CARD_GIFTCARD "\xEE\xA3\xB6"
+#define ICON_MD_CARD_MEMBERSHIP "\xEE\xA3\xB7"
+#define ICON_MD_CARD_TRAVEL "\xEE\xA3\xB8"
+#define ICON_MD_CASINO "\xEE\xAD\x80"
+#define ICON_MD_CAST "\xEE\x8C\x87"
+#define ICON_MD_CAST_CONNECTED "\xEE\x8C\x88"
+#define ICON_MD_CENTER_FOCUS_STRONG "\xEE\x8E\xB4"
+#define ICON_MD_CENTER_FOCUS_WEAK "\xEE\x8E\xB5"
+#define ICON_MD_CHANGE_HISTORY "\xEE\xA1\xAB"
+#define ICON_MD_CHAT "\xEE\x82\xB7"
+#define ICON_MD_CHAT_BUBBLE "\xEE\x83\x8A"
+#define ICON_MD_CHAT_BUBBLE_OUTLINE "\xEE\x83\x8B"
+#define ICON_MD_CHECK "\xEE\x97\x8A"
+#define ICON_MD_CHECK_BOX "\xEE\xA0\xB4"
+#define ICON_MD_CHECK_BOX_OUTLINE_BLANK "\xEE\xA0\xB5"
+#define ICON_MD_CHECK_CIRCLE "\xEE\xA1\xAC"
+#define ICON_MD_CHEVRON_LEFT "\xEE\x97\x8B"
+#define ICON_MD_CHEVRON_RIGHT "\xEE\x97\x8C"
+#define ICON_MD_CHILD_CARE "\xEE\xAD\x81"
+#define ICON_MD_CHILD_FRIENDLY "\xEE\xAD\x82"
+#define ICON_MD_CHROME_READER_MODE "\xEE\xA1\xAD"
+#define ICON_MD_CLASS "\xEE\xA1\xAE"
+#define ICON_MD_CLEAR "\xEE\x85\x8C"
+#define ICON_MD_CLEAR_ALL "\xEE\x82\xB8"
+#define ICON_MD_CLOSE "\xEE\x97\x8D"
+#define ICON_MD_CLOSED_CAPTION "\xEE\x80\x9C"
+#define ICON_MD_CLOUD "\xEE\x8A\xBD"
+#define ICON_MD_CLOUD_CIRCLE "\xEE\x8A\xBE"
+#define ICON_MD_CLOUD_DONE "\xEE\x8A\xBF"
+#define ICON_MD_CLOUD_DOWNLOAD "\xEE\x8B\x80"
+#define ICON_MD_CLOUD_OFF "\xEE\x8B\x81"
+#define ICON_MD_CLOUD_QUEUE "\xEE\x8B\x82"
+#define ICON_MD_CLOUD_UPLOAD "\xEE\x8B\x83"
+#define ICON_MD_CODE "\xEE\xA1\xAF"
+#define ICON_MD_COLLECTIONS "\xEE\x8E\xB6"
+#define ICON_MD_COLLECTIONS_BOOKMARK "\xEE\x90\xB1"
+#define ICON_MD_COLOR_LENS "\xEE\x8E\xB7"
+#define ICON_MD_COLORIZE "\xEE\x8E\xB8"
+#define ICON_MD_COMMENT "\xEE\x82\xB9"
+#define ICON_MD_COMPARE "\xEE\x8E\xB9"
+#define ICON_MD_COMPARE_ARROWS "\xEE\xA4\x95"
+#define ICON_MD_COMPUTER "\xEE\x8C\x8A"
+#define ICON_MD_CONFIRMATION_NUMBER "\xEE\x98\xB8"
+#define ICON_MD_CONTACT_MAIL "\xEE\x83\x90"
+#define ICON_MD_CONTACT_PHONE "\xEE\x83\x8F"
+#define ICON_MD_CONTACTS "\xEE\x82\xBA"
+#define ICON_MD_CONTENT_COPY "\xEE\x85\x8D"
+#define ICON_MD_CONTENT_CUT "\xEE\x85\x8E"
+#define ICON_MD_CONTENT_PASTE "\xEE\x85\x8F"
+#define ICON_MD_CONTROL_POINT "\xEE\x8E\xBA"
+#define ICON_MD_CONTROL_POINT_DUPLICATE "\xEE\x8E\xBB"
+#define ICON_MD_COPYRIGHT "\xEE\xA4\x8C"
+#define ICON_MD_CREATE "\xEE\x85\x90"
+#define ICON_MD_CREATE_NEW_FOLDER "\xEE\x8B\x8C"
+#define ICON_MD_CREDIT_CARD "\xEE\xA1\xB0"
+#define ICON_MD_CROP "\xEE\x8E\xBE"
+#define ICON_MD_CROP_16_9 "\xEE\x8E\xBC"
+#define ICON_MD_CROP_3_2 "\xEE\x8E\xBD"
+#define ICON_MD_CROP_5_4 "\xEE\x8E\xBF"
+#define ICON_MD_CROP_7_5 "\xEE\x8F\x80"
+#define ICON_MD_CROP_DIN "\xEE\x8F\x81"
+#define ICON_MD_CROP_FREE "\xEE\x8F\x82"
+#define ICON_MD_CROP_LANDSCAPE "\xEE\x8F\x83"
+#define ICON_MD_CROP_ORIGINAL "\xEE\x8F\x84"
+#define ICON_MD_CROP_PORTRAIT "\xEE\x8F\x85"
+#define ICON_MD_CROP_ROTATE "\xEE\x90\xB7"
+#define ICON_MD_CROP_SQUARE "\xEE\x8F\x86"
+#define ICON_MD_DASHBOARD "\xEE\xA1\xB1"
+#define ICON_MD_DATA_USAGE "\xEE\x86\xAF"
+#define ICON_MD_DATE_RANGE "\xEE\xA4\x96"
+#define ICON_MD_DEHAZE "\xEE\x8F\x87"
+#define ICON_MD_DELETE "\xEE\xA1\xB2"
+#define ICON_MD_DELETE_FOREVER "\xEE\xA4\xAB"
+#define ICON_MD_DELETE_SWEEP "\xEE\x85\xAC"
+#define ICON_MD_DESCRIPTION "\xEE\xA1\xB3"
+#define ICON_MD_DESKTOP_MAC "\xEE\x8C\x8B"
+#define ICON_MD_DESKTOP_WINDOWS "\xEE\x8C\x8C"
+#define ICON_MD_DETAILS "\xEE\x8F\x88"
+#define ICON_MD_DEVELOPER_BOARD "\xEE\x8C\x8D"
+#define ICON_MD_DEVELOPER_MODE "\xEE\x86\xB0"
+#define ICON_MD_DEVICE_HUB "\xEE\x8C\xB5"
+#define ICON_MD_DEVICES "\xEE\x86\xB1"
+#define ICON_MD_DEVICES_OTHER "\xEE\x8C\xB7"
+#define ICON_MD_DIALER_SIP "\xEE\x82\xBB"
+#define ICON_MD_DIALPAD "\xEE\x82\xBC"
+#define ICON_MD_DIRECTIONS "\xEE\x94\xAE"
+#define ICON_MD_DIRECTIONS_BIKE "\xEE\x94\xAF"
+#define ICON_MD_DIRECTIONS_BOAT "\xEE\x94\xB2"
+#define ICON_MD_DIRECTIONS_BUS "\xEE\x94\xB0"
+#define ICON_MD_DIRECTIONS_CAR "\xEE\x94\xB1"
+#define ICON_MD_DIRECTIONS_RAILWAY "\xEE\x94\xB4"
+#define ICON_MD_DIRECTIONS_RUN "\xEE\x95\xA6"
+#define ICON_MD_DIRECTIONS_SUBWAY "\xEE\x94\xB3"
+#define ICON_MD_DIRECTIONS_TRANSIT "\xEE\x94\xB5"
+#define ICON_MD_DIRECTIONS_WALK "\xEE\x94\xB6"
+#define ICON_MD_DISC_FULL "\xEE\x98\x90"
+#define ICON_MD_DNS "\xEE\xA1\xB5"
+#define ICON_MD_DO_NOT_DISTURB "\xEE\x98\x92"
+#define ICON_MD_DO_NOT_DISTURB_ALT "\xEE\x98\x91"
+#define ICON_MD_DO_NOT_DISTURB_OFF "\xEE\x99\x83"
+#define ICON_MD_DO_NOT_DISTURB_ON "\xEE\x99\x84"
+#define ICON_MD_DOCK "\xEE\x8C\x8E"
+#define ICON_MD_DOMAIN "\xEE\x9F\xAE"
+#define ICON_MD_DONE "\xEE\xA1\xB6"
+#define ICON_MD_DONE_ALL "\xEE\xA1\xB7"
+#define ICON_MD_DONUT_LARGE "\xEE\xA4\x97"
+#define ICON_MD_DONUT_SMALL "\xEE\xA4\x98"
+#define ICON_MD_DRAFTS "\xEE\x85\x91"
+#define ICON_MD_DRAG_HANDLE "\xEE\x89\x9D"
+#define ICON_MD_DRIVE_ETA "\xEE\x98\x93"
+#define ICON_MD_DVR "\xEE\x86\xB2"
+#define ICON_MD_EDIT "\xEE\x8F\x89"
+#define ICON_MD_EDIT_LOCATION "\xEE\x95\xA8"
+#define ICON_MD_EJECT "\xEE\xA3\xBB"
+#define ICON_MD_EMAIL "\xEE\x82\xBE"
+#define ICON_MD_ENHANCED_ENCRYPTION "\xEE\x98\xBF"
+#define ICON_MD_EQUALIZER "\xEE\x80\x9D"
+#define ICON_MD_ERROR "\xEE\x80\x80"
+#define ICON_MD_ERROR_OUTLINE "\xEE\x80\x81"
+#define ICON_MD_EURO_SYMBOL "\xEE\xA4\xA6"
+#define ICON_MD_EV_STATION "\xEE\x95\xAD"
+#define ICON_MD_EVENT "\xEE\xA1\xB8"
+#define ICON_MD_EVENT_AVAILABLE "\xEE\x98\x94"
+#define ICON_MD_EVENT_BUSY "\xEE\x98\x95"
+#define ICON_MD_EVENT_NOTE "\xEE\x98\x96"
+#define ICON_MD_EVENT_SEAT "\xEE\xA4\x83"
+#define ICON_MD_EXIT_TO_APP "\xEE\xA1\xB9"
+#define ICON_MD_EXPAND_LESS "\xEE\x97\x8E"
+#define ICON_MD_EXPAND_MORE "\xEE\x97\x8F"
+#define ICON_MD_EXPLICIT "\xEE\x80\x9E"
+#define ICON_MD_EXPLORE "\xEE\xA1\xBA"
+#define ICON_MD_EXPOSURE "\xEE\x8F\x8A"
+#define ICON_MD_EXPOSURE_NEG_1 "\xEE\x8F\x8B"
+#define ICON_MD_EXPOSURE_NEG_2 "\xEE\x8F\x8C"
+#define ICON_MD_EXPOSURE_PLUS_1 "\xEE\x8F\x8D"
+#define ICON_MD_EXPOSURE_PLUS_2 "\xEE\x8F\x8E"
+#define ICON_MD_EXPOSURE_ZERO "\xEE\x8F\x8F"
+#define ICON_MD_EXTENSION "\xEE\xA1\xBB"
+#define ICON_MD_FACE "\xEE\xA1\xBC"
+#define ICON_MD_FAST_FORWARD "\xEE\x80\x9F"
+#define ICON_MD_FAST_REWIND "\xEE\x80\xA0"
+#define ICON_MD_FAVORITE "\xEE\xA1\xBD"
+#define ICON_MD_FAVORITE_BORDER "\xEE\xA1\xBE"
+#define ICON_MD_FEATURED_PLAY_LIST "\xEE\x81\xAD"
+#define ICON_MD_FEATURED_VIDEO "\xEE\x81\xAE"
+#define ICON_MD_FEEDBACK "\xEE\xA1\xBF"
+#define ICON_MD_FIBER_DVR "\xEE\x81\x9D"
+#define ICON_MD_FIBER_MANUAL_RECORD "\xEE\x81\xA1"
+#define ICON_MD_FIBER_NEW "\xEE\x81\x9E"
+#define ICON_MD_FIBER_PIN "\xEE\x81\xAA"
+#define ICON_MD_FIBER_SMART_RECORD "\xEE\x81\xA2"
+#define ICON_MD_FILE_DOWNLOAD "\xEE\x8B\x84"
+#define ICON_MD_FILE_UPLOAD "\xEE\x8B\x86"
+#define ICON_MD_FILTER "\xEE\x8F\x93"
+#define ICON_MD_FILTER_1 "\xEE\x8F\x90"
+#define ICON_MD_FILTER_2 "\xEE\x8F\x91"
+#define ICON_MD_FILTER_3 "\xEE\x8F\x92"
+#define ICON_MD_FILTER_4 "\xEE\x8F\x94"
+#define ICON_MD_FILTER_5 "\xEE\x8F\x95"
+#define ICON_MD_FILTER_6 "\xEE\x8F\x96"
+#define ICON_MD_FILTER_7 "\xEE\x8F\x97"
+#define ICON_MD_FILTER_8 "\xEE\x8F\x98"
+#define ICON_MD_FILTER_9 "\xEE\x8F\x99"
+#define ICON_MD_FILTER_9_PLUS "\xEE\x8F\x9A"
+#define ICON_MD_FILTER_B_AND_W "\xEE\x8F\x9B"
+#define ICON_MD_FILTER_CENTER_FOCUS "\xEE\x8F\x9C"
+#define ICON_MD_FILTER_DRAMA "\xEE\x8F\x9D"
+#define ICON_MD_FILTER_FRAMES "\xEE\x8F\x9E"
+#define ICON_MD_FILTER_HDR "\xEE\x8F\x9F"
+#define ICON_MD_FILTER_LIST "\xEE\x85\x92"
+#define ICON_MD_FILTER_NONE "\xEE\x8F\xA0"
+#define ICON_MD_FILTER_TILT_SHIFT "\xEE\x8F\xA2"
+#define ICON_MD_FILTER_VINTAGE "\xEE\x8F\xA3"
+#define ICON_MD_FIND_IN_PAGE "\xEE\xA2\x80"
+#define ICON_MD_FIND_REPLACE "\xEE\xA2\x81"
+#define ICON_MD_FINGERPRINT "\xEE\xA4\x8D"
+#define ICON_MD_FIRST_PAGE "\xEE\x97\x9C"
+#define ICON_MD_FITNESS_CENTER "\xEE\xAD\x83"
+#define ICON_MD_FLAG "\xEE\x85\x93"
+#define ICON_MD_FLARE "\xEE\x8F\xA4"
+#define ICON_MD_FLASH_AUTO "\xEE\x8F\xA5"
+#define ICON_MD_FLASH_OFF "\xEE\x8F\xA6"
+#define ICON_MD_FLASH_ON "\xEE\x8F\xA7"
+#define ICON_MD_FLIGHT "\xEE\x94\xB9"
+#define ICON_MD_FLIGHT_LAND "\xEE\xA4\x84"
+#define ICON_MD_FLIGHT_TAKEOFF "\xEE\xA4\x85"
+#define ICON_MD_FLIP "\xEE\x8F\xA8"
+#define ICON_MD_FLIP_TO_BACK "\xEE\xA2\x82"
+#define ICON_MD_FLIP_TO_FRONT "\xEE\xA2\x83"
+#define ICON_MD_FOLDER "\xEE\x8B\x87"
+#define ICON_MD_FOLDER_OPEN "\xEE\x8B\x88"
+#define ICON_MD_FOLDER_SHARED "\xEE\x8B\x89"
+#define ICON_MD_FOLDER_SPECIAL "\xEE\x98\x97"
+#define ICON_MD_FONT_DOWNLOAD "\xEE\x85\xA7"
+#define ICON_MD_FORMAT_ALIGN_CENTER "\xEE\x88\xB4"
+#define ICON_MD_FORMAT_ALIGN_JUSTIFY "\xEE\x88\xB5"
+#define ICON_MD_FORMAT_ALIGN_LEFT "\xEE\x88\xB6"
+#define ICON_MD_FORMAT_ALIGN_RIGHT "\xEE\x88\xB7"
+#define ICON_MD_FORMAT_BOLD "\xEE\x88\xB8"
+#define ICON_MD_FORMAT_CLEAR "\xEE\x88\xB9"
+#define ICON_MD_FORMAT_COLOR_FILL "\xEE\x88\xBA"
+#define ICON_MD_FORMAT_COLOR_RESET "\xEE\x88\xBB"
+#define ICON_MD_FORMAT_COLOR_TEXT "\xEE\x88\xBC"
+#define ICON_MD_FORMAT_INDENT_DECREASE "\xEE\x88\xBD"
+#define ICON_MD_FORMAT_INDENT_INCREASE "\xEE\x88\xBE"
+#define ICON_MD_FORMAT_ITALIC "\xEE\x88\xBF"
+#define ICON_MD_FORMAT_LINE_SPACING "\xEE\x89\x80"
+#define ICON_MD_FORMAT_LIST_BULLETED "\xEE\x89\x81"
+#define ICON_MD_FORMAT_LIST_NUMBERED "\xEE\x89\x82"
+#define ICON_MD_FORMAT_PAINT "\xEE\x89\x83"
+#define ICON_MD_FORMAT_QUOTE "\xEE\x89\x84"
+#define ICON_MD_FORMAT_SHAPES "\xEE\x89\x9E"
+#define ICON_MD_FORMAT_SIZE "\xEE\x89\x85"
+#define ICON_MD_FORMAT_STRIKETHROUGH "\xEE\x89\x86"
+#define ICON_MD_FORMAT_TEXTDIRECTION_L_TO_R "\xEE\x89\x87"
+#define ICON_MD_FORMAT_TEXTDIRECTION_R_TO_L "\xEE\x89\x88"
+#define ICON_MD_FORMAT_UNDERLINED "\xEE\x89\x89"
+#define ICON_MD_FORUM "\xEE\x82\xBF"
+#define ICON_MD_FORWARD "\xEE\x85\x94"
+#define ICON_MD_FORWARD_10 "\xEE\x81\x96"
+#define ICON_MD_FORWARD_30 "\xEE\x81\x97"
+#define ICON_MD_FORWARD_5 "\xEE\x81\x98"
+#define ICON_MD_FREE_BREAKFAST "\xEE\xAD\x84"
+#define ICON_MD_FULLSCREEN "\xEE\x97\x90"
+#define ICON_MD_FULLSCREEN_EXIT "\xEE\x97\x91"
+#define ICON_MD_FUNCTIONS "\xEE\x89\x8A"
+#define ICON_MD_G_TRANSLATE "\xEE\xA4\xA7"
+#define ICON_MD_GAMEPAD "\xEE\x8C\x8F"
+#define ICON_MD_GAMES "\xEE\x80\xA1"
+#define ICON_MD_GAVEL "\xEE\xA4\x8E"
+#define ICON_MD_GESTURE "\xEE\x85\x95"
+#define ICON_MD_GET_APP "\xEE\xA2\x84"
+#define ICON_MD_GIF "\xEE\xA4\x88"
+#define ICON_MD_GOLF_COURSE "\xEE\xAD\x85"
+#define ICON_MD_GPS_FIXED "\xEE\x86\xB3"
+#define ICON_MD_GPS_NOT_FIXED "\xEE\x86\xB4"
+#define ICON_MD_GPS_OFF "\xEE\x86\xB5"
+#define ICON_MD_GRADE "\xEE\xA2\x85"
+#define ICON_MD_GRADIENT "\xEE\x8F\xA9"
+#define ICON_MD_GRAIN "\xEE\x8F\xAA"
+#define ICON_MD_GRAPHIC_EQ "\xEE\x86\xB8"
+#define ICON_MD_GRID_OFF "\xEE\x8F\xAB"
+#define ICON_MD_GRID_ON "\xEE\x8F\xAC"
+#define ICON_MD_GROUP "\xEE\x9F\xAF"
+#define ICON_MD_GROUP_ADD "\xEE\x9F\xB0"
+#define ICON_MD_GROUP_WORK "\xEE\xA2\x86"
+#define ICON_MD_HD "\xEE\x81\x92"
+#define ICON_MD_HDR_OFF "\xEE\x8F\xAD"
+#define ICON_MD_HDR_ON "\xEE\x8F\xAE"
+#define ICON_MD_HDR_STRONG "\xEE\x8F\xB1"
+#define ICON_MD_HDR_WEAK "\xEE\x8F\xB2"
+#define ICON_MD_HEADSET "\xEE\x8C\x90"
+#define ICON_MD_HEADSET_MIC "\xEE\x8C\x91"
+#define ICON_MD_HEALING "\xEE\x8F\xB3"
+#define ICON_MD_HEARING "\xEE\x80\xA3"
+#define ICON_MD_HELP "\xEE\xA2\x87"
+#define ICON_MD_HELP_OUTLINE "\xEE\xA3\xBD"
+#define ICON_MD_HIGH_QUALITY "\xEE\x80\xA4"
+#define ICON_MD_HIGHLIGHT "\xEE\x89\x9F"
+#define ICON_MD_HIGHLIGHT_OFF "\xEE\xA2\x88"
+#define ICON_MD_HISTORY "\xEE\xA2\x89"
+#define ICON_MD_HOME "\xEE\xA2\x8A"
+#define ICON_MD_HOT_TUB "\xEE\xAD\x86"
+#define ICON_MD_HOTEL "\xEE\x94\xBA"
+#define ICON_MD_HOURGLASS_EMPTY "\xEE\xA2\x8B"
+#define ICON_MD_HOURGLASS_FULL "\xEE\xA2\x8C"
+#define ICON_MD_HTTP "\xEE\xA4\x82"
+#define ICON_MD_HTTPS "\xEE\xA2\x8D"
+#define ICON_MD_IMAGE "\xEE\x8F\xB4"
+#define ICON_MD_IMAGE_ASPECT_RATIO "\xEE\x8F\xB5"
+#define ICON_MD_IMPORT_CONTACTS "\xEE\x83\xA0"
+#define ICON_MD_IMPORT_EXPORT "\xEE\x83\x83"
+#define ICON_MD_IMPORTANT_DEVICES "\xEE\xA4\x92"
+#define ICON_MD_INBOX "\xEE\x85\x96"
+#define ICON_MD_INDETERMINATE_CHECK_BOX "\xEE\xA4\x89"
+#define ICON_MD_INFO "\xEE\xA2\x8E"
+#define ICON_MD_INFO_OUTLINE "\xEE\xA2\x8F"
+#define ICON_MD_INPUT "\xEE\xA2\x90"
+#define ICON_MD_INSERT_CHART "\xEE\x89\x8B"
+#define ICON_MD_INSERT_COMMENT "\xEE\x89\x8C"
+#define ICON_MD_INSERT_DRIVE_FILE "\xEE\x89\x8D"
+#define ICON_MD_INSERT_EMOTICON "\xEE\x89\x8E"
+#define ICON_MD_INSERT_INVITATION "\xEE\x89\x8F"
+#define ICON_MD_INSERT_LINK "\xEE\x89\x90"
+#define ICON_MD_INSERT_PHOTO "\xEE\x89\x91"
+#define ICON_MD_INVERT_COLORS "\xEE\xA2\x91"
+#define ICON_MD_INVERT_COLORS_OFF "\xEE\x83\x84"
+#define ICON_MD_ISO "\xEE\x8F\xB6"
+#define ICON_MD_KEYBOARD "\xEE\x8C\x92"
+#define ICON_MD_KEYBOARD_ARROW_DOWN "\xEE\x8C\x93"
+#define ICON_MD_KEYBOARD_ARROW_LEFT "\xEE\x8C\x94"
+#define ICON_MD_KEYBOARD_ARROW_RIGHT "\xEE\x8C\x95"
+#define ICON_MD_KEYBOARD_ARROW_UP "\xEE\x8C\x96"
+#define ICON_MD_KEYBOARD_BACKSPACE "\xEE\x8C\x97"
+#define ICON_MD_KEYBOARD_CAPSLOCK "\xEE\x8C\x98"
+#define ICON_MD_KEYBOARD_HIDE "\xEE\x8C\x9A"
+#define ICON_MD_KEYBOARD_RETURN "\xEE\x8C\x9B"
+#define ICON_MD_KEYBOARD_TAB "\xEE\x8C\x9C"
+#define ICON_MD_KEYBOARD_VOICE "\xEE\x8C\x9D"
+#define ICON_MD_KITCHEN "\xEE\xAD\x87"
+#define ICON_MD_LABEL "\xEE\xA2\x92"
+#define ICON_MD_LABEL_OUTLINE "\xEE\xA2\x93"
+#define ICON_MD_LANDSCAPE "\xEE\x8F\xB7"
+#define ICON_MD_LANGUAGE "\xEE\xA2\x94"
+#define ICON_MD_LAPTOP "\xEE\x8C\x9E"
+#define ICON_MD_LAPTOP_CHROMEBOOK "\xEE\x8C\x9F"
+#define ICON_MD_LAPTOP_MAC "\xEE\x8C\xA0"
+#define ICON_MD_LAPTOP_WINDOWS "\xEE\x8C\xA1"
+#define ICON_MD_LAST_PAGE "\xEE\x97\x9D"
+#define ICON_MD_LAUNCH "\xEE\xA2\x95"
+#define ICON_MD_LAYERS "\xEE\x94\xBB"
+#define ICON_MD_LAYERS_CLEAR "\xEE\x94\xBC"
+#define ICON_MD_LEAK_ADD "\xEE\x8F\xB8"
+#define ICON_MD_LEAK_REMOVE "\xEE\x8F\xB9"
+#define ICON_MD_LENS "\xEE\x8F\xBA"
+#define ICON_MD_LIBRARY_ADD "\xEE\x80\xAE"
+#define ICON_MD_LIBRARY_BOOKS "\xEE\x80\xAF"
+#define ICON_MD_LIBRARY_MUSIC "\xEE\x80\xB0"
+#define ICON_MD_LIGHTBULB_OUTLINE "\xEE\xA4\x8F"
+#define ICON_MD_LINE_STYLE "\xEE\xA4\x99"
+#define ICON_MD_LINE_WEIGHT "\xEE\xA4\x9A"
+#define ICON_MD_LINEAR_SCALE "\xEE\x89\xA0"
+#define ICON_MD_LINK "\xEE\x85\x97"
+#define ICON_MD_LINKED_CAMERA "\xEE\x90\xB8"
+#define ICON_MD_LIST "\xEE\xA2\x96"
+#define ICON_MD_LIVE_HELP "\xEE\x83\x86"
+#define ICON_MD_LIVE_TV "\xEE\x98\xB9"
+#define ICON_MD_LOCAL_ACTIVITY "\xEE\x94\xBF"
+#define ICON_MD_LOCAL_AIRPORT "\xEE\x94\xBD"
+#define ICON_MD_LOCAL_ATM "\xEE\x94\xBE"
+#define ICON_MD_LOCAL_BAR "\xEE\x95\x80"
+#define ICON_MD_LOCAL_CAFE "\xEE\x95\x81"
+#define ICON_MD_LOCAL_CAR_WASH "\xEE\x95\x82"
+#define ICON_MD_LOCAL_CONVENIENCE_STORE "\xEE\x95\x83"
+#define ICON_MD_LOCAL_DINING "\xEE\x95\x96"
+#define ICON_MD_LOCAL_DRINK "\xEE\x95\x84"
+#define ICON_MD_LOCAL_FLORIST "\xEE\x95\x85"
+#define ICON_MD_LOCAL_GAS_STATION "\xEE\x95\x86"
+#define ICON_MD_LOCAL_GROCERY_STORE "\xEE\x95\x87"
+#define ICON_MD_LOCAL_HOSPITAL "\xEE\x95\x88"
+#define ICON_MD_LOCAL_HOTEL "\xEE\x95\x89"
+#define ICON_MD_LOCAL_LAUNDRY_SERVICE "\xEE\x95\x8A"
+#define ICON_MD_LOCAL_LIBRARY "\xEE\x95\x8B"
+#define ICON_MD_LOCAL_MALL "\xEE\x95\x8C"
+#define ICON_MD_LOCAL_MOVIES "\xEE\x95\x8D"
+#define ICON_MD_LOCAL_OFFER "\xEE\x95\x8E"
+#define ICON_MD_LOCAL_PARKING "\xEE\x95\x8F"
+#define ICON_MD_LOCAL_PHARMACY "\xEE\x95\x90"
+#define ICON_MD_LOCAL_PHONE "\xEE\x95\x91"
+#define ICON_MD_LOCAL_PIZZA "\xEE\x95\x92"
+#define ICON_MD_LOCAL_PLAY "\xEE\x95\x93"
+#define ICON_MD_LOCAL_POST_OFFICE "\xEE\x95\x94"
+#define ICON_MD_LOCAL_PRINTSHOP "\xEE\x95\x95"
+#define ICON_MD_LOCAL_SEE "\xEE\x95\x97"
+#define ICON_MD_LOCAL_SHIPPING "\xEE\x95\x98"
+#define ICON_MD_LOCAL_TAXI "\xEE\x95\x99"
+#define ICON_MD_LOCATION_CITY "\xEE\x9F\xB1"
+#define ICON_MD_LOCATION_DISABLED "\xEE\x86\xB6"
+#define ICON_MD_LOCATION_OFF "\xEE\x83\x87"
+#define ICON_MD_LOCATION_ON "\xEE\x83\x88"
+#define ICON_MD_LOCATION_SEARCHING "\xEE\x86\xB7"
+#define ICON_MD_LOCK "\xEE\xA2\x97"
+#define ICON_MD_LOCK_OPEN "\xEE\xA2\x98"
+#define ICON_MD_LOCK_OUTLINE "\xEE\xA2\x99"
+#define ICON_MD_LOOKS "\xEE\x8F\xBC"
+#define ICON_MD_LOOKS_3 "\xEE\x8F\xBB"
+#define ICON_MD_LOOKS_4 "\xEE\x8F\xBD"
+#define ICON_MD_LOOKS_5 "\xEE\x8F\xBE"
+#define ICON_MD_LOOKS_6 "\xEE\x8F\xBF"
+#define ICON_MD_LOOKS_ONE "\xEE\x90\x80"
+#define ICON_MD_LOOKS_TWO "\xEE\x90\x81"
+#define ICON_MD_LOOP "\xEE\x80\xA8"
+#define ICON_MD_LOUPE "\xEE\x90\x82"
+#define ICON_MD_LOW_PRIORITY "\xEE\x85\xAD"
+#define ICON_MD_LOYALTY "\xEE\xA2\x9A"
+#define ICON_MD_MAIL "\xEE\x85\x98"
+#define ICON_MD_MAIL_OUTLINE "\xEE\x83\xA1"
+#define ICON_MD_MAP "\xEE\x95\x9B"
+#define ICON_MD_MARKUNREAD "\xEE\x85\x99"
+#define ICON_MD_MARKUNREAD_MAILBOX "\xEE\xA2\x9B"
+#define ICON_MD_MEMORY "\xEE\x8C\xA2"
+#define ICON_MD_MENU "\xEE\x97\x92"
+#define ICON_MD_MERGE_TYPE "\xEE\x89\x92"
+#define ICON_MD_MESSAGE "\xEE\x83\x89"
+#define ICON_MD_MIC "\xEE\x80\xA9"
+#define ICON_MD_MIC_NONE "\xEE\x80\xAA"
+#define ICON_MD_MIC_OFF "\xEE\x80\xAB"
+#define ICON_MD_MMS "\xEE\x98\x98"
+#define ICON_MD_MODE_COMMENT "\xEE\x89\x93"
+#define ICON_MD_MODE_EDIT "\xEE\x89\x94"
+#define ICON_MD_MONETIZATION_ON "\xEE\x89\xA3"
+#define ICON_MD_MONEY_OFF "\xEE\x89\x9C"
+#define ICON_MD_MONOCHROME_PHOTOS "\xEE\x90\x83"
+#define ICON_MD_MOOD "\xEE\x9F\xB2"
+#define ICON_MD_MOOD_BAD "\xEE\x9F\xB3"
+#define ICON_MD_MORE "\xEE\x98\x99"
+#define ICON_MD_MORE_HORIZ "\xEE\x97\x93"
+#define ICON_MD_MORE_VERT "\xEE\x97\x94"
+#define ICON_MD_MOTORCYCLE "\xEE\xA4\x9B"
+#define ICON_MD_MOUSE "\xEE\x8C\xA3"
+#define ICON_MD_MOVE_TO_INBOX "\xEE\x85\xA8"
+#define ICON_MD_MOVIE "\xEE\x80\xAC"
+#define ICON_MD_MOVIE_CREATION "\xEE\x90\x84"
+#define ICON_MD_MOVIE_FILTER "\xEE\x90\xBA"
+#define ICON_MD_MULTILINE_CHART "\xEE\x9B\x9F"
+#define ICON_MD_MUSIC_NOTE "\xEE\x90\x85"
+#define ICON_MD_MUSIC_VIDEO "\xEE\x81\xA3"
+#define ICON_MD_MY_LOCATION "\xEE\x95\x9C"
+#define ICON_MD_NATURE "\xEE\x90\x86"
+#define ICON_MD_NATURE_PEOPLE "\xEE\x90\x87"
+#define ICON_MD_NAVIGATE_BEFORE "\xEE\x90\x88"
+#define ICON_MD_NAVIGATE_NEXT "\xEE\x90\x89"
+#define ICON_MD_NAVIGATION "\xEE\x95\x9D"
+#define ICON_MD_NEAR_ME "\xEE\x95\xA9"
+#define ICON_MD_NETWORK_CELL "\xEE\x86\xB9"
+#define ICON_MD_NETWORK_CHECK "\xEE\x99\x80"
+#define ICON_MD_NETWORK_LOCKED "\xEE\x98\x9A"
+#define ICON_MD_NETWORK_WIFI "\xEE\x86\xBA"
+#define ICON_MD_NEW_RELEASES "\xEE\x80\xB1"
+#define ICON_MD_NEXT_WEEK "\xEE\x85\xAA"
+#define ICON_MD_NFC "\xEE\x86\xBB"
+#define ICON_MD_NO_ENCRYPTION "\xEE\x99\x81"
+#define ICON_MD_NO_SIM "\xEE\x83\x8C"
+#define ICON_MD_NOT_INTERESTED "\xEE\x80\xB3"
+#define ICON_MD_NOTE "\xEE\x81\xAF"
+#define ICON_MD_NOTE_ADD "\xEE\xA2\x9C"
+#define ICON_MD_NOTIFICATIONS "\xEE\x9F\xB4"
+#define ICON_MD_NOTIFICATIONS_ACTIVE "\xEE\x9F\xB7"
+#define ICON_MD_NOTIFICATIONS_NONE "\xEE\x9F\xB5"
+#define ICON_MD_NOTIFICATIONS_OFF "\xEE\x9F\xB6"
+#define ICON_MD_NOTIFICATIONS_PAUSED "\xEE\x9F\xB8"
+#define ICON_MD_OFFLINE_PIN "\xEE\xA4\x8A"
+#define ICON_MD_ONDEMAND_VIDEO "\xEE\x98\xBA"
+#define ICON_MD_OPACITY "\xEE\xA4\x9C"
+#define ICON_MD_OPEN_IN_BROWSER "\xEE\xA2\x9D"
+#define ICON_MD_OPEN_IN_NEW "\xEE\xA2\x9E"
+#define ICON_MD_OPEN_WITH "\xEE\xA2\x9F"
+#define ICON_MD_PAGES "\xEE\x9F\xB9"
+#define ICON_MD_PAGEVIEW "\xEE\xA2\xA0"
+#define ICON_MD_PALETTE "\xEE\x90\x8A"
+#define ICON_MD_PAN_TOOL "\xEE\xA4\xA5"
+#define ICON_MD_PANORAMA "\xEE\x90\x8B"
+#define ICON_MD_PANORAMA_FISH_EYE "\xEE\x90\x8C"
+#define ICON_MD_PANORAMA_HORIZONTAL "\xEE\x90\x8D"
+#define ICON_MD_PANORAMA_VERTICAL "\xEE\x90\x8E"
+#define ICON_MD_PANORAMA_WIDE_ANGLE "\xEE\x90\x8F"
+#define ICON_MD_PARTY_MODE "\xEE\x9F\xBA"
+#define ICON_MD_PAUSE "\xEE\x80\xB4"
+#define ICON_MD_PAUSE_CIRCLE_FILLED "\xEE\x80\xB5"
+#define ICON_MD_PAUSE_CIRCLE_OUTLINE "\xEE\x80\xB6"
+#define ICON_MD_PAYMENT "\xEE\xA2\xA1"
+#define ICON_MD_PEOPLE "\xEE\x9F\xBB"
+#define ICON_MD_PEOPLE_OUTLINE "\xEE\x9F\xBC"
+#define ICON_MD_PERM_CAMERA_MIC "\xEE\xA2\xA2"
+#define ICON_MD_PERM_CONTACT_CALENDAR "\xEE\xA2\xA3"
+#define ICON_MD_PERM_DATA_SETTING "\xEE\xA2\xA4"
+#define ICON_MD_PERM_DEVICE_INFORMATION "\xEE\xA2\xA5"
+#define ICON_MD_PERM_IDENTITY "\xEE\xA2\xA6"
+#define ICON_MD_PERM_MEDIA "\xEE\xA2\xA7"
+#define ICON_MD_PERM_PHONE_MSG "\xEE\xA2\xA8"
+#define ICON_MD_PERM_SCAN_WIFI "\xEE\xA2\xA9"
+#define ICON_MD_PERSON "\xEE\x9F\xBD"
+#define ICON_MD_PERSON_ADD "\xEE\x9F\xBE"
+#define ICON_MD_PERSON_OUTLINE "\xEE\x9F\xBF"
+#define ICON_MD_PERSON_PIN "\xEE\x95\x9A"
+#define ICON_MD_PERSON_PIN_CIRCLE "\xEE\x95\xAA"
+#define ICON_MD_PERSONAL_VIDEO "\xEE\x98\xBB"
+#define ICON_MD_PETS "\xEE\xA4\x9D"
+#define ICON_MD_PHONE "\xEE\x83\x8D"
+#define ICON_MD_PHONE_ANDROID "\xEE\x8C\xA4"
+#define ICON_MD_PHONE_BLUETOOTH_SPEAKER "\xEE\x98\x9B"
+#define ICON_MD_PHONE_FORWARDED "\xEE\x98\x9C"
+#define ICON_MD_PHONE_IN_TALK "\xEE\x98\x9D"
+#define ICON_MD_PHONE_IPHONE "\xEE\x8C\xA5"
+#define ICON_MD_PHONE_LOCKED "\xEE\x98\x9E"
+#define ICON_MD_PHONE_MISSED "\xEE\x98\x9F"
+#define ICON_MD_PHONE_PAUSED "\xEE\x98\xA0"
+#define ICON_MD_PHONELINK "\xEE\x8C\xA6"
+#define ICON_MD_PHONELINK_ERASE "\xEE\x83\x9B"
+#define ICON_MD_PHONELINK_LOCK "\xEE\x83\x9C"
+#define ICON_MD_PHONELINK_OFF "\xEE\x8C\xA7"
+#define ICON_MD_PHONELINK_RING "\xEE\x83\x9D"
+#define ICON_MD_PHONELINK_SETUP "\xEE\x83\x9E"
+#define ICON_MD_PHOTO "\xEE\x90\x90"
+#define ICON_MD_PHOTO_ALBUM "\xEE\x90\x91"
+#define ICON_MD_PHOTO_CAMERA "\xEE\x90\x92"
+#define ICON_MD_PHOTO_FILTER "\xEE\x90\xBB"
+#define ICON_MD_PHOTO_LIBRARY "\xEE\x90\x93"
+#define ICON_MD_PHOTO_SIZE_SELECT_ACTUAL "\xEE\x90\xB2"
+#define ICON_MD_PHOTO_SIZE_SELECT_LARGE "\xEE\x90\xB3"
+#define ICON_MD_PHOTO_SIZE_SELECT_SMALL "\xEE\x90\xB4"
+#define ICON_MD_PICTURE_AS_PDF "\xEE\x90\x95"
+#define ICON_MD_PICTURE_IN_PICTURE "\xEE\xA2\xAA"
+#define ICON_MD_PICTURE_IN_PICTURE_ALT "\xEE\xA4\x91"
+#define ICON_MD_PIE_CHART "\xEE\x9B\x84"
+#define ICON_MD_PIE_CHART_OUTLINED "\xEE\x9B\x85"
+#define ICON_MD_PIN_DROP "\xEE\x95\x9E"
+#define ICON_MD_PLACE "\xEE\x95\x9F"
+#define ICON_MD_PLAY_ARROW "\xEE\x80\xB7"
+#define ICON_MD_PLAY_CIRCLE_FILLED "\xEE\x80\xB8"
+#define ICON_MD_PLAY_CIRCLE_OUTLINE "\xEE\x80\xB9"
+#define ICON_MD_PLAY_FOR_WORK "\xEE\xA4\x86"
+#define ICON_MD_PLAYLIST_ADD "\xEE\x80\xBB"
+#define ICON_MD_PLAYLIST_ADD_CHECK "\xEE\x81\xA5"
+#define ICON_MD_PLAYLIST_PLAY "\xEE\x81\x9F"
+#define ICON_MD_PLUS_ONE "\xEE\xA0\x80"
+#define ICON_MD_POLL "\xEE\xA0\x81"
+#define ICON_MD_POLYMER "\xEE\xA2\xAB"
+#define ICON_MD_POOL "\xEE\xAD\x88"
+#define ICON_MD_PORTABLE_WIFI_OFF "\xEE\x83\x8E"
+#define ICON_MD_PORTRAIT "\xEE\x90\x96"
+#define ICON_MD_POWER "\xEE\x98\xBC"
+#define ICON_MD_POWER_INPUT "\xEE\x8C\xB6"
+#define ICON_MD_POWER_SETTINGS_NEW "\xEE\xA2\xAC"
+#define ICON_MD_PREGNANT_WOMAN "\xEE\xA4\x9E"
+#define ICON_MD_PRESENT_TO_ALL "\xEE\x83\x9F"
+#define ICON_MD_PRINT "\xEE\xA2\xAD"
+#define ICON_MD_PRIORITY_HIGH "\xEE\x99\x85"
+#define ICON_MD_PUBLIC "\xEE\xA0\x8B"
+#define ICON_MD_PUBLISH "\xEE\x89\x95"
+#define ICON_MD_QUERY_BUILDER "\xEE\xA2\xAE"
+#define ICON_MD_QUESTION_ANSWER "\xEE\xA2\xAF"
+#define ICON_MD_QUEUE "\xEE\x80\xBC"
+#define ICON_MD_QUEUE_MUSIC "\xEE\x80\xBD"
+#define ICON_MD_QUEUE_PLAY_NEXT "\xEE\x81\xA6"
+#define ICON_MD_RADIO "\xEE\x80\xBE"
+#define ICON_MD_RADIO_BUTTON_CHECKED "\xEE\xA0\xB7"
+#define ICON_MD_RADIO_BUTTON_UNCHECKED "\xEE\xA0\xB6"
+#define ICON_MD_RATE_REVIEW "\xEE\x95\xA0"
+#define ICON_MD_RECEIPT "\xEE\xA2\xB0"
+#define ICON_MD_RECENT_ACTORS "\xEE\x80\xBF"
+#define ICON_MD_RECORD_VOICE_OVER "\xEE\xA4\x9F"
+#define ICON_MD_REDEEM "\xEE\xA2\xB1"
+#define ICON_MD_REDO "\xEE\x85\x9A"
+#define ICON_MD_REFRESH "\xEE\x97\x95"
+#define ICON_MD_REMOVE "\xEE\x85\x9B"
+#define ICON_MD_REMOVE_CIRCLE "\xEE\x85\x9C"
+#define ICON_MD_REMOVE_CIRCLE_OUTLINE "\xEE\x85\x9D"
+#define ICON_MD_REMOVE_FROM_QUEUE "\xEE\x81\xA7"
+#define ICON_MD_REMOVE_RED_EYE "\xEE\x90\x97"
+#define ICON_MD_REMOVE_SHOPPING_CART "\xEE\xA4\xA8"
+#define ICON_MD_REORDER "\xEE\xA3\xBE"
+#define ICON_MD_REPEAT "\xEE\x81\x80"
+#define ICON_MD_REPEAT_ONE "\xEE\x81\x81"
+#define ICON_MD_REPLAY "\xEE\x81\x82"
+#define ICON_MD_REPLAY_10 "\xEE\x81\x99"
+#define ICON_MD_REPLAY_30 "\xEE\x81\x9A"
+#define ICON_MD_REPLAY_5 "\xEE\x81\x9B"
+#define ICON_MD_REPLY "\xEE\x85\x9E"
+#define ICON_MD_REPLY_ALL "\xEE\x85\x9F"
+#define ICON_MD_REPORT "\xEE\x85\xA0"
+#define ICON_MD_REPORT_PROBLEM "\xEE\xA2\xB2"
+#define ICON_MD_RESTAURANT "\xEE\x95\xAC"
+#define ICON_MD_RESTAURANT_MENU "\xEE\x95\xA1"
+#define ICON_MD_RESTORE "\xEE\xA2\xB3"
+#define ICON_MD_RESTORE_PAGE "\xEE\xA4\xA9"
+#define ICON_MD_RING_VOLUME "\xEE\x83\x91"
+#define ICON_MD_ROOM "\xEE\xA2\xB4"
+#define ICON_MD_ROOM_SERVICE "\xEE\xAD\x89"
+#define ICON_MD_ROTATE_90_DEGREES_CCW "\xEE\x90\x98"
+#define ICON_MD_ROTATE_LEFT "\xEE\x90\x99"
+#define ICON_MD_ROTATE_RIGHT "\xEE\x90\x9A"
+#define ICON_MD_ROUNDED_CORNER "\xEE\xA4\xA0"
+#define ICON_MD_ROUTER "\xEE\x8C\xA8"
+#define ICON_MD_ROWING "\xEE\xA4\xA1"
+#define ICON_MD_RSS_FEED "\xEE\x83\xA5"
+#define ICON_MD_RV_HOOKUP "\xEE\x99\x82"
+#define ICON_MD_SATELLITE "\xEE\x95\xA2"
+#define ICON_MD_SAVE "\xEE\x85\xA1"
+#define ICON_MD_SCANNER "\xEE\x8C\xA9"
+#define ICON_MD_SCHEDULE "\xEE\xA2\xB5"
+#define ICON_MD_SCHOOL "\xEE\xA0\x8C"
+#define ICON_MD_SCREEN_LOCK_LANDSCAPE "\xEE\x86\xBE"
+#define ICON_MD_SCREEN_LOCK_PORTRAIT "\xEE\x86\xBF"
+#define ICON_MD_SCREEN_LOCK_ROTATION "\xEE\x87\x80"
+#define ICON_MD_SCREEN_ROTATION "\xEE\x87\x81"
+#define ICON_MD_SCREEN_SHARE "\xEE\x83\xA2"
+#define ICON_MD_SD_CARD "\xEE\x98\xA3"
+#define ICON_MD_SD_STORAGE "\xEE\x87\x82"
+#define ICON_MD_SEARCH "\xEE\xA2\xB6"
+#define ICON_MD_SECURITY "\xEE\x8C\xAA"
+#define ICON_MD_SELECT_ALL "\xEE\x85\xA2"
+#define ICON_MD_SEND "\xEE\x85\xA3"
+#define ICON_MD_SENTIMENT_DISSATISFIED "\xEE\xA0\x91"
+#define ICON_MD_SENTIMENT_NEUTRAL "\xEE\xA0\x92"
+#define ICON_MD_SENTIMENT_SATISFIED "\xEE\xA0\x93"
+#define ICON_MD_SENTIMENT_VERY_DISSATISFIED "\xEE\xA0\x94"
+#define ICON_MD_SENTIMENT_VERY_SATISFIED "\xEE\xA0\x95"
+#define ICON_MD_SETTINGS "\xEE\xA2\xB8"
+#define ICON_MD_SETTINGS_APPLICATIONS "\xEE\xA2\xB9"
+#define ICON_MD_SETTINGS_BACKUP_RESTORE "\xEE\xA2\xBA"
+#define ICON_MD_SETTINGS_BLUETOOTH "\xEE\xA2\xBB"
+#define ICON_MD_SETTINGS_BRIGHTNESS "\xEE\xA2\xBD"
+#define ICON_MD_SETTINGS_CELL "\xEE\xA2\xBC"
+#define ICON_MD_SETTINGS_ETHERNET "\xEE\xA2\xBE"
+#define ICON_MD_SETTINGS_INPUT_ANTENNA "\xEE\xA2\xBF"
+#define ICON_MD_SETTINGS_INPUT_COMPONENT "\xEE\xA3\x80"
+#define ICON_MD_SETTINGS_INPUT_COMPOSITE "\xEE\xA3\x81"
+#define ICON_MD_SETTINGS_INPUT_HDMI "\xEE\xA3\x82"
+#define ICON_MD_SETTINGS_INPUT_SVIDEO "\xEE\xA3\x83"
+#define ICON_MD_SETTINGS_OVERSCAN "\xEE\xA3\x84"
+#define ICON_MD_SETTINGS_PHONE "\xEE\xA3\x85"
+#define ICON_MD_SETTINGS_POWER "\xEE\xA3\x86"
+#define ICON_MD_SETTINGS_REMOTE "\xEE\xA3\x87"
+#define ICON_MD_SETTINGS_SYSTEM_DAYDREAM "\xEE\x87\x83"
+#define ICON_MD_SETTINGS_VOICE "\xEE\xA3\x88"
+#define ICON_MD_SHARE "\xEE\xA0\x8D"
+#define ICON_MD_SHOP "\xEE\xA3\x89"
+#define ICON_MD_SHOP_TWO "\xEE\xA3\x8A"
+#define ICON_MD_SHOPPING_BASKET "\xEE\xA3\x8B"
+#define ICON_MD_SHOPPING_CART "\xEE\xA3\x8C"
+#define ICON_MD_SHORT_TEXT "\xEE\x89\xA1"
+#define ICON_MD_SHOW_CHART "\xEE\x9B\xA1"
+#define ICON_MD_SHUFFLE "\xEE\x81\x83"
+#define ICON_MD_SIGNAL_CELLULAR_4_BAR "\xEE\x87\x88"
+#define ICON_MD_SIGNAL_CELLULAR_CONNECTED_NO_INTERNET_4_BAR "\xEE\x87\x8D"
+#define ICON_MD_SIGNAL_CELLULAR_NO_SIM "\xEE\x87\x8E"
+#define ICON_MD_SIGNAL_CELLULAR_NULL "\xEE\x87\x8F"
+#define ICON_MD_SIGNAL_CELLULAR_OFF "\xEE\x87\x90"
+#define ICON_MD_SIGNAL_WIFI_4_BAR "\xEE\x87\x98"
+#define ICON_MD_SIGNAL_WIFI_4_BAR_LOCK "\xEE\x87\x99"
+#define ICON_MD_SIGNAL_WIFI_OFF "\xEE\x87\x9A"
+#define ICON_MD_SIM_CARD "\xEE\x8C\xAB"
+#define ICON_MD_SIM_CARD_ALERT "\xEE\x98\xA4"
+#define ICON_MD_SKIP_NEXT "\xEE\x81\x84"
+#define ICON_MD_SKIP_PREVIOUS "\xEE\x81\x85"
+#define ICON_MD_SLIDESHOW "\xEE\x90\x9B"
+#define ICON_MD_SLOW_MOTION_VIDEO "\xEE\x81\xA8"
+#define ICON_MD_SMARTPHONE "\xEE\x8C\xAC"
+#define ICON_MD_SMOKE_FREE "\xEE\xAD\x8A"
+#define ICON_MD_SMOKING_ROOMS "\xEE\xAD\x8B"
+#define ICON_MD_SMS "\xEE\x98\xA5"
+#define ICON_MD_SMS_FAILED "\xEE\x98\xA6"
+#define ICON_MD_SNOOZE "\xEE\x81\x86"
+#define ICON_MD_SORT "\xEE\x85\xA4"
+#define ICON_MD_SORT_BY_ALPHA "\xEE\x81\x93"
+#define ICON_MD_SPA "\xEE\xAD\x8C"
+#define ICON_MD_SPACE_BAR "\xEE\x89\x96"
+#define ICON_MD_SPEAKER "\xEE\x8C\xAD"
+#define ICON_MD_SPEAKER_GROUP "\xEE\x8C\xAE"
+#define ICON_MD_SPEAKER_NOTES "\xEE\xA3\x8D"
+#define ICON_MD_SPEAKER_NOTES_OFF "\xEE\xA4\xAA"
+#define ICON_MD_SPEAKER_PHONE "\xEE\x83\x92"
+#define ICON_MD_SPELLCHECK "\xEE\xA3\x8E"
+#define ICON_MD_STAR "\xEE\xA0\xB8"
+#define ICON_MD_STAR_BORDER "\xEE\xA0\xBA"
+#define ICON_MD_STAR_HALF "\xEE\xA0\xB9"
+#define ICON_MD_STARS "\xEE\xA3\x90"
+#define ICON_MD_STAY_CURRENT_LANDSCAPE "\xEE\x83\x93"
+#define ICON_MD_STAY_CURRENT_PORTRAIT "\xEE\x83\x94"
+#define ICON_MD_STAY_PRIMARY_LANDSCAPE "\xEE\x83\x95"
+#define ICON_MD_STAY_PRIMARY_PORTRAIT "\xEE\x83\x96"
+#define ICON_MD_STOP "\xEE\x81\x87"
+#define ICON_MD_STOP_SCREEN_SHARE "\xEE\x83\xA3"
+#define ICON_MD_STORAGE "\xEE\x87\x9B"
+#define ICON_MD_STORE "\xEE\xA3\x91"
+#define ICON_MD_STORE_MALL_DIRECTORY "\xEE\x95\xA3"
+#define ICON_MD_STRAIGHTEN "\xEE\x90\x9C"
+#define ICON_MD_STREETVIEW "\xEE\x95\xAE"
+#define ICON_MD_STRIKETHROUGH_S "\xEE\x89\x97"
+#define ICON_MD_STYLE "\xEE\x90\x9D"
+#define ICON_MD_SUBDIRECTORY_ARROW_LEFT "\xEE\x97\x99"
+#define ICON_MD_SUBDIRECTORY_ARROW_RIGHT "\xEE\x97\x9A"
+#define ICON_MD_SUBJECT "\xEE\xA3\x92"
+#define ICON_MD_SUBSCRIPTIONS "\xEE\x81\xA4"
+#define ICON_MD_SUBTITLES "\xEE\x81\x88"
+#define ICON_MD_SUBWAY "\xEE\x95\xAF"
+#define ICON_MD_SUPERVISOR_ACCOUNT "\xEE\xA3\x93"
+#define ICON_MD_SURROUND_SOUND "\xEE\x81\x89"
+#define ICON_MD_SWAP_CALLS "\xEE\x83\x97"
+#define ICON_MD_SWAP_HORIZ "\xEE\xA3\x94"
+#define ICON_MD_SWAP_VERT "\xEE\xA3\x95"
+#define ICON_MD_SWAP_VERTICAL_CIRCLE "\xEE\xA3\x96"
+#define ICON_MD_SWITCH_CAMERA "\xEE\x90\x9E"
+#define ICON_MD_SWITCH_VIDEO "\xEE\x90\x9F"
+#define ICON_MD_SYNC "\xEE\x98\xA7"
+#define ICON_MD_SYNC_DISABLED "\xEE\x98\xA8"
+#define ICON_MD_SYNC_PROBLEM "\xEE\x98\xA9"
+#define ICON_MD_SYSTEM_UPDATE "\xEE\x98\xAA"
+#define ICON_MD_SYSTEM_UPDATE_ALT "\xEE\xA3\x97"
+#define ICON_MD_TAB "\xEE\xA3\x98"
+#define ICON_MD_TAB_UNSELECTED "\xEE\xA3\x99"
+#define ICON_MD_TABLET "\xEE\x8C\xAF"
+#define ICON_MD_TABLET_ANDROID "\xEE\x8C\xB0"
+#define ICON_MD_TABLET_MAC "\xEE\x8C\xB1"
+#define ICON_MD_TAG_FACES "\xEE\x90\xA0"
+#define ICON_MD_TAP_AND_PLAY "\xEE\x98\xAB"
+#define ICON_MD_TERRAIN "\xEE\x95\xA4"
+#define ICON_MD_TEXT_FIELDS "\xEE\x89\xA2"
+#define ICON_MD_TEXT_FORMAT "\xEE\x85\xA5"
+#define ICON_MD_TEXTSMS "\xEE\x83\x98"
+#define ICON_MD_TEXTURE "\xEE\x90\xA1"
+#define ICON_MD_THEATERS "\xEE\xA3\x9A"
+#define ICON_MD_THUMB_DOWN "\xEE\xA3\x9B"
+#define ICON_MD_THUMB_UP "\xEE\xA3\x9C"
+#define ICON_MD_THUMBS_UP_DOWN "\xEE\xA3\x9D"
+#define ICON_MD_TIME_TO_LEAVE "\xEE\x98\xAC"
+#define ICON_MD_TIMELAPSE "\xEE\x90\xA2"
+#define ICON_MD_TIMELINE "\xEE\xA4\xA2"
+#define ICON_MD_TIMER "\xEE\x90\xA5"
+#define ICON_MD_TIMER_10 "\xEE\x90\xA3"
+#define ICON_MD_TIMER_3 "\xEE\x90\xA4"
+#define ICON_MD_TIMER_OFF "\xEE\x90\xA6"
+#define ICON_MD_TITLE "\xEE\x89\xA4"
+#define ICON_MD_TOC "\xEE\xA3\x9E"
+#define ICON_MD_TODAY "\xEE\xA3\x9F"
+#define ICON_MD_TOLL "\xEE\xA3\xA0"
+#define ICON_MD_TONALITY "\xEE\x90\xA7"
+#define ICON_MD_TOUCH_APP "\xEE\xA4\x93"
+#define ICON_MD_TOYS "\xEE\x8C\xB2"
+#define ICON_MD_TRACK_CHANGES "\xEE\xA3\xA1"
+#define ICON_MD_TRAFFIC "\xEE\x95\xA5"
+#define ICON_MD_TRAIN "\xEE\x95\xB0"
+#define ICON_MD_TRAM "\xEE\x95\xB1"
+#define ICON_MD_TRANSFER_WITHIN_A_STATION "\xEE\x95\xB2"
+#define ICON_MD_TRANSFORM "\xEE\x90\xA8"
+#define ICON_MD_TRANSLATE "\xEE\xA3\xA2"
+#define ICON_MD_TRENDING_DOWN "\xEE\xA3\xA3"
+#define ICON_MD_TRENDING_FLAT "\xEE\xA3\xA4"
+#define ICON_MD_TRENDING_UP "\xEE\xA3\xA5"
+#define ICON_MD_TUNE "\xEE\x90\xA9"
+#define ICON_MD_TURNED_IN "\xEE\xA3\xA6"
+#define ICON_MD_TURNED_IN_NOT "\xEE\xA3\xA7"
+#define ICON_MD_TV "\xEE\x8C\xB3"
+#define ICON_MD_UNARCHIVE "\xEE\x85\xA9"
+#define ICON_MD_UNDO "\xEE\x85\xA6"
+#define ICON_MD_UNFOLD_LESS "\xEE\x97\x96"
+#define ICON_MD_UNFOLD_MORE "\xEE\x97\x97"
+#define ICON_MD_UPDATE "\xEE\xA4\xA3"
+#define ICON_MD_USB "\xEE\x87\xA0"
+#define ICON_MD_VERIFIED_USER "\xEE\xA3\xA8"
+#define ICON_MD_VERTICAL_ALIGN_BOTTOM "\xEE\x89\x98"
+#define ICON_MD_VERTICAL_ALIGN_CENTER "\xEE\x89\x99"
+#define ICON_MD_VERTICAL_ALIGN_TOP "\xEE\x89\x9A"
+#define ICON_MD_VIBRATION "\xEE\x98\xAD"
+#define ICON_MD_VIDEO_CALL "\xEE\x81\xB0"
+#define ICON_MD_VIDEO_LABEL "\xEE\x81\xB1"
+#define ICON_MD_VIDEO_LIBRARY "\xEE\x81\x8A"
+#define ICON_MD_VIDEOCAM "\xEE\x81\x8B"
+#define ICON_MD_VIDEOCAM_OFF "\xEE\x81\x8C"
+#define ICON_MD_VIDEOGAME_ASSET "\xEE\x8C\xB8"
+#define ICON_MD_VIEW_AGENDA "\xEE\xA3\xA9"
+#define ICON_MD_VIEW_ARRAY "\xEE\xA3\xAA"
+#define ICON_MD_VIEW_CAROUSEL "\xEE\xA3\xAB"
+#define ICON_MD_VIEW_COLUMN "\xEE\xA3\xAC"
+#define ICON_MD_VIEW_COMFY "\xEE\x90\xAA"
+#define ICON_MD_VIEW_COMPACT "\xEE\x90\xAB"
+#define ICON_MD_VIEW_DAY "\xEE\xA3\xAD"
+#define ICON_MD_VIEW_HEADLINE "\xEE\xA3\xAE"
+#define ICON_MD_VIEW_LIST "\xEE\xA3\xAF"
+#define ICON_MD_VIEW_MODULE "\xEE\xA3\xB0"
+#define ICON_MD_VIEW_QUILT "\xEE\xA3\xB1"
+#define ICON_MD_VIEW_STREAM "\xEE\xA3\xB2"
+#define ICON_MD_VIEW_WEEK "\xEE\xA3\xB3"
+#define ICON_MD_VIGNETTE "\xEE\x90\xB5"
+#define ICON_MD_VISIBILITY "\xEE\xA3\xB4"
+#define ICON_MD_VISIBILITY_OFF "\xEE\xA3\xB5"
+#define ICON_MD_VOICE_CHAT "\xEE\x98\xAE"
+#define ICON_MD_VOICEMAIL "\xEE\x83\x99"
+#define ICON_MD_VOLUME_DOWN "\xEE\x81\x8D"
+#define ICON_MD_VOLUME_MUTE "\xEE\x81\x8E"
+#define ICON_MD_VOLUME_OFF "\xEE\x81\x8F"
+#define ICON_MD_VOLUME_UP "\xEE\x81\x90"
+#define ICON_MD_VPN_KEY "\xEE\x83\x9A"
+#define ICON_MD_VPN_LOCK "\xEE\x98\xAF"
+#define ICON_MD_WALLPAPER "\xEE\x86\xBC"
+#define ICON_MD_WARNING "\xEE\x80\x82"
+#define ICON_MD_WATCH "\xEE\x8C\xB4"
+#define ICON_MD_WATCH_LATER "\xEE\xA4\xA4"
+#define ICON_MD_WB_AUTO "\xEE\x90\xAC"
+#define ICON_MD_WB_CLOUDY "\xEE\x90\xAD"
+#define ICON_MD_WB_INCANDESCENT "\xEE\x90\xAE"
+#define ICON_MD_WB_IRIDESCENT "\xEE\x90\xB6"
+#define ICON_MD_WB_SUNNY "\xEE\x90\xB0"
+#define ICON_MD_WC "\xEE\x98\xBD"
+#define ICON_MD_WEB "\xEE\x81\x91"
+#define ICON_MD_WEB_ASSET "\xEE\x81\xA9"
+#define ICON_MD_WEEKEND "\xEE\x85\xAB"
+#define ICON_MD_WHATSHOT "\xEE\xA0\x8E"
+#define ICON_MD_WIDGETS "\xEE\x86\xBD"
+#define ICON_MD_WIFI "\xEE\x98\xBE"
+#define ICON_MD_WIFI_LOCK "\xEE\x87\xA1"
+#define ICON_MD_WIFI_TETHERING "\xEE\x87\xA2"
+#define ICON_MD_WORK "\xEE\xA3\xB9"
+#define ICON_MD_WRAP_TEXT "\xEE\x89\x9B"
+#define ICON_MD_YOUTUBE_SEARCHED_FOR "\xEE\xA3\xBA"
+#define ICON_MD_ZOOM_IN "\xEE\xA3\xBF"
+#define ICON_MD_ZOOM_OUT "\xEE\xA4\x80"
+#define ICON_MD_ZOOM_OUT_MAP "\xEE\x95\xAB"
diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h
index 04900cfb0a0..968f4bc0069 100644
--- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h
+++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h
@@ -29,7 +29,7 @@
#endif
#define NV_FASTCALL __attribute__((fastcall))
-#define NV_FORCEINLINE __attribute__((always_inline)) inline
+#define NV_FORCEINLINE inline
#define NV_DEPRECATED __attribute__((deprecated))
#define NV_THREAD_LOCAL //ACS: there's no "__thread" or equivalent on iOS/OSX
diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h
index 5d2e4b8dcd0..117d342ea7d 100644
--- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h
+++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h
@@ -31,7 +31,7 @@
#define NV_FASTCALL __attribute__((fastcall))
//#if __GNUC__ > 3
// It seems that GCC does not assume always_inline implies inline. I think this depends on the GCC version :(
-#define NV_FORCEINLINE inline __attribute__((always_inline))
+#define NV_FORCEINLINE inline
//#else
// Some compilers complain that inline and always_inline are redundant.
//#define NV_FORCEINLINE __attribute__((always_inline))
diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h
index e416d3d4153..68465c8247f 100644
--- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h
+++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h
@@ -19,7 +19,7 @@
#endif
#define NV_FASTCALL __attribute__((fastcall))
-#define NV_FORCEINLINE __attribute__((always_inline))
+#define NV_FORCEINLINE inline
#define NV_DEPRECATED __attribute__((deprecated))
#if __GNUC__ > 2
diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h
index 7b3876ab4b3..a6c6bf93bda 100644
--- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h
+++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h
@@ -48,7 +48,7 @@
#endif
#define NV_NOINLINE __declspec(noinline)
-#define NV_FORCEINLINE __forceinline
+#define NV_FORCEINLINE inline
#define NV_THREAD_LOCAL __declspec(thread)
diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h b/3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h
index 7a64f600153..94f7ec7947a 100644
--- a/3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h
+++ b/3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h
@@ -35,7 +35,12 @@ namespace nv
inline bool isFinite(const float f)
{
+#if defined(_MSC_VER) && _MSC_VER <= 1800
+ (void)f;
+ return true;
+#else
return std::isfinite(f);
+#endif // defined(_MSC_VER) && _MSC_VER <= 1800
}
// Eliminates negative zeros from a float array.
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
index c7adf2efba6..aa8d8f1d657 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
@@ -17,6 +17,7 @@
- PROGRAMMER GUIDE (read me!)
- API BREAKING CHANGES (read me when you update!)
- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS
+ - How can I help?
- How do I update to a newer version of ImGui?
- Can I have multiple widgets with the same label? Can I have widget without a label? (Yes)
- I integrated ImGui in my engine and the text or lines are blurry..
@@ -148,6 +149,7 @@
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
+ - 2016/01/23 (1.48) - fixed not honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. if you had manual pixel-perfect alignment in place it might affect you.
- 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis.
- 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete.
- 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position.
@@ -236,6 +238,10 @@
FREQUENTLY ASKED QUESTIONS (FAQ), TIPS
======================================
+ Q: How can I help?
+ A: - If you are experienced enough with ImGui and with C/C++, look at the todo list and see how you want/can help!
+ - Become a Patron/donate. Convince your company to become a Patron or provide serious funding for development time.
+
Q: How do I update to a newer version of ImGui?
A: Overwrite the following files:
imgui.cpp
@@ -359,6 +365,7 @@
Q: How can I load multiple fonts?
A: Use the font atlas to pack them into a single texture:
+ (Read extra_fonts/README.txt and the code in ImFontAtlas for more details.)
ImGuiIO& io = ImGui::GetIO();
ImFont* font0 = io.Fonts->AddFontDefault();
@@ -371,7 +378,7 @@
// Options
ImFontConfig config;
config.OversampleH = 3;
- config.OversampleV = 3;
+ config.OversampleV = 1;
config.GlyphExtraSpacing.x = 1.0f;
io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, &config);
@@ -383,8 +390,6 @@
io.Fonts->LoadFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges);
io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese());
- Read extra_fonts/README.txt or ImFontAtlas class for more details.
-
Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
A: When loading a font, pass custom Unicode ranges to specify the glyphs to load. ImGui will support UTF-8 encoding across the board.
Character input depends on you passing the right character code to io.AddInputCharacter(). The example applications do that.
@@ -402,9 +407,10 @@
ISSUES & TODO-LIST
==================
- Issue numbers (#) refer to github issues.
+ Issue numbers (#) refer to github issues listed at https://github.com/ocornut/imgui/issues
The list below consist mostly of notes of things to do before they are requested/discussed by users (at that point it usually happens on the github)
+ - doc: add a proper documentation+regression testing system (#435)
- window: maximum window size settings (per-axis). for large popups in particular user may not want the popup to fill all space.
- window: add a way for very transient windows (non-saved, temporary overlay over hundreds of objects) to "clean" up from the global window list. perhaps a lightweight explicit cleanup pass.
- window: calling SetNextWindowSize() every frame with <= 0 doesn't do anything, may be useful to allow (particularly when used for a single axis).
@@ -421,7 +427,7 @@
- window/tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic.
- draw-list: maintaining bounding box per command would allow to merge draw command when clipping isn't relied on (typical non-scrolling window or non-overflowing column would merge with previous command).
!- scrolling: allow immediately effective change of scroll if we haven't appended items yet
- - splitter: formalize the splitter idiom into an official api (we want to handle n-way split)
+ - splitter/separator: formalize the splitter idiom into an official api (we want to handle n-way split) (#319)
- widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc.
- widgets: clean up widgets internal toward exposing everything.
- widgets: add disabled and read-only modes (#211)
@@ -444,13 +450,14 @@
- layout: horizontal flow until no space left (#404)
- layout: more generic alignment state (left/right/centered) for single items?
- layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding.
+ - columns: declare column set (each column: fixed size, %, fill, distribute default size among fills) (#513, #125)
+ - columns: add a conditional parameter to SetColumnOffset() (#513, #125)
- columns: separator function or parameter that works within the column (currently Separator() bypass all columns) (#125)
- - columns: declare column set (each column: fixed size, %, fill, distribute default size among fills) (#125)
- - columns: columns header to act as button (~sort op) and allow resize/reorder (#125)
- - columns: user specify columns size (#125)
+ - columns: columns header to act as button (~sort op) and allow resize/reorder (#513, #125)
+ - columns: user specify columns size (#513, #125)
- columns: flag to add horizontal separator above/below?
- columns/layout: setup minimum line height (equivalent of automatically calling AlignFirstTextHeightToWidgets)
- - combo: sparse combo boxes (via function call?)
+ - combo: sparse combo boxes (via function call?) / iterators
- combo: contents should extends to fit label if combo widget is small
- combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203)
- listbox: multiple selection
@@ -460,15 +467,16 @@
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
- popups: add variant using global identifier similar to Begin/End (#402)
- popups: border options. richer api like BeginChild() perhaps? (#197)
- - menus: local shortcuts, global shortcuts (#126)
+ - menus: local shortcuts, global shortcuts (#456, #126)
- menus: icons
- menus: menubars: some sort of priority / effect of main menu-bar on desktop size?
- statusbar: add a per-window status bar helper similar to what menubar does.
- - tabs
+ - tabs (#261, #351)
- separator: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y)
- - gauge: various forms of gauge/loading bars widgets
- color: the color helpers/typing is a mess and needs sorting out.
- - color: add a better color picker
+ - color: add a better color picker (#346)
+ - node/graph editor (#306)
+ - pie menus patterns (#434)
- plot: PlotLines() should use the polygon-stroke facilities (currently issues with averaging normals)
- plot: make it easier for user to draw extra stuff into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots)
- plot: "smooth" automatic scale over time, user give an input 0.0(full user scale) 1.0(full derived from value)
@@ -491,12 +499,14 @@
- textwrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (git issue #249)
- settings: write more decent code to allow saving/loading new fields
- settings: api for per-tool simple persistent data (bool,int,float,columns sizes,etc.) in .ini file
+ - style: add window shadows.
- style/optimization: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding.
- style: color-box not always square?
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
- style: global scale setting.
- text: simple markup language for color change?
+ - font: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier.
- font: helper to add glyph redirect/replacements (e.g. redirect alternate apostrophe unicode code points to ascii one, etc.)
- log: LogButtons() options for specifying depth and/or hiding depth slider
- log: have more control over the log scope (e.g. stop logging when leaving current tree node scope)
@@ -506,14 +516,16 @@
- filters: handle wildcards (with implicit leading/trailing *), regexps
- shortcuts: add a shortcut api, e.g. parse "&Save" and/or "Save (CTRL+S)", pass in to widgets or provide simple ways to use (button=activate, input=focus)
!- keyboard: tooltip & combo boxes are messing up / not honoring keyboard tabbing
- - keyboard: full keyboard navigation and focus.
+ - keyboard: full keyboard navigation and focus. (#323)
- focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame)
- input: rework IO system to be able to pass actual ordered/timestamped events.
+ - input: allow to decide and pass explicit double-clicks (e.g. for windows by the CS_DBLCLKS style).
- input: support track pad style scrolling & slider edit.
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
- misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
- style editor: have a more global HSV setter (e.g. alter hue on all elements). consider replacing active/hovered by offset in HSV space? (#438)
- style editor: color child window height expressed in multiple of line height.
+ - remote: make a system like RemoteImGui first-class citizen/project (#75)
- drawlist: user probably can't call Clear() because we expect a texture to be pushed in the stack.
- examples: directx9/directx11: save/restore device state more thoroughly.
- optimization: use another hash function than crc32, e.g. FNV1a
@@ -528,13 +540,13 @@
#include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS
+#define IMGUI_DEFINE_PLACEMENT_NEW
#include "imgui_internal.h"
#include <ctype.h> // toupper, isprint
#include <math.h> // sqrtf, fabsf, fmodf, powf, cosf, sinf, floorf, ceilf
#include <stdlib.h> // NULL, malloc, free, qsort, atoi
#include <stdio.h> // vsnprintf, sscanf, printf
-#include <new> // new (ptr)
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
#include <stddef.h> // intptr_t
#else
@@ -611,7 +623,7 @@ static void ClosePopupToLevel(int remaining);
static void ClosePopup(ImGuiID id);
static bool IsPopupOpen(ImGuiID id);
static ImGuiWindow* GetFrontMostModalRootWindow();
-static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, ImGuiWindowFlags flags, int* last_dir, const ImRect& r_inner);
+static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, int* last_dir, const ImRect& rect_to_avoid);
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data);
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
@@ -818,10 +830,9 @@ int ImStrnicmp(const char* str1, const char* str2, int count)
char* ImStrdup(const char *str)
{
- char *buff = (char*)ImGui::MemAlloc(strlen(str) + 1);
- IM_ASSERT(buff);
- strcpy(buff, str);
- return buff;
+ size_t len = strlen(str) + 1;
+ void* buff = ImGui::MemAlloc(len);
+ return (char*)memcpy(buff, (const void*)str, len);
}
int ImStrlenW(const ImWchar* str)
@@ -1535,6 +1546,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);
ScrollbarX = ScrollbarY = false;
ScrollbarSizes = ImVec2(0.0f, 0.0f);
+ BorderSize = 0.0f;
Active = WasActive = false;
Accessed = false;
Collapsed = false;
@@ -1553,7 +1565,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
FontWindowScale = 1.0f;
DrawList = (ImDrawList*)ImGui::MemAlloc(sizeof(ImDrawList));
- new(DrawList) ImDrawList();
+ IM_PLACEMENT_NEW(DrawList) ImDrawList();
DrawList->_OwnerName = Name;
RootWindow = NULL;
RootNonPopupWindow = NULL;
@@ -1827,7 +1839,7 @@ size_t ImGui::GetInternalStateSize()
void ImGui::SetInternalState(void* state, bool construct)
{
if (construct)
- new (state) ImGuiState();
+ IM_PLACEMENT_NEW(state) ImGuiState();
GImGui = (ImGuiState*)state;
}
@@ -1872,7 +1884,7 @@ void ImGui::NewFrame()
{
// Initialize on first frame
g.LogClipboard = (ImGuiTextBuffer*)ImGui::MemAlloc(sizeof(ImGuiTextBuffer));
- new(g.LogClipboard) ImGuiTextBuffer();
+ IM_PLACEMENT_NEW(g.LogClipboard) ImGuiTextBuffer();
IM_ASSERT(g.Settings.empty());
LoadSettings();
@@ -2276,15 +2288,19 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDr
{
if (!draw_list->CmdBuffer.empty() && !draw_list->VtxBuffer.empty())
{
- if (draw_list->CmdBuffer.back().ElemCount == 0)
+ // Remove trailing command if unused
+ ImDrawCmd& last_cmd = draw_list->CmdBuffer.back();
+ if (last_cmd.ElemCount == 0 && last_cmd.UserCallback == NULL)
draw_list->CmdBuffer.pop_back();
+
out_render_list.push_back(draw_list);
// Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices)
// If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly.
const unsigned long long int max_vtx_idx = (unsigned long long int)1L << (sizeof(ImDrawIdx)*8);
(void)max_vtx_idx;
- IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); // Too many vertices in same ImDrawList
+ IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); // Sanity check. Bug or mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
+ IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); // Too many vertices in same ImDrawList. See comment above.
GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size;
GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size;
@@ -2488,17 +2504,8 @@ static const char* FindTextDisplayEnd(const char* text, const char* text_end)
if (!text_end)
text_end = (const char*)-1;
- ImGuiState& g = *GImGui;
- if (g.DisableHideTextAfterDoubleHash > 0)
- {
- while (text_display_end < text_end && *text_display_end != '\0')
- text_display_end++;
- }
- else
- {
- while (text_display_end < text_end && *text_display_end != '\0' && (text_display_end[0] != '#' || text_display_end[1] != '#'))
- text_display_end++;
- }
+ while (text_display_end < text_end && *text_display_end != '\0' && (text_display_end[0] != '#' || text_display_end[1] != '#'))
+ text_display_end++;
return text_display_end;
}
@@ -2736,6 +2743,8 @@ ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_tex
ImFont* font = g.Font;
const float font_size = g.FontSize;
+ if (text == text_display_end)
+ return ImVec2(0.0f, font_size);
ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);
// Cancel out character spacing for the last character of a line (it is baked into glyph->XAdvance field)
@@ -3421,7 +3430,7 @@ static void CheckStacksSize(ImGuiWindow* window, bool write)
IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));
}
-static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, ImGuiWindowFlags flags, int* last_dir, const ImRect& r_inner)
+static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, int* last_dir, const ImRect& r_inner)
{
const ImGuiStyle& style = GImGui->Style;
@@ -3431,7 +3440,7 @@ static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size,
r_outer.Reduce(ImVec2((size.x - r_outer.GetWidth() > safe_padding.x*2) ? safe_padding.x : 0.0f, (size.y - r_outer.GetHeight() > safe_padding.y*2) ? safe_padding.y : 0.0f));
ImVec2 base_pos_clamped = ImClamp(base_pos, r_outer.Min, r_outer.Max - size);
- for (int n = (*last_dir != -1) ? -1 : 0; n < 4; n++) // Right, down, up, left. Favor last used direction.
+ for (int n = (*last_dir != -1) ? -1 : 0; n < 4; n++) // Last, Right, down, up, left. (Favor last used direction).
{
const int dir = (n == -1) ? *last_dir : n;
ImRect rect(dir == 0 ? r_inner.Max.x : r_outer.Min.x, dir == 1 ? r_inner.Max.y : r_outer.Min.y, dir == 3 ? r_inner.Min.x : r_outer.Max.x, dir == 2 ? r_inner.Min.y : r_outer.Max.y);
@@ -3441,12 +3450,8 @@ static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size,
return ImVec2(dir == 0 ? r_inner.Max.x : dir == 3 ? r_inner.Min.x - size.x : base_pos_clamped.x, dir == 1 ? r_inner.Max.y : dir == 2 ? r_inner.Min.y - size.y : base_pos_clamped.y);
}
- // Fallback
+ // Fallback, try to keep within display
*last_dir = -1;
- if (flags & ImGuiWindowFlags_Tooltip) // For tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.
- return base_pos + ImVec2(2,2);
-
- // Otherwise try to keep within display
ImVec2 pos = base_pos;
pos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x);
pos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y);
@@ -3470,7 +3475,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
// Create window the first time
ImGuiWindow* window = (ImGuiWindow*)ImGui::MemAlloc(sizeof(ImGuiWindow));
- new(window) ImGuiWindow(name);
+ IM_PLACEMENT_NEW(window) ImGuiWindow(name);
window->Flags = flags;
if (flags & ImGuiWindowFlags_NoSavedSettings)
@@ -3810,19 +3815,21 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
rect_to_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight());
else
rect_to_avoid = ImRect(parent_window->Pos.x + style.ItemSpacing.x, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - style.ItemSpacing.x - parent_window->ScrollbarSizes.x, FLT_MAX); // We want some overlap to convey the relative depth of each popup (here hard-coded to 4)
- window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid);
+ window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
}
else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_appearing_after_being_hidden)
{
ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1);
- window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid);
+ window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
}
// Position tooltip (always follows mouse)
if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api)
{
ImRect rect_to_avoid(g.IO.MousePos.x - 16, g.IO.MousePos.y - 8, g.IO.MousePos.x + 24, g.IO.MousePos.y + 24); // FIXME: Completely hard-coded. Perhaps center on cursor hit-point instead?
- window->PosFloat = FindBestPopupWindowPos(g.IO.MousePos, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid);
+ window->PosFloat = FindBestPopupWindowPos(g.IO.MousePos, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
+ if (window->AutoPosLastDirection == -1)
+ window->PosFloat = g.IO.MousePos + ImVec2(2,2); // If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.
}
// User moving window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
@@ -3936,9 +3943,10 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
}
// Scrollbars
- window->ScrollbarY = (window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar);
- window->ScrollbarX = (window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar);
+ window->ScrollbarY = (flags & ImGuiWindowFlags_ForceVerticalScrollbar) || ((window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
+ window->ScrollbarX = (flags & ImGuiWindowFlags_ForceHorizontalScrollbar) || ((window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
+ window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
// Window background
if (bg_alpha > 0.0f)
@@ -3978,11 +3986,10 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
// (after the input handling so we don't have a frame of latency)
if (!(flags & ImGuiWindowFlags_NoResize))
{
- const float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
const ImVec2 br = window->Rect().GetBR();
- window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -border_size));
- window->DrawList->PathLineTo(br + ImVec2(-border_size, -resize_corner_size));
- window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - border_size, br.y - window_rounding - border_size), window_rounding, 0, 3);
+ window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -window->BorderSize));
+ window->DrawList->PathLineTo(br + ImVec2(-window->BorderSize, -resize_corner_size));
+ window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - window->BorderSize, br.y - window_rounding - window->BorderSize), window_rounding, 0, 3);
window->DrawList->PathFill(resize_col);
}
@@ -4072,13 +4079,12 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.
const ImRect title_bar_rect = window->TitleBarRect();
- const float border_size = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
+ const float border_size = window->BorderSize;
ImRect clip_rect;
clip_rect.Min.x = title_bar_rect.Min.x + 0.5f + ImMax(border_size, window->WindowPadding.x*0.5f);
clip_rect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + 0.5f + border_size;
clip_rect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - ImMax(border_size, window->WindowPadding.x*0.5f);
clip_rect.Max.y = window->Pos.y + window->Size.y - border_size - window->ScrollbarSizes.y;
-
PushClipRect(clip_rect.Min, clip_rect.Max, true);
// Clear 'accessed' flag last thing
@@ -4094,7 +4100,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
window->Collapsed = parent_window && parent_window->Collapsed;
if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
- window->Collapsed |= (window->ClipRect.Min.x >= window->ClipRect.Max.x || window->ClipRect.Min.y >= window->ClipRect.Max.y);
+ window->Collapsed |= (window->ClippedWindowRect.Min.x >= window->ClippedWindowRect.Max.x || window->ClippedWindowRect.Min.y >= window->ClippedWindowRect.Max.y);
// We also hide the window from rendering because we've already added its border to the command list.
// (we could perform the check earlier in the function but it is simpler at this point)
@@ -4145,7 +4151,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);
float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f;
const ImRect window_rect = window->Rect();
- const float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
+ const float border_size = window->BorderSize;
ImRect bb = horizontal
? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size)
: ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size);
@@ -4278,8 +4284,8 @@ static void PushMultiItemsWidths(int components, float w_full)
const ImGuiStyle& style = GImGui->Style;
if (w_full <= 0.0f)
w_full = ImGui::CalcItemWidth();
- const float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)) / (float)components));
- const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)));
+ const float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.ItemInnerSpacing.x) * (components-1)) / (float)components));
+ const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components-1)));
window->DC.ItemWidthStack.push_back(w_item_last);
for (int i = 0; i < components-1; i++)
window->DC.ItemWidthStack.push_back(w_item_one);
@@ -4300,9 +4306,8 @@ float ImGui::CalcItemWidth()
if (w < 0.0f)
{
// Align to a right-side limit. We include 1 frame padding in the calculation because this is how the width is always used (we add 2 frame padding to it), but we could move that responsibility to the widget as well.
- ImGuiState& g = *GImGui;
float width_to_right_edge = ImGui::GetContentRegionAvail().x;
- w = ImMax(1.0f, width_to_right_edge + w - g.Style.FramePadding.x * 2.0f);
+ w = ImMax(1.0f, width_to_right_edge + w);
}
w = (float)(int)w;
return w;
@@ -5163,8 +5168,8 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
const float w = CalcItemWidth();
const ImVec2 label_size = CalcTextSize(label, NULL, true);
- const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + style.FramePadding.x*2, label_size.y + style.FramePadding.y*2));
- const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + style.FramePadding.x*2 + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size);
+ const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2));
+ const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size);
ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, NULL))
return;
@@ -5173,7 +5178,8 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
const char* value_text_begin = &g.TempBuffer[0];
const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImGuiAlign_VCenter);
- RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
+ if (label_size.x > 0.0f)
+ RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
}
void ImGui::LabelText(const char* label, const char* fmt, ...)
@@ -5271,7 +5277,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
ImGuiState& g = *GImGui;
const ImGuiStyle& style = g.Style;
const ImGuiID id = window->GetID(label);
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
ImVec2 pos = window->DC.CursorPos;
if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset)
@@ -5361,7 +5367,7 @@ static bool CloseWindowButton(bool* p_opened)
}
if (p_opened != NULL && pressed)
- *p_opened = !*p_opened;
+ *p_opened = false;
return pressed;
}
@@ -5599,8 +5605,9 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
str_id = label;
if (label == NULL)
label = str_id;
+ const bool label_hide_text_after_double_hash = (label == str_id); // Only search and hide text after ## if we have passed label and ID separately, otherwise allow "##" within format string.
const ImGuiID id = window->GetID(str_id);
- const ImVec2 label_size = CalcTextSize(label, NULL, true);
+ const ImVec2 label_size = CalcTextSize(label, NULL, label_hide_text_after_double_hash);
// We vertically grow up to current line height up the typical widget height.
const float text_base_offset_y = ImMax(0.0f, window->DC.CurrentLineTextBaseOffset - padding.y); // Latch before ItemSize changes it
@@ -5663,7 +5670,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
RenderCollapseTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), opened, 0.70f, false);
if (g.LogEnabled)
LogRenderedText(text_pos, ">");
- RenderText(text_pos, label);
+ RenderText(text_pos, label, NULL, label_hide_text_after_double_hash);
}
return opened;
@@ -5963,7 +5970,7 @@ bool ImGui::InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label
char buf[32];
DataTypeFormatString(data_type, data_ptr, decimal_precision, buf, IM_ARRAYSIZE(buf));
- bool value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize() - g.Style.FramePadding*2.0f, ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll);
+ bool value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize(), ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll);
if (g.ScalarAsInputTextId == 0)
{
// First frame
@@ -6164,7 +6171,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
const float w = CalcItemWidth();
const ImVec2 label_size = CalcTextSize(label, NULL, true);
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f);
+ const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f));
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
// NB- we don't call ItemSize() yet because we may turn into a text edit box below
@@ -6255,7 +6262,6 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float
char value_buf[64];
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center);
-
if (label_size.x > 0.0f)
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
@@ -6462,7 +6468,7 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f
const float w = CalcItemWidth();
const ImVec2 label_size = CalcTextSize(label, NULL, true);
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f);
+ const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f));
const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
@@ -6667,9 +6673,9 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
ImGuiState& g = *GImGui;
const ImGuiStyle& style = g.Style;
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
if (graph_size.x == 0.0f)
- graph_size.x = CalcItemWidth() + (style.FramePadding.x * 2);
+ graph_size.x = CalcItemWidth();
if (graph_size.y == 0.0f)
graph_size.y = label_size.y + (style.FramePadding.y * 2);
@@ -6758,7 +6764,8 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
if (overlay_text)
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImGuiAlign_Center);
- RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);
+ if (label_size.x > 0.0f)
+ RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);
}
struct ImGuiPlotArrayGetterData
@@ -6809,15 +6816,16 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over
const ImGuiStyle& style = g.Style;
ImVec2 pos = window->DC.CursorPos;
- const ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth() + style.FramePadding.x*2.0f, g.FontSize + style.FramePadding.y*2.0f));
+ ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y*2.0f));
ItemSize(bb, style.FramePadding.y);
if (!ItemAdd(bb, NULL))
return;
// Render
fraction = ImSaturate(fraction);
- const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
+ bb.Reduce(ImVec2(window->BorderSize, window->BorderSize));
+ const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
RenderFrame(bb.Min, fill_br, GetColorU32(ImGuiCol_PlotHistogram), false, style.FrameRounding);
// Default displaying the fraction as percentage string, but user can override it
@@ -6875,7 +6883,8 @@ bool ImGui::Checkbox(const char* label, bool* v)
if (g.LogEnabled)
LogRenderedText(text_bb.GetTL(), *v ? "[x]" : "[ ]");
- RenderText(text_bb.GetTL(), label);
+ if (label_size.x > 0.0f)
+ RenderText(text_bb.GetTL(), label);
return pressed;
}
@@ -6942,7 +6951,8 @@ bool ImGui::RadioButton(const char* label, bool active)
if (g.LogEnabled)
LogRenderedText(text_bb.GetTL(), active ? "(x)" : "( )");
- RenderText(text_bb.GetTL(), label);
+ if (label_size.x > 0.0f)
+ RenderText(text_bb.GetTL(), label);
return pressed;
}
@@ -7218,9 +7228,9 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0;
const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
- ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), is_multiline ? ImGui::GetTextLineHeight() * 8.0f : label_size.y); // Arbitrary default of 8 lines high for multi-line
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size + style.FramePadding*2.0f);
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
+ ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? ImGui::GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y*2.0f); // Arbitrary default of 8 lines high for multi-line
+ const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f));
ImGuiWindow* draw_window = window;
@@ -7580,7 +7590,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
// Render
- const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x + style.FramePadding.x*2.0f, frame_bb.Min.y + size.y + style.FramePadding.y*2.0f);
+ const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x, frame_bb.Min.y + size.y); // Not using frame_bb.Max because we have adjusted size
ImVec2 render_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding;
ImVec2 text_size(0.f, 0.f);
if (g.ActiveId == id || (edit_state.Id == id && is_multiline && g.ActiveId == draw_window->GetID("#SCROLLY")))
@@ -7771,15 +7781,13 @@ bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data
ImGuiState& g = *GImGui;
const ImGuiStyle& style = g.Style;
- const float w = CalcItemWidth();
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f);
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
ImGui::BeginGroup();
ImGui::PushID(label);
- const ImVec2 button_sz = ImVec2(g.FontSize, g.FontSize) + style.FramePadding * 2;
+ const ImVec2 button_sz = ImVec2(g.FontSize, g.FontSize) + style.FramePadding*2.0f;
if (step_ptr)
- ImGui::PushItemWidth(ImMax(1.0f, w - (button_sz.x + style.ItemInnerSpacing.x)*2));
+ ImGui::PushItemWidth(ImMax(1.0f, CalcItemWidth() - (button_sz.x + style.ItemInnerSpacing.x)*2));
char buf[64];
DataTypeFormatString(data_type, data_ptr, scalar_format, buf, IM_ARRAYSIZE(buf));
@@ -7989,7 +7997,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
const float w = CalcItemWidth();
const ImVec2 label_size = CalcTextSize(label, NULL, true);
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f);
+ const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f));
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, &id))
@@ -8091,7 +8099,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
PopClipRect();
ImGuiID id = window->GetID(label);
- ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
+ ImVec2 label_size = CalcTextSize(label, NULL, true);
ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y);
ImVec2 pos = window->DC.CursorPos;
pos.y += window->DC.CurrentLineTextBaseOffset;
@@ -8175,10 +8183,10 @@ bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
const ImGuiStyle& style = ImGui::GetStyle();
const ImGuiID id = ImGui::GetID(label);
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
- ImVec2 size = CalcItemSize(size_arg, CalcItemWidth() + style.FramePadding.x * 2.0f, ImGui::GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y);
+ ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), ImGui::GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y);
ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y));
ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
@@ -8333,8 +8341,7 @@ bool ImGui::BeginMenuBar()
ImGui::BeginGroup(); // Save position
ImGui::PushID("##menubar");
ImRect rect = window->MenuBarRect();
- float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
- PushClipRect(ImVec2(rect.Min.x+0.5f, rect.Min.y-0.5f+border_size), ImVec2(rect.Max.x+0.5f, rect.Max.y-0.5f), false);
+ PushClipRect(ImVec2(rect.Min.x+0.5f, rect.Min.y-0.5f+window->BorderSize), ImVec2(rect.Max.x+0.5f, rect.Max.y-0.5f), false);
window->DC.CursorPos = ImVec2(rect.Min.x + window->DC.MenuBarOffsetX, rect.Min.y);// + g.Style.FramePadding.y);
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
window->DC.MenuBarAppending = true;
@@ -8527,7 +8534,6 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
edit_mode = g.ColorEditModeStorage.GetInt(id, 0) % 3;
float f[4] = { col[0], col[1], col[2], col[3] };
-
if (edit_mode == ImGuiColorEditMode_HSV)
ImGui::ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
@@ -8547,8 +8553,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
{
// RGB/HSV 0..255 Sliders
const float w_items_all = w_full - (square_sz + style.ItemInnerSpacing.x);
- const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)) / (float)components));
- const float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)));
+ const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.ItemInnerSpacing.x) * (components-1)) / (float)components));
+ const float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.ItemInnerSpacing.x) * (components-1)));
const bool hide_prefix = (w_item_one <= CalcTextSize("M:999").x);
const char* ids[4] = { "##X", "##Y", "##Z", "##W" };
@@ -8583,18 +8589,19 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
else
ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", i[0], i[1], i[2]);
ImGui::PushItemWidth(w_slider_all - style.ItemInnerSpacing.x);
- value_changed |= ImGui::InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase);
+ if (ImGui::InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase))
+ {
+ value_changed |= true;
+ char* p = buf;
+ while (*p == '#' || ImCharIsSpace(*p))
+ p++;
+ i[0] = i[1] = i[2] = i[3] = 0;
+ if (alpha)
+ sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned)
+ else
+ sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);
+ }
ImGui::PopItemWidth();
- char* p = buf;
- while (*p == '#' || ImCharIsSpace(*p))
- p++;
-
- // Treat at unsigned (%X is unsigned)
- i[0] = i[1] = i[2] = i[3] = 0;
- if (alpha)
- sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]);
- else
- sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);
}
break;
}
@@ -8615,15 +8622,15 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
const char* button_titles[3] = { "RGB", "HSV", "HEX" };
if (ButtonEx(button_titles[edit_mode], ImVec2(0,0), ImGuiButtonFlags_DontClosePopups))
g.ColorEditModeStorage.SetInt(id, (edit_mode + 1) % 3); // Don't set local copy of 'edit_mode' right away!
- ImGui::SameLine();
}
- else
+
+ const char* label_display_end = FindTextDisplayEnd(label);
+ if (label != label_display_end)
{
- ImGui::SameLine(0, style.ItemInnerSpacing.x);
+ ImGui::SameLine(0, (window->DC.ColorEditMode == ImGuiColorEditMode_UserSelectShowButton) ? -1.0f : style.ItemInnerSpacing.x);
+ ImGui::TextUnformatted(label, label_display_end);
}
- ImGui::TextUnformatted(label, FindTextDisplayEnd(label));
-
// Convert back
for (int n = 0; n < 4; n++)
f[n] = i[n] / 255.0f;
@@ -9283,7 +9290,6 @@ void ImGui::ShowMetricsWindow(bool* opened)
};
ImGuiState& g = *GImGui; // Access private state
- g.DisableHideTextAfterDoubleHash++; // Not exposed (yet). Disable processing that hides text after '##' markers.
Funcs::NodeWindows(g.Windows, "Windows");
if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.RenderDrawLists[0].Size))
{
@@ -9309,7 +9315,6 @@ void ImGui::ShowMetricsWindow(bool* opened)
ImGui::Text("ActiveID: 0x%08X/0x%08X", g.ActiveId, g.ActiveIdPreviousFrame);
ImGui::TreePop();
}
- g.DisableHideTextAfterDoubleHash--;
}
ImGui::End();
}
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h
index b7b0a0113a6..9e4a6c892ad 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h
@@ -18,17 +18,18 @@
#define IMGUI_VERSION "1.48 WIP"
+// Define attributes of all API symbols declarations, e.g. for DLL under Windows.
+#ifndef IMGUI_API
+#define IMGUI_API
+#endif
+
// Define assertion handler.
#ifndef IM_ASSERT
#include <assert.h>
#define IM_ASSERT(_EXPR, ...) assert(_EXPR)
#endif
-// Define attributes of all API symbols declarations, e.g. for DLL under Windows.
-#ifndef IMGUI_API
-#define IMGUI_API
-#endif
-
+// Some compilers support applying printf-style warnings to user functions.
#if defined(__clang__) || defined(__GNUC__)
#define IM_PRINTFARGS(FMT) __attribute__((format(printf, FMT, (FMT+1))))
#else
@@ -36,39 +37,50 @@
#endif
// Forward declarations
-struct ImDrawCmd;
-struct ImDrawList;
-struct ImDrawData;
-struct ImFont;
-struct ImFontAtlas;
-struct ImColor;
-struct ImGuiIO;
-struct ImGuiStorage;
-struct ImGuiStyle;
-
+struct ImDrawChannel; // Temporary storage for outputting drawing commands out of order, used by ImDrawList::ChannelsSplit()
+struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call)
+struct ImDrawData; // All draw command lists required to render the frame
+struct ImDrawList; // A single draw command list (generally one per window)
+struct ImDrawVert; // A single vertex (20 bytes by default, override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT)
+struct ImFont; // Runtime data for a single font within a parent ImFontAtlas
+struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF font loader
+struct ImFontConfig; // Configuration data when adding a font or merging fonts
+struct ImColor; // Helper functions to create a color that can be converted to either u32 or float4
+struct ImGuiIO; // Main configuration and I/O between your application and ImGui
+struct ImGuiOnceUponAFrame; // Simple helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro
+struct ImGuiStorage; // Simple custom key value storage
+struct ImGuiStyle; // Runtime data for styling/colors
+struct ImGuiTextFilter; // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
+struct ImGuiTextBuffer; // Text buffer for logging/accumulating text
+struct ImGuiTextEditCallbackData; // Shared state of ImGui::InputText() when using custom callbacks (advanced)
+struct ImGuiListClipper; // Helper to manually clip large list of items
+
+// Enumerations (declared as int for compatibility and to not pollute the top of this file)
typedef unsigned int ImU32;
typedef unsigned short ImWchar; // character for keyboard input/display
typedef void* ImTextureID; // user data to refer to a texture (e.g. store your texture handle/id)
typedef ImU32 ImGuiID; // unique ID used by widgets (typically hashed from a stack of string)
-typedef int ImGuiCol; // enum ImGuiCol_
-typedef int ImGuiStyleVar; // enum ImGuiStyleVar_
-typedef int ImGuiKey; // enum ImGuiKey_
-typedef int ImGuiAlign; // enum ImGuiAlign_
-typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_
-typedef int ImGuiMouseCursor; // enum ImGuiMouseCursor_
-typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_
-typedef int ImGuiSetCond; // enum ImGuiSetCond_
-typedef int ImGuiInputTextFlags; // enum ImGuiInputTextFlags_
-typedef int ImGuiSelectableFlags; // enum ImGuiSelectableFlags_
-struct ImGuiTextEditCallbackData; // for advanced uses of InputText()
+typedef int ImGuiCol; // a color identifier for styling // enum ImGuiCol_
+typedef int ImGuiStyleVar; // a variable identifier for styling // enum ImGuiStyleVar_
+typedef int ImGuiKey; // a key identifier (ImGui-side enum) // enum ImGuiKey_
+typedef int ImGuiAlign; // alignment // enum ImGuiAlign_
+typedef int ImGuiColorEditMode; // color edit mode for ColorEdit*() // enum ImGuiColorEditMode_
+typedef int ImGuiMouseCursor; // a mouse cursor identifier // enum ImGuiMouseCursor_
+typedef int ImGuiWindowFlags; // window flags for Begin*() // enum ImGuiWindowFlags_
+typedef int ImGuiSetCond; // condition flags for Set*() // enum ImGuiSetCond_
+typedef int ImGuiInputTextFlags; // flags for InputText*() // enum ImGuiInputTextFlags_
+typedef int ImGuiSelectableFlags; // flags for Selectable() // enum ImGuiSelectableFlags_
typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data);
+// Others helpers at bottom of the file:
+// class ImVector<> // Lightweight std::vector like class.
+// IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times)
+
struct ImVec2
{
float x, y;
ImVec2() { x = y = 0.0f; }
ImVec2(float _x, float _y) { x = _x; y = _y; }
-
#ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2.
IM_VEC2_CLASS_EXTRA
#endif
@@ -79,25 +91,11 @@ struct ImVec4
float x, y, z, w;
ImVec4() { x = y = z = w = 0.0f; }
ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; }
-
#ifdef IM_VEC4_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec4.
IM_VEC4_CLASS_EXTRA
#endif
};
-// Helpers at bottom of the file:
-// - class ImVector<> // Lightweight std::vector like class.
-// - IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times)
-// - struct ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
-// - struct ImGuiTextBuffer // Text buffer for logging/accumulating text
-// - struct ImGuiStorage // Custom key value storage (if you need to alter open/close states manually)
-// - struct ImGuiTextEditCallbackData // Shared state of ImGui::InputText() when using custom callbacks
-// - struct ImGuiListClipper // Helper to manually clip large list of items.
-// - struct ImColor // Helper functions to created packed 32-bit RGBA color values
-// - struct ImDrawList // Draw command list
-// - struct ImFontAtlas // Bake multiple fonts into a single texture, TTF font loader, bake glyphs into bitmap
-// - struct ImFont // Single font
-
// ImGui end-user API
// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)
namespace ImGui
@@ -376,6 +374,7 @@ namespace ImGui
IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item in screen space
IMGUI_API ImVec2 GetItemRectMax(); // "
IMGUI_API ImVec2 GetItemRectSize(); // "
+ IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.
IMGUI_API bool IsWindowHovered(); // is current window hovered and hoverable (not blocked by a popup) (differentiate child windows from each others)
IMGUI_API bool IsWindowFocused(); // is current window focused
IMGUI_API bool IsRootWindowFocused(); // is current root window focused (top parent window in case of child windows)
@@ -453,17 +452,19 @@ enum ImGuiWindowFlags_
ImGuiWindowFlags_NoTitleBar = 1 << 0, // Disable title-bar
ImGuiWindowFlags_NoResize = 1 << 1, // Disable user resizing with the lower-right grip
ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window
- ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbar (window can still scroll with mouse or programatically)
- ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user scrolling with mouse wheel
+ ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programatically)
+ ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel
ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it
ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame
ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs
ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar
- ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Enable horizontal scrollbar (off by default). You need to use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section.
+ ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You need to use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section.
ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state
ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus)
+ ImGuiWindowFlags_ForceVerticalScrollbar = 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y)
+ ImGuiWindowFlags_ForceHorizontalScrollbar=1 << 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x)
// [Internal]
ImGuiWindowFlags_ChildWindow = 1 << 20, // Don't use! For internal use by BeginChild()
ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 21, // Don't use! For internal use by BeginChild()
@@ -837,7 +838,7 @@ public:
inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; }
};
-// Helper: execute a block of code once a frame only
+// Helper: execute a block of code at maximum once a frame
// Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
// Usage:
// IMGUI_ONCE_UPON_A_FRAME
@@ -919,30 +920,30 @@ struct ImGuiStorage
Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; }
Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; }
};
- ImVector<Pair> Data;
+ ImVector<Pair> Data;
// - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N)
// - Set***() functions find pair, insertion on demand if missing.
// - Sorted insertion is costly but should amortize. A typical frame shouldn't need to insert any new pair.
- IMGUI_API void Clear();
- IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const;
- IMGUI_API void SetInt(ImGuiID key, int val);
- IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const;
- IMGUI_API void SetFloat(ImGuiID key, float val);
- IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL
- IMGUI_API void SetVoidPtr(ImGuiID key, void* val);
+ IMGUI_API void Clear();
+ IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const;
+ IMGUI_API void SetInt(ImGuiID key, int val);
+ IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const;
+ IMGUI_API void SetFloat(ImGuiID key, float val);
+ IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL
+ IMGUI_API void SetVoidPtr(ImGuiID key, void* val);
// - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.
// - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.
// - A typical use case where this is convenient:
// float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar;
// - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application.
- IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);
- IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0);
- IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL);
+ IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);
+ IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0);
+ IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL);
// Use on your own storage if you know only integer are being stored (open/close all tree nodes)
- IMGUI_API void SetAllInt(int val);
+ IMGUI_API void SetAllInt(int val);
};
// Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used.
@@ -1028,15 +1029,20 @@ struct ImGuiListClipper
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
//-----------------------------------------------------------------------------
+// Helpers macros to generate 32-bits encoded colors
+#define IM_COL32(R,G,B,A) (((ImU32)(A)<<24) | ((ImU32)(B)<<16) | ((ImU32)(G)<<8) | ((ImU32)(R)))
+#define IM_COL32_WHITE (0xFFFFFFFF)
+#define IM_COL32_BLACK (0xFF000000)
+#define IM_COL32_BLACK_TRANS (0x00000000) // Transparent black
+
// Draw callbacks for advanced uses.
// NB- You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that)
-// Draw callback are useful for example if you want to render a complex 3D scene inside a UI element.
+// Draw callback may be useful for example, if you want to render a complex 3D scene inside a UI element, change your GPU render state, etc.
// The expected behavior from your rendering loop is:
// if (cmd.UserCallback != NULL)
// cmd.UserCallback(parent_list, cmd);
// else
// RenderTriangles()
-// It is up to you to decide if your rendering loop or the callback should be responsible for backup/restoring rendering state.
typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);
// Typically, 1 command = 1 gpu draw call (unless command is a callback)
@@ -1066,9 +1072,9 @@ struct ImDrawVert
ImU32 col;
};
#else
-// You can change the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h
+// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h
// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine.
-// The type has to be described by the #define (you can either declare the struct or use a typedef)
+// The type has to be described within the macro (you can either declare the struct or use a typedef)
IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
#endif
@@ -1086,7 +1092,6 @@ struct ImDrawChannel
// If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives.
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
// All positions are in screen coordinates (0,0=top-left, 1 pixel per unit). Primitives are always added to the list and not culled (culling is done at render time and at a higher-level by ImGui:: functions).
-// Note that this only gives you access to rendering polygons. If your intent is to create custom widgets and the publicly exposed functions/data aren't sufficient, you can add code in imgui_user.inl
struct ImDrawList
{
// This is what you have to render
@@ -1108,7 +1113,7 @@ struct ImDrawList
ImDrawList() { _OwnerName = NULL; Clear(); }
~ImDrawList() { ClearFreeMemory(); }
- IMGUI_API void PushClipRect(const ImVec4& clip_rect); // Scissoring. The values are x1, y1, x2, y2. Only apply to rendering. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
+ IMGUI_API void PushClipRect(const ImVec4& clip_rect); // Scissoring. Note that the values are (x1,y1,x2,y2) and NOT (x1,y1,w,h). This is passed down to your render function but not used for CPU-side clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
IMGUI_API void PushClipRectFullScreen();
IMGUI_API void PopClipRect();
IMGUI_API void PushTextureID(const ImTextureID& texture_id);
@@ -1156,8 +1161,9 @@ struct ImDrawList
IMGUI_API void Clear();
IMGUI_API void ClearFreeMemory();
IMGUI_API void PrimReserve(int idx_count, int vtx_count);
- IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col);
+ IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles)
IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col);
+ IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col);
inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); }
inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col){ _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp
index 5f734abb1e7..7c9653772d9 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp
@@ -223,8 +223,7 @@ void ImGui::ShowTestWindow(bool* p_opened)
if (ImGui::TreeNode("Fonts", "Fonts (%d)", ImGui::GetIO().Fonts->Fonts.Size))
{
- ImGui::SameLine();
- ShowHelpMarker("Tip: Load fonts with io.Fonts->AddFontFromFileTTF()\nbefore calling io.Fonts->GetTex* functions.");
+ ImGui::SameLine(); ShowHelpMarker("Tip: Load fonts with io.Fonts->AddFontFromFileTTF()\nbefore calling io.Fonts->GetTex* functions.");
ImFontAtlas* atlas = ImGui::GetIO().Fonts;
if (ImGui::TreeNode("Atlas texture", "Atlas texture (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight))
{
@@ -442,9 +441,9 @@ void ImGui::ShowTestWindow(bool* p_opened)
ImGui::Text("Password input");
static char bufpass[64] = "password123";
- ImGui::InputText("password", bufpass, 64, ImGuiInputTextFlags_Password);
+ ImGui::InputText("password", bufpass, 64, ImGuiInputTextFlags_Password | ImGuiInputTextFlags_CharsNoBlank);
ImGui::SameLine(); ShowHelpMarker("Display all characters as '*'.\nDisable clipboard cut and copy.\nDisable logging.\n");
- ImGui::InputText("password (clear)", bufpass, 64);
+ ImGui::InputText("password (clear)", bufpass, 64, ImGuiInputTextFlags_CharsNoBlank);
ImGui::TreePop();
}
@@ -812,26 +811,36 @@ void ImGui::ShowTestWindow(bool* p_opened)
if (ImGui::TreeNode("Widgets Width"))
{
static float f = 0.0f;
- ImGui::Text("PushItemWidth(100)");
+ ImGui::Text("PushItemWidth(100)");
+ ImGui::SameLine(); ShowHelpMarker("Fixed width.");
ImGui::PushItemWidth(100);
ImGui::DragFloat("float##1", &f);
ImGui::PopItemWidth();
- ImGui::Text("PushItemWidth(GetWindowWidth() * 0.5f);");
+ ImGui::Text("PushItemWidth(GetWindowWidth() * 0.5f)");
+ ImGui::SameLine(); ShowHelpMarker("Half of window width.");
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
ImGui::DragFloat("float##2", &f);
ImGui::PopItemWidth();
- ImGui::Text("PushItemWidth(GetContentRegionAvailWidth() * 0.5f);");
+ ImGui::Text("PushItemWidth(GetContentRegionAvailWidth() * 0.5f)");
+ ImGui::SameLine(); ShowHelpMarker("Half of available width.\n(~ right-cursor_pos)\n(works within a column set)");
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() * 0.5f);
ImGui::DragFloat("float##3", &f);
ImGui::PopItemWidth();
- ImGui::Text("PushItemWidth(-100);");
+ ImGui::Text("PushItemWidth(-100)");
+ ImGui::SameLine(); ShowHelpMarker("Align to right edge minus 100");
ImGui::PushItemWidth(-100);
ImGui::DragFloat("float##4", &f);
ImGui::PopItemWidth();
+ ImGui::Text("PushItemWidth(-1)");
+ ImGui::SameLine(); ShowHelpMarker("Align to right edge");
+ ImGui::PushItemWidth(-1);
+ ImGui::DragFloat("float##5", &f);
+ ImGui::PopItemWidth();
+
ImGui::TreePop();
}
@@ -1885,6 +1894,11 @@ struct ExampleAppConsole
free(History[i]);
}
+ // Portable helpers
+ static int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; }
+ static int Strnicmp(const char* str1, const char* str2, int n) { int d = 0; while (n > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; n--; } return d; }
+ static char* Strdup(const char *str) { size_t len = strlen(str) + 1; void* buff = ImGui::MemAlloc(len); return (char*)memcpy(buff, (const void*)str, len); }
+
void ClearLog()
{
for (int i = 0; i < Items.Size; i++)
@@ -1901,7 +1915,7 @@ struct ExampleAppConsole
vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
buf[IM_ARRAYSIZE(buf)-1] = 0;
va_end(args);
- Items.push_back(strdup(buf));
+ Items.push_back(Strdup(buf));
ScrollToBottom = true;
}
@@ -1978,9 +1992,6 @@ struct ExampleAppConsole
ImGui::End();
}
- static int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; }
- static int Strnicmp(const char* str1, const char* str2, int count) { int d = 0; while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; } return d; }
-
void ExecCommand(const char* command_line)
{
AddLog("# %s\n", command_line);
@@ -1994,7 +2005,7 @@ struct ExampleAppConsole
History.erase(History.begin() + i);
break;
}
- History.push_back(strdup(command_line));
+ History.push_back(Strdup(command_line));
// Process command
if (Stricmp(command_line, "CLEAR") == 0)
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp
index b5d25eaa0be..256bbfdd751 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp
@@ -14,10 +14,10 @@
#include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS
+#define IMGUI_DEFINE_PLACEMENT_NEW
#include "imgui_internal.h"
#include <stdio.h> // vsnprintf, sscanf, printf
-#include <new> // new (ptr)
#if !defined(alloca) && !defined(__FreeBSD__)
#ifdef _WIN32
#include <malloc.h> // alloca
@@ -37,7 +37,7 @@
#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
-#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
+//#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
#endif
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
@@ -267,7 +267,7 @@ void ImDrawList::ChannelsSplit(int channels_count)
{
if (i >= old_channels_count)
{
- new(&_Channels[i]) ImDrawChannel();
+ IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel();
}
else
{
@@ -346,13 +346,13 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count)
_IdxWritePtr = IdxBuffer.Data + idx_buffer_size;
}
+// Fully unrolled with inline call to keep our debug builds decently fast.
void ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col)
{
- const ImVec2 uv = GImGui->FontTexUvWhitePixel;
- const ImVec2 b(c.x, a.y);
- const ImVec2 d(a.x, c.y);
- _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx+1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx+2);
- _IdxWritePtr[3] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[4] = (ImDrawIdx)(_VtxCurrentIdx+2); _IdxWritePtr[5] = (ImDrawIdx)(_VtxCurrentIdx+3);
+ ImVec2 b(c.x, a.y), d(a.x, c.y), uv(GImGui->FontTexUvWhitePixel);
+ ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;
+ _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);
+ _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);
_VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;
_VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col;
_VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col;
@@ -364,12 +364,24 @@ void ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col)
void ImDrawList::PrimRectUV(const ImVec2& a, const ImVec2& c, const ImVec2& uv_a, const ImVec2& uv_c, ImU32 col)
{
- const ImVec2 b(c.x, a.y);
- const ImVec2 d(a.x, c.y);
- const ImVec2 uv_b(uv_c.x, uv_a.y);
- const ImVec2 uv_d(uv_a.x, uv_c.y);
- _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx+1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx+2);
- _IdxWritePtr[3] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[4] = (ImDrawIdx)(_VtxCurrentIdx+2); _IdxWritePtr[5] = (ImDrawIdx)(_VtxCurrentIdx+3);
+ ImVec2 b(c.x, a.y), d(a.x, c.y), uv_b(uv_c.x, uv_a.y), uv_d(uv_a.x, uv_c.y);
+ ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;
+ _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);
+ _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);
+ _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col;
+ _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col;
+ _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col;
+ _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col;
+ _VtxWritePtr += 4;
+ _VtxCurrentIdx += 4;
+ _IdxWritePtr += 6;
+}
+
+void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col)
+{
+ ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;
+ _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);
+ _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);
_VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col;
_VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col;
_VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col;
@@ -893,7 +905,7 @@ void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos,
CmdBuffer.back().ElemCount -= idx_unused;
_VtxWritePtr -= vtx_unused;
_IdxWritePtr -= idx_unused;
- _VtxCurrentIdx = (ImDrawIdx)VtxBuffer.Size;
+ _VtxCurrentIdx = (unsigned int)VtxBuffer.Size;
}
// This is one of the few function breaking the encapsulation of ImDrawLst, but it is just so useful.
@@ -1087,7 +1099,7 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)
if (!font_cfg->MergeMode)
{
ImFont* font = (ImFont*)ImGui::MemAlloc(sizeof(ImFont));
- new (font) ImFont();
+ IM_PLACEMENT_NEW(font) ImFont();
Fonts.push_back(font);
}
@@ -1235,8 +1247,9 @@ bool ImFontAtlas::Build()
}
}
- // Start packing
- TexWidth = (TexDesiredWidth > 0) ? TexDesiredWidth : (total_glyph_count > 2000) ? 2048 : (total_glyph_count > 1000) ? 1024 : 512; // Width doesn't actually matters much but some API/GPU have texture size limitations, and increasing width can decrease height.
+ // Start packing. We need a known width for the skyline algorithm. Using a cheap heuristic here to decide of width. User can override TexDesiredWidth if they wish.
+ // After packing is done, width shouldn't matter much, but some API/GPU have texture size limitations and increasing width can decrease height.
+ TexWidth = (TexDesiredWidth > 0) ? TexDesiredWidth : (total_glyph_count > 4000) ? 4096 : (total_glyph_count > 2000) ? 2048 : (total_glyph_count > 1000) ? 1024 : 512;
TexHeight = 0;
const int max_tex_height = 1024*32;
stbtt_pack_context spc;
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h
index 3c028c38cb8..54c777e0dfa 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h
@@ -137,6 +137,15 @@ static inline float ImLengthSqr(const ImVec4& lhs)
static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; }
static inline ImVec2 ImRound(ImVec2 v) { return ImVec2((float)(int)v.x, (float)(int)v.y); }
+// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
+// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
+#ifdef IMGUI_DEFINE_PLACEMENT_NEW
+struct ImPlacementNewDummy {};
+inline void* operator new(size_t, ImPlacementNewDummy, void* ptr) { return ptr; }
+inline void operator delete(void*, ImPlacementNewDummy, void*) {}
+#define IM_PLACEMENT_NEW(_PTR) new(ImPlacementNewDummy() ,_PTR)
+#endif
+
//-----------------------------------------------------------------------------
// Types
//-----------------------------------------------------------------------------
@@ -371,7 +380,6 @@ struct ImGuiState
ImGuiWindow* MovedWindow; // Track the child window we clicked on to move a window. Pointer is only valid if ActiveID is the "#MOVE" identifier of a window.
ImVector<ImGuiIniData> Settings; // .ini Settings
float SettingsDirtyTimer; // Save .ini settinngs on disk when time reaches zero
- int DisableHideTextAfterDoubleHash;
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont()
@@ -455,7 +463,6 @@ struct ImGuiState
ActiveIdWindow = NULL;
MovedWindow = NULL;
SettingsDirtyTimer = 0.0f;
- DisableHideTextAfterDoubleHash = 0;
SetNextWindowPosVal = ImVec2(0.0f, 0.0f);
SetNextWindowSizeVal = ImVec2(0.0f, 0.0f);
@@ -600,7 +607,8 @@ struct IMGUI_API ImGuiWindow
ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
bool ScrollbarX, ScrollbarY;
- ImVec2 ScrollbarSizes; //
+ ImVec2 ScrollbarSizes;
+ float BorderSize;
bool Active; // Set to true on Begin()
bool WasActive;
bool Accessed; // Set to true when any widget access the current window
@@ -684,7 +692,6 @@ namespace ImGui
IMGUI_API void FocusableItemUnregister(ImGuiWindow* window);
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y);
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
- IMGUI_API void SetItemAllowOverlap(); // Allow last item to be overlapped by a subsequent item
IMGUI_API void OpenPopupEx(const char* str_id, bool reopen_existing);
diff --git a/3rdparty/bgfx/3rdparty/pvrtc/BitScale.h b/3rdparty/bgfx/3rdparty/pvrtc/BitScale.h
index a9e5cec32e6..b600fe9350e 100644
--- a/3rdparty/bgfx/3rdparty/pvrtc/BitScale.h
+++ b/3rdparty/bgfx/3rdparty/pvrtc/BitScale.h
@@ -2,7 +2,7 @@
#pragma once
-#include <cstdint>
+#include <stdint.h>
//============================================================================
diff --git a/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c b/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c
index d8af75bb010..6b3a35695f2 100644
--- a/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c
+++ b/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c
@@ -5506,7 +5506,8 @@ static void* rmtglGetProcAddress(OpenGL* opengl, const char* symbol)
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
- return NSGLGetProcAddress((const GLubyte*)symbol);
+ extern void* nsglGetProcAddress(const GLubyte* _name);
+ return nsglGetProcAddress((const GLubyte*)symbol);
#elif defined(RMT_PLATFORM_LINUX)
diff --git a/3rdparty/bgfx/3rdparty/stb/stb_image.c b/3rdparty/bgfx/3rdparty/stb/stb_image.c
index bc305501477..130d6c01d61 100644
--- a/3rdparty/bgfx/3rdparty/stb/stb_image.c
+++ b/3rdparty/bgfx/3rdparty/stb/stb_image.c
@@ -1,5 +1,6 @@
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wshadow"
+# pragma GCC diagnostic ignored "-Warray-bounds"
#elif defined(_MSC_VER)
# pragma warning(disable:4312) // warning C4312: 'type cast': conversion from '' to '' of greater size
# pragma warning(disable:4456) // warning C4456: declaration of 'k' hides previous local declaration
diff --git a/3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h b/3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h
index d6ed38b7254..90cd29584cc 100644
--- a/3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h
+++ b/3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h
@@ -1306,8 +1306,17 @@ typedef struct {
m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2];
} tinfl_huff_table;
-#if MINIZ_HAS_64BIT_REGISTERS
-#define TINFL_USE_64BIT_BITBUF 1
+
+#ifndef MINIZ_HAS_64BIT_REGISTERS
+# define MINIZ_HAS_64BIT_REGISTERS 0
+#endif
+
+#ifndef TINFL_USE_64BIT_BITBUF
+# if MINIZ_HAS_64BIT_REGISTERS
+# define TINFL_USE_64BIT_BITBUF 1
+# else
+# define TINFL_USE_64BIT_BITBUF 0
+# endif
#endif
#if TINFL_USE_64BIT_BITBUF
@@ -4318,7 +4327,7 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h,
#include <stdio.h>
#include <sys/stat.h>
-#if defined(_MSC_VER) || defined(__MINGW64__)
+#if defined(_MSC_VER) //|| defined(__MINGW64__)
static FILE *mz_fopen(const char *pFilename, const char *pMode) {
FILE *pFile = NULL;
fopen_s(&pFile, pFilename, pMode);
diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md
index 0548f2d68ca..521853b6f2b 100644
--- a/3rdparty/bgfx/README.md
+++ b/3rdparty/bgfx/README.md
@@ -1,6 +1,9 @@
[bgfx](https://github.com/bkaradzic/bgfx) - Cross-platform rendering library
============================================================================
+[![Build Status](https://travis-ci.org/bkaradzic/bgfx.svg?branch=master)](https://travis-ci.org/bkaradzic/bgfx)
+[![Build status](https://ci.appveyor.com/api/projects/status/ipa3ojgeaet1oko5?svg=true)](https://ci.appveyor.com/project/bkaradzic/bgfx)
+
[What is it?](https://bkaradzic.github.io/bgfx/overview.html)
-------------------------------------------------------------
@@ -29,12 +32,13 @@ Supported platforms:
* asm.js/Emscripten (1.25.0)
* FreeBSD
* iOS (iPhone, iPad, AppleTV)
- * Linux ![](https://tc27.draster.com/app/rest/builds/buildType:(id:Bgfx_Linux)/statusIcon)
+ * Linux
* MIPS Creator CI20
* Native Client (PPAPI 37+, ARM, x86, x64, PNaCl)
* OSX (10.9+)
* RaspberryPi
- * Windows (XP, Vista, 7, 8, 10) ![](https://tc27.draster.com/app/rest/builds/buildType:(id:Bgfx_Windows)/statusIcon)
+ * SteamLink
+ * Windows (XP, Vista, 7, 8, 10)
* WinRT (WinPhone 8.0+)
Supported compilers:
@@ -51,11 +55,13 @@ Languages:
* [Go language API bindings](https://github.com/james4k/go-bgfx)
* [Java language API bindings](https://github.com/enleeten/twilight-bgfx)
* [Haskell language API bindings](https://github.com/haskell-game/bgfx)
+ * [Rust language API bindings](https://github.com/rhoot/bgfx-rs)
-Build status
-------------
+Build
+-----
-https://tc27.draster.com/guestAuth/overview.html
+ - AppVeyor https://ci.appveyor.com/project/bkaradzic/bgfx
+ - TravisCI https://travis-ci.org/bkaradzic/bgfx
Who is using it?
----------------
@@ -94,7 +100,7 @@ deployment model of web with the performance of native code and GPU acceleration
https://github.com/nem0/LumixEngine LumixEngine is a MIT licensed 3D engine.
The main goal is performance and Unity-like usability.
-![LumixEngine screenshot](https://cloud.githubusercontent.com/assets/153526/10109455/450c51be-63c7-11e5-9c87-96d9d00efe02.png)
+![LumixEngine screenshot](https://cloud.githubusercontent.com/assets/153526/12904252/3fcf130e-cece-11e5-878b-c9fe24c1b11a.png)
https://github.com/podgorskiy/KeplerOrbits KeplerOrbits - Tool that calculates
positions of celestial bodies using their orbital elements. [Web Demo](http://podgorskiy.com/KeplerOrbits/KeplerOrbits.html)
@@ -107,6 +113,11 @@ https://github.com/jpcy/ioq3-renderer-bgfx - A renderer for ioquake3 written in
C++ and using bgfx to support multiple rendering APIs.
![ioq3-renderer-bgfx screenshot](https://camo.githubusercontent.com/052aa40c05120e56306294d3a1bb5f99f97de8c8/687474703a2f2f692e696d6775722e636f6d2f64364f6856594b2e6a7067)
+http://makingartstudios.itch.io/dls - DLS the digital logic simulator game.
+![dls-screenshot](https://img.itch.io/aW1hZ2UvMzk3MTgvMTc5MjQ4LnBuZw==/original/kA%2FQPb.png)
+
+https://github.com/mamedev/mame MAME - Multiple Arcade Machine Emulator
+
[Building](https://bkaradzic.github.io/bgfx/build.html)
-------------------------------------------------------
diff --git a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h
index f26ec2830b7..694e76a6b0d 100644
--- a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h
+++ b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h
@@ -26,35 +26,36 @@ static const uint8_t fs_metaballs_glsl[398] =
0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // gl_FragColor =
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tmpvar_2;.}...
};
-static const uint8_t fs_metaballs_dx9[429] =
+static const uint8_t fs_metaballs_dx9[433] =
{
- 0x46, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x03, 0xff, 0xff, // FSH..,.?........
- 0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
+ 0x46, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0xa4, 0x01, 0x00, 0x03, 0xff, 0xff, // FSH..,.?........
+ 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................
0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
- 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
- 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, // 29.952.3111.Q...
- 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0xf0, 0x41, 0xcd, 0xcc, 0x0c, 0x40, 0x2f, 0xba, 0xe8, 0x3e, // .......A...@/..>
- 0x00, 0x00, 0x80, 0x3f, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0x90, // ...?............
- 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x07, 0x90, 0x08, 0x00, 0x00, 0x03, // ................
- 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0xe4, 0x90, 0x07, 0x00, 0x00, 0x02, // ................
- 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, // ................
- 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xaa, 0x90, 0x20, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, // ........ .......
- 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0xa0, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, // ................
- 0x00, 0x00, 0x00, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x90, // ..............U.
- 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x90, 0x05, 0x00, 0x00, 0x03, // ................
- 0x00, 0x00, 0x0e, 0x80, 0x02, 0x00, 0x90, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x0e, 0x00, 0x00, 0x02, // ..........U.....
- 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, // ......U.........
- 0x00, 0x00, 0xaa, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x00, 0x00, 0xff, 0x80, // ................
- 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0x00, 0x81, // ................
- 0x01, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................
- 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0f, 0x00, 0x00, 0x02, // ..........U.....
- 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, // ................
- 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x01, 0x80, // ................
- 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, // ..............U.
- 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x01, 0x00, 0x00, 0x02, // ................
- 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0xff, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .............
+ 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10
+ 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384..
+ 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0xf0, 0x41, 0xcd, 0xcc, 0x0c, 0x40, // Q..........A...@
+ 0x2f, 0xba, 0xe8, 0x3e, 0x00, 0x00, 0x80, 0x3f, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, // /..>...?........
+ 0x00, 0x00, 0x07, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x07, 0x90, // ................
+ 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0xe4, 0x90, // ................
+ 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, // ................
+ 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xaa, 0x90, 0x20, 0x00, 0x00, 0x03, // ............ ...
+ 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0xa0, 0x0f, 0x00, 0x00, 0x02, // ................
+ 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, // ................
+ 0x00, 0x00, 0x55, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x90, // ..U.............
+ 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0e, 0x80, 0x02, 0x00, 0x90, 0x80, 0x00, 0x00, 0x55, 0xa0, // ..............U.
+ 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, // ..........U.....
+ 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, // ................
+ 0x00, 0x00, 0xff, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, // ................
+ 0x00, 0x00, 0x00, 0x81, 0x01, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, // ................
+ 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, // ..............U.
+ 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, // ................
+ 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x0e, 0x00, 0x00, 0x02, // ................
+ 0x00, 0x08, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x02, 0x80, // ................
+ 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, // ..U.............
+ 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0xff, 0xa0, 0xff, 0xff, 0x00, 0x00, // ................
+ 0x00, // .
};
static const uint8_t fs_metaballs_dx11[660] =
{
diff --git a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h
index 70f3e56b654..1e35cc2394e 100644
--- a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h
+++ b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h
@@ -35,12 +35,12 @@ static const uint8_t vs_metaballs_glsl[537] =
0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // v_color0 = a_col
0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}...
};
-static const uint8_t vs_metaballs_dx9[457] =
+static const uint8_t vs_metaballs_dx9[461] =
{
0x56, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x02, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..,.?...u_mod
0x65, 0x6c, 0x04, 0x20, 0x04, 0x00, 0x03, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // el. .....u_model
- 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x98, 0x01, // ViewProj........
- 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x2e, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, // ........CTAB....
+ 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x9c, 0x01, // ViewProj........
+ 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x2f, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, // ....../.CTAB....
0x83, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, // ................
0x00, 0x91, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, // ....|...D.......
0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, // ....L...........
@@ -51,21 +51,21 @@ static const uint8_t vs_metaballs_dx9[457] =
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, // ........vs_3_0.M
0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, // icrosoft (R) HLS
0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, // L Shader Compile
- 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, // r 9.29.952.3111.
- 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................
- 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................
- 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, // ................
- 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, // ................
- 0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ................
- 0x01, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, // ......U.........
- 0x00, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, // ................
- 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, // ................
- 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, // ................
- 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x05, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, // ..............U.
- 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, // ................
- 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0xe0, 0x06, 0x00, 0xe4, 0xa0, // ................
- 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, // ................
- 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .........
+ 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, // r 10.0.10011.163
+ 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // 84..............
+ 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................
+ 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................
+ 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, // ................
+ 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, // ................
+ 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, // ..........U.....
+ 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, // ................
+ 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, // ................
+ 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, // ................
+ 0x03, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x05, 0x00, 0xe4, 0xa0, // ................
+ 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x04, 0x00, 0xe4, 0xa0, // ..U.............
+ 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0xe0, // ................
+ 0x06, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, // ................
+ 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .............
};
static const uint8_t vs_metaballs_dx11[726] =
{
diff --git a/3rdparty/bgfx/examples/08-update/update.cpp b/3rdparty/bgfx/examples/08-update/update.cpp
index 65045d383fd..8a5d851ba7c 100644
--- a/3rdparty/bgfx/examples/08-update/update.cpp
+++ b/3rdparty/bgfx/examples/08-update/update.cpp
@@ -240,7 +240,7 @@ public:
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
- m_m_texture2dData = (uint8_t*)malloc(m_texture2dSize*m_texture2dSize*4);
+ m_texture2dData = (uint8_t*)malloc(m_texture2dSize*m_texture2dSize*4);
m_rr = rand()%255;
m_gg = rand()%255;
@@ -255,13 +255,13 @@ public:
virtual int shutdown() BX_OVERRIDE
{
- // m_m_texture2dData is managed from main thread, and it's passed to renderer
+ // m_texture2dData is managed from main thread, and it's passed to renderer
// just as MemoryRef. At this point render might be using it. We must wait
// previous frame to finish before we can free it.
bgfx::frame();
// Cleanup.
- free(m_m_texture2dData);
+ free(m_texture2dData);
for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii)
{
@@ -380,7 +380,7 @@ public:
const uint16_t tx = rand()%(m_texture2dSize-tw);
const uint16_t ty = rand()%(m_texture2dSize-th);
- uint8_t* dst = &m_m_texture2dData[(ty*m_texture2dSize+tx)*4];
+ uint8_t* dst = &m_texture2dData[(ty*m_texture2dSize+tx)*4];
uint8_t* next = dst + pitch;
// Using makeRef to pass texture memory without copying.
@@ -537,7 +537,7 @@ public:
return false;
}
- uint8_t* m_m_texture2dData;
+ uint8_t* m_texture2dData;
uint32_t m_width;
uint32_t m_height;
diff --git a/3rdparty/bgfx/examples/09-hdr/hdr.cpp b/3rdparty/bgfx/examples/09-hdr/hdr.cpp
index 14f6edca81b..047fb0aa565 100644
--- a/3rdparty/bgfx/examples/09-hdr/hdr.cpp
+++ b/3rdparty/bgfx/examples/09-hdr/hdr.cpp
@@ -205,7 +205,7 @@ class HDR : public entry::AppI
m_mesh = meshLoad("meshes/bunny.bin");
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
- m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY);
+ m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
m_lum[0] = bgfx::createFrameBuffer(128, 128, bgfx::TextureFormat::BGRA8);
@@ -308,7 +308,7 @@ class HDR : public entry::AppI
bgfx::destroyFrameBuffer(m_fbh);
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT)|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
- m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
+ m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
}
diff --git a/3rdparty/bgfx/examples/10-font/font.cpp b/3rdparty/bgfx/examples/10-font/font.cpp
index 97111e1b175..a15cef4baae 100644
--- a/3rdparty/bgfx/examples/10-font/font.cpp
+++ b/3rdparty/bgfx/examples/10-font/font.cpp
@@ -14,6 +14,9 @@
#include "font/text_buffer_manager.h"
#include "entry/input.h"
+#include <iconfontheaders/icons_font_awesome.h>
+#include <iconfontheaders/icons_kenney.h>
+
#include <stdio.h>
#include <wchar.h>
@@ -105,10 +108,12 @@ int _main_(int _argc, char** _argv)
}
TrueTypeHandle fontAwesomeTtf = loadTtf(fontManager, "font/fontawesome-webfont.ttf");
+ TrueTypeHandle fontKenneyTtf = loadTtf(fontManager, "font/kenney-icon-font.ttf");
// This font doesn't have any preloaded glyph's but the truetype file
// is loaded so glyph will be generated as needed.
FontHandle fontAwesome72 = fontManager->createFontByPixelSize(fontAwesomeTtf, 0, 72);
+ FontHandle fontKenney64 = fontManager->createFontByPixelSize(fontKenneyTtf, 0, 64);
TrueTypeHandle visitorTtf = loadTtf(fontManager, "font/visitor1.ttf");
@@ -160,7 +165,24 @@ int _main_(int _argc, char** _argv)
textBufferManager->appendText(staticText, fonts[0], L"dog\n");
textBufferManager->setStyle(staticText, STYLE_NORMAL);
- textBufferManager->appendText(staticText, fontAwesome72, L"\xf011 \xf02e \xf061 \xf087 \xf0d9 \xf099 \xf05c \xf021 \xf113\n");
+ textBufferManager->appendText(staticText, fontAwesome72,
+ " " ICON_FA_POWER_OFF
+ " " ICON_FA_TWITTER_SQUARE
+ " " ICON_FA_CERTIFICATE
+ " " ICON_FA_FLOPPY_O
+ " " ICON_FA_GITHUB
+ " " ICON_FA_GITHUB_ALT
+ "\n"
+ );
+ textBufferManager->appendText(staticText, fontKenney64,
+ " " ICON_KI_COMPUTER
+ " " ICON_KI_JOYSTICK
+ " " ICON_KI_EXLAMATION
+ " " ICON_KI_STAR
+ " " ICON_KI_BUTTON_START
+ " " ICON_KI_DOWNLOAD
+ "\n"
+ );
// Create a transient buffer for real-time data.
TextBufferHandle transientText = textBufferManager->createTextBuffer(FONT_TYPE_ALPHA, BufferType::Transient);
@@ -242,10 +264,12 @@ int _main_(int _argc, char** _argv)
bgfx::frame();
}
+ fontManager->destroyTtf(fontKenneyTtf);
fontManager->destroyTtf(fontAwesomeTtf);
fontManager->destroyTtf(visitorTtf);
// Destroy the fonts.
+ fontManager->destroyFont(fontKenney64);
fontManager->destroyFont(fontAwesome72);
fontManager->destroyFont(visitor10);
for (uint32_t ii = 0; ii < numFonts; ++ii)
diff --git a/3rdparty/bgfx/examples/13-stencil/stencil.cpp b/3rdparty/bgfx/examples/13-stencil/stencil.cpp
index 94302bb2163..773bdda0b08 100644
--- a/3rdparty/bgfx/examples/13-stencil/stencil.cpp
+++ b/3rdparty/bgfx/examples/13-stencil/stencil.cpp
@@ -682,7 +682,7 @@ struct Mesh
#define BGFX_CHUNK_MAGIC_PRI BX_MAKEFOURCC('P', 'R', 'I', 0x0)
bx::CrtFileReader reader;
- reader.open(_filePath);
+ bx::open(&reader, _filePath);
Group group;
@@ -763,7 +763,7 @@ struct Mesh
}
}
- reader.close();
+ bx::close(&reader);
}
void unload()
diff --git a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp
index d39773c214f..4084359ba35 100644
--- a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp
+++ b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp
@@ -1030,7 +1030,7 @@ struct Mesh
#define BGFX_CHUNK_MAGIC_PRI BX_MAKEFOURCC('P', 'R', 'I', 0x0)
bx::CrtFileReader reader;
- reader.open(_filePath);
+ bx::open(&reader, _filePath);
Group group;
@@ -1114,7 +1114,7 @@ struct Mesh
}
}
- reader.close();
+ bx::close(&reader);
for (GroupArray::iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it)
{
@@ -1898,7 +1898,7 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT),
- bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY),
+ bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
};
s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
@@ -2092,7 +2092,7 @@ int _main_(int _argc, char** _argv)
bgfx::destroyFrameBuffer(s_stencilFb);
fbtextures[0] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT);
- fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY);
+ fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
diff --git a/3rdparty/bgfx/examples/15-shadowmaps-simple/fs_sms_shadow_pd.sc b/3rdparty/bgfx/examples/15-shadowmaps-simple/fs_sms_shadow_pd.sc
index 04d5896c81d..2a046f7317c 100644
--- a/3rdparty/bgfx/examples/15-shadowmaps-simple/fs_sms_shadow_pd.sc
+++ b/3rdparty/bgfx/examples/15-shadowmaps-simple/fs_sms_shadow_pd.sc
@@ -7,8 +7,12 @@ $input v_position
#include "../common/common.sh"
+uniform vec4 u_depthScaleOffset; // for GL, map depth values into [0, 1] range
+#define u_depthScale u_depthScaleOffset.x
+#define u_depthOffset u_depthScaleOffset.y
+
void main()
{
- float depth = v_position.z/v_position.w * 0.5 + 0.5;
+ float depth = v_position.z/v_position.w * u_depthScale + u_depthOffset;
gl_FragColor = packFloatToRgba(depth);
}
diff --git a/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp b/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp
index 07f692cff47..3ef2e057d0e 100644
--- a/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp
+++ b/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp
@@ -91,6 +91,13 @@ int _main_(int _argc, char** _argv)
bgfx::UniformHandle u_shadowMap = bgfx::createUniform("u_shadowMap", bgfx::UniformType::Int1);
bgfx::UniformHandle u_lightPos = bgfx::createUniform("u_lightPos", bgfx::UniformType::Vec4);
bgfx::UniformHandle u_lightMtx = bgfx::createUniform("u_lightMtx", bgfx::UniformType::Mat4);
+ // When using GL clip space depth range [-1, 1] and packing depth into color buffer, we need to
+ // adjust the depth range to be [0, 1] for writing to the color buffer
+ bgfx::UniformHandle u_depthScaleOffset = bgfx::createUniform("u_depthScaleOffset", bgfx::UniformType::Vec4);
+ const float depthScale = flipV ? 0.5f : 1.0f;
+ const float depthOffset = flipV ? 0.5f : 0.0f;
+ float depthScaleOffset[4] = {depthScale, depthOffset, 0.0f, 0.0f};
+ bgfx::setUniform(u_depthScaleOffset, depthScaleOffset);
// Vertex declarations.
bgfx::VertexDecl PosNormalDecl;
@@ -148,7 +155,7 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
shadowMapTexture,
- bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY),
+ bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
};
shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
@@ -274,7 +281,7 @@ int _main_(int _argc, char** _argv)
bx::mtxLookAt(lightView, eye, at);
const float area = 30.0f;
- bx::mtxOrtho(lightProj, -area, area, -area, area, -100.0f, 100.0f);
+ bx::mtxOrtho(lightProj, -area, area, -area, area, -100.0f, 100.0f, 0.0f, flipV);
bgfx::setViewRect(RENDER_SHADOW_PASS_ID, 0, 0, shadowMapSize, shadowMapSize);
bgfx::setViewFrameBuffer(RENDER_SHADOW_PASS_ID, shadowMapFB);
@@ -303,8 +310,8 @@ int _main_(int _argc, char** _argv)
{
0.5f, 0.0f, 0.0f, 0.0f,
0.0f, sy, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.5f, 0.0f,
- 0.5f, 0.5f, 0.5f, 1.0f,
+ 0.0f, 0.0f, depthScale, 0.0f,
+ 0.5f, 0.5f, depthOffset, 1.0f,
};
float mtxTmp[16];
diff --git a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp
index 7a840b45672..1e8ddaee339 100644
--- a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp
+++ b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp
@@ -891,7 +891,7 @@ struct Mesh
#define BGFX_CHUNK_MAGIC_PRI BX_MAKEFOURCC('P', 'R', 'I', 0x0)
bx::CrtFileReader reader;
- reader.open(_filePath);
+ bx::open(&reader, _filePath);
Group group;
@@ -971,7 +971,7 @@ struct Mesh
}
}
- reader.close();
+ bx::close(&reader);
}
void unload()
@@ -989,13 +989,13 @@ struct Mesh
m_groups.clear();
}
- void submit(uint8_t _viewId, float* _mtx, bgfx::ProgramHandle _program, const RenderState& _renderState)
+ void submit(uint8_t _viewId, float* _mtx, bgfx::ProgramHandle _program, const RenderState& _renderState, bool _submitShadowMaps = false)
{
bgfx::TextureHandle texture = BGFX_INVALID_HANDLE;
- submit(_viewId, _mtx, _program, _renderState, texture);
+ submit(_viewId, _mtx, _program, _renderState, texture, _submitShadowMaps);
}
- void submit(uint8_t _viewId, float* _mtx, bgfx::ProgramHandle _program, const RenderState& _renderState, bgfx::TextureHandle _texture)
+ void submit(uint8_t _viewId, float* _mtx, bgfx::ProgramHandle _program, const RenderState& _renderState, bgfx::TextureHandle _texture, bool _submitShadowMaps = false)
{
for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it)
{
@@ -1015,9 +1015,12 @@ struct Mesh
bgfx::setTexture(0, s_texColor, _texture);
}
- for (uint8_t ii = 0; ii < ShadowMapRenderTargets::Count; ++ii)
+ if (_submitShadowMaps)
{
- bgfx::setTexture(4 + ii, s_shadowMap[ii], s_rtShadowMap[ii]);
+ for (uint8_t ii = 0; ii < ShadowMapRenderTargets::Count; ++ii)
+ {
+ bgfx::setTexture(4 + ii, s_shadowMap[ii], s_rtShadowMap[ii]);
+ }
}
// Apply render state.
@@ -2977,6 +2980,7 @@ int _main_(int _argc, char** _argv)
, mtxFloor
, *currentSmSettings->m_progDraw
, s_renderStates[RenderState::Default]
+ , true
);
// Bunny.
@@ -2988,6 +2992,7 @@ int _main_(int _argc, char** _argv)
, mtxBunny
, *currentSmSettings->m_progDraw
, s_renderStates[RenderState::Default]
+ , true
);
// Hollow cube.
@@ -2999,6 +3004,7 @@ int _main_(int _argc, char** _argv)
, mtxHollowcube
, *currentSmSettings->m_progDraw
, s_renderStates[RenderState::Default]
+ , true
);
// Cube.
@@ -3010,6 +3016,7 @@ int _main_(int _argc, char** _argv)
, mtxCube
, *currentSmSettings->m_progDraw
, s_renderStates[RenderState::Default]
+ , true
);
// Trees.
@@ -3023,6 +3030,7 @@ int _main_(int _argc, char** _argv)
, mtxTrees[ii]
, *currentSmSettings->m_progDraw
, s_renderStates[RenderState::Default]
+ , true
);
}
diff --git a/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h b/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h
index cf32868ff42..684132a061e 100644
--- a/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h
+++ b/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h
@@ -7,17 +7,17 @@ static const uint8_t fs_drawstress_glsl[89] =
0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col
0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}...
};
-static const uint8_t fs_drawstress_dx9[137] =
+static const uint8_t fs_drawstress_dx9[141] =
{
- 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I..|.....
- 0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
+ 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I........
+ 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................
0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
- 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
- 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111.....
- 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................
- 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .........
+ 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10
+ 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384..
+ 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, // ................
+ 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .............
};
static const uint8_t fs_drawstress_dx11[260] =
{
diff --git a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h
index 27cb89d15c3..2a2fcef2ada 100644
--- a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h
+++ b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h
@@ -22,11 +22,11 @@ static const uint8_t vs_drawstress_glsl[325] =
0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // lor0 = a_color0;
0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}...
};
-static const uint8_t vs_drawstress_dx9[319] =
+static const uint8_t vs_drawstress_dx9[323] =
{
0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....I...u_mod
0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
- 0x1c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........#.CTAB..
+ 0x20, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // .......$.CTAB..
0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0.....
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_
@@ -34,16 +34,17 @@ static const uint8_t vs_drawstress_dx9[319] =
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs
0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft (
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C
- 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952
- 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111...........
- 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................
- 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................
- 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U...........
- 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................
- 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
- 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
- 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...............
+ 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100
+ 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........
+ 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
+ 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................
+ 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U.......
+ 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................
+ 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................
+ 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................
+ 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................
+ 0x00, 0x00, 0x00, // ...
};
static const uint8_t vs_drawstress_dx11[510] =
{
diff --git a/3rdparty/bgfx/examples/27-terrain/terrain.cpp b/3rdparty/bgfx/examples/27-terrain/terrain.cpp
index 32686a7746e..71ab88aa128 100644
--- a/3rdparty/bgfx/examples/27-terrain/terrain.cpp
+++ b/3rdparty/bgfx/examples/27-terrain/terrain.cpp
@@ -69,7 +69,7 @@ class Terrain : public entry::AppI
m_debug = BGFX_DEBUG_TEXT;
m_reset = BGFX_RESET_VSYNC;
- bgfx::init(bgfx::RendererType::Direct3D11, args.m_pciId);
+ bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(m_width, m_height, m_reset);
// Enable m_debug text.
@@ -313,11 +313,11 @@ class Terrain : public entry::AppI
// Raise/Lower and scale by brush power.
height += (bx::fclamp(brushAttn * m_brush.m_power, 0.0, m_brush.m_power) * m_brush.m_raise)
- ? 1.0
- : -1.0
+ ? 1.0f
+ : -1.0f
;
- m_terrain.m_heightMap[heightMapPos] = (uint8_t)bx::fclamp(height, 0.0, 255.0);
+ m_terrain.m_heightMap[heightMapPos] = (uint8_t)bx::fclamp(height, 0.0f, 255.0f);
m_terrain.m_dirty = true;
}
}
@@ -328,8 +328,8 @@ class Terrain : public entry::AppI
float ray_clip[4];
ray_clip[0] = ( (2.0f * m_mouseState.m_mx) / m_width - 1.0f) * -1.0f;
ray_clip[1] = ( (1.0f - (2.0f * m_mouseState.m_my) / m_height) ) * -1.0f;
- ray_clip[2] = -1.0;
- ray_clip[3] = 1.0;
+ ray_clip[2] = -1.0f;
+ ray_clip[3] = 1.0f;
float invProjMtx[16];
bx::mtxInverse(invProjMtx, m_projMtx);
@@ -436,13 +436,15 @@ class Terrain : public entry::AppI
imguiEndScrollArea();
imguiEndFrame();
- // Update camera.
- cameraUpdate(deltaTime, m_mouseState);
-
- bool leftMouseButtonDown = !!m_mouseState.m_buttons[entry::MouseButton::Left];
- if (leftMouseButtonDown)
+ if (!imguiMouseOverArea() )
{
- mousePickTerrain();
+ // Update camera.
+ cameraUpdate(deltaTime, m_mouseState);
+
+ if (!!m_mouseState.m_buttons[entry::MouseButton::Left])
+ {
+ mousePickTerrain();
+ }
}
// Update terrain.
diff --git a/3rdparty/bgfx/examples/common/aviwriter.h b/3rdparty/bgfx/examples/common/aviwriter.h
index 79acd7e4df9..dad992ab595 100644
--- a/3rdparty/bgfx/examples/common/aviwriter.h
+++ b/3rdparty/bgfx/examples/common/aviwriter.h
@@ -26,7 +26,7 @@ struct AviWriter
bool open(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _fps, bool _yflip)
{
- if (0 != m_writer->open(_filePath) )
+ if (!bx::open(m_writer, _filePath) )
{
return false;
}
@@ -36,7 +36,7 @@ struct AviWriter
m_numFrames = 0;
m_width = _width;
m_height = _height;
-
+
// Bgfx returns _yflip true for OpenGL since bottom left corner is 0, 0. In D3D top left corner
// is 0, 0. DIB expect OpenGL style coordinates, so this is inverted logic for AVI writer.
m_yflip = !_yflip;
@@ -163,7 +163,7 @@ struct AviWriter
m_writer->seek(m_lengthOffset, bx::Whence::Begin);
bx::write(m_writer, m_numFrames);
- m_writer->close();
+ bx::close(m_writer);
delete [] m_frame;
m_frame = NULL;
diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp
index cdec2abbdfc..9b03d3d70b9 100644
--- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp
+++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp
@@ -24,7 +24,7 @@ namespace stl = tinystl;
void* load(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _filePath, uint32_t* _size)
{
- if (0 == bx::open(_reader, _filePath) )
+ if (bx::open(_reader, _filePath) )
{
uint32_t size = (uint32_t)bx::getSize(_reader);
void* data = BX_ALLOC(_allocator, size);
@@ -45,6 +45,7 @@ void* load(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _fi
{
*_size = 0;
}
+
return NULL;
}
@@ -60,7 +61,7 @@ void unload(void* _ptr)
static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePath)
{
- if (0 == bx::open(_reader, _filePath) )
+ if (bx::open(_reader, _filePath) )
{
uint32_t size = (uint32_t)bx::getSize(_reader);
const bgfx::Memory* mem = bgfx::alloc(size+1);
@@ -76,7 +77,7 @@ static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePa
static void* loadMem(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _filePath, uint32_t* _size)
{
- if (0 == bx::open(_reader, _filePath) )
+ if (bx::open(_reader, _filePath) )
{
uint32_t size = (uint32_t)bx::getSize(_reader);
void* data = BX_ALLOC(_allocator, size);
@@ -408,7 +409,9 @@ struct Mesh
bx::AllocatorI* allocator = entry::getAllocator();
uint32_t chunk;
- while (4 == bx::read(_reader, chunk) )
+ bx::Error err;
+ while (4 == bx::read(_reader, chunk, &err)
+ && err.isOk() )
{
switch (chunk)
{
@@ -596,10 +599,14 @@ Mesh* meshLoad(bx::ReaderSeekerI* _reader)
Mesh* meshLoad(const char* _filePath)
{
bx::FileReaderI* reader = entry::getFileReader();
- bx::open(reader, _filePath);
- Mesh* mesh = meshLoad(reader);
- bx::close(reader);
- return mesh;
+ if (bx::open(reader, _filePath) )
+ {
+ Mesh* mesh = meshLoad(reader);
+ bx::close(reader);
+ return mesh;
+ }
+
+ return NULL;
}
void meshUnload(Mesh* _mesh)
diff --git a/3rdparty/bgfx/examples/common/bounds.cpp b/3rdparty/bgfx/examples/common/bounds.cpp
index d2228e7eb63..3937b550567 100644
--- a/3rdparty/bgfx/examples/common/bounds.cpp
+++ b/3rdparty/bgfx/examples/common/bounds.cpp
@@ -277,6 +277,102 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num
_sphere.m_radius = bx::fsqrt(maxDistSq);
}
+void buildFrustumPlanes(Plane* _result, const float* _viewProj)
+{
+ const float xw = _viewProj[ 3];
+ const float yw = _viewProj[ 7];
+ const float zw = _viewProj[11];
+ const float ww = _viewProj[15];
+
+ const float xz = _viewProj[ 2];
+ const float yz = _viewProj[ 6];
+ const float zz = _viewProj[10];
+ const float wz = _viewProj[14];
+
+ Plane& near = _result[0];
+ Plane& far = _result[1];
+ Plane& left = _result[2];
+ Plane& right = _result[3];
+ Plane& top = _result[4];
+ Plane& bottom = _result[5];
+
+ near.m_normal[0] = xw - xz;
+ near.m_normal[1] = yw - yz;
+ near.m_normal[2] = zw - zz;
+ near.m_dist = ww - wz;
+
+ far.m_normal[0] = xw + xz;
+ far.m_normal[1] = yw + yz;
+ far.m_normal[2] = zw + zz;
+ far.m_dist = ww + wz;
+
+ const float xx = _viewProj[ 0];
+ const float yx = _viewProj[ 4];
+ const float zx = _viewProj[ 8];
+ const float wx = _viewProj[12];
+
+ left.m_normal[0] = xw - xx;
+ left.m_normal[1] = yw - yx;
+ left.m_normal[2] = zw - zx;
+ left.m_dist = ww - wx;
+
+ right.m_normal[0] = xw + xx;
+ right.m_normal[1] = yw + yx;
+ right.m_normal[2] = zw + zx;
+ right.m_dist = ww + wx;
+
+ const float xy = _viewProj[ 1];
+ const float yy = _viewProj[ 5];
+ const float zy = _viewProj[ 9];
+ const float wy = _viewProj[13];
+
+ top.m_normal[0] = xw + xy;
+ top.m_normal[1] = yw + yy;
+ top.m_normal[2] = zw + zy;
+ top.m_dist = ww + wy;
+
+ bottom.m_normal[0] = xw - xy;
+ bottom.m_normal[1] = yw - yy;
+ bottom.m_normal[2] = zw - zy;
+ bottom.m_dist = ww - wy;
+
+ Plane* plane = _result;
+ for (uint32_t ii = 0; ii < 6; ++ii)
+ {
+ float invLen = 1.0f / bx::vec3Norm(plane->m_normal, plane->m_normal);
+ plane->m_dist *= invLen;
+ ++plane;
+ }
+}
+
+void intersectPlanes(float _result[3], const Plane& _pa, const Plane& _pb, const Plane& _pc)
+{
+ float axb[3];
+ bx::vec3Cross(axb, _pa.m_normal, _pb.m_normal);
+
+ float bxc[3];
+ bx::vec3Cross(bxc, _pb.m_normal, _pc.m_normal);
+
+ float cxa[3];
+ bx::vec3Cross(cxa, _pc.m_normal, _pa.m_normal);
+
+ float tmp0[3];
+ bx::vec3Mul(tmp0, bxc, _pa.m_dist);
+
+ float tmp1[3];
+ bx::vec3Mul(tmp1, cxa, _pb.m_dist);
+
+ float tmp2[3];
+ bx::vec3Mul(tmp2, axb, _pc.m_dist);
+
+ float tmp[3];
+ bx::vec3Add(tmp, tmp0, tmp1);
+ bx::vec3Add(tmp0, tmp, tmp2);
+
+ float denom = bx::vec3Dot(_pa.m_normal, bxc);
+ bx::vec3Mul(_result, tmp0, -1.0f/denom);
+}
+
Ray makeRay(float _x, float _y, const float* _invVp)
{
Ray ray;
diff --git a/3rdparty/bgfx/examples/common/bounds.h b/3rdparty/bgfx/examples/common/bounds.h
index f59c2b2230f..24f23414f10 100644
--- a/3rdparty/bgfx/examples/common/bounds.h
+++ b/3rdparty/bgfx/examples/common/bounds.h
@@ -94,6 +94,12 @@ void calcMaxBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num
/// Calculate minimum bounding sphere.
void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _numVertices, uint32_t _stride, float _step = 0.01f);
+/// Returns 6 (near, far, left, right, top, bottom) planes representing frustum planes.
+void buildFrustumPlanes(Plane* _planes, const float* _viewProj);
+
+/// Returns point from 3 intersecting planes.
+void intersectPlanes(float _result[3], const Plane& _pa, const Plane& _pb, const Plane& _pc);
+
/// Make screen space ray from x, y coordinate and inverse view-projection matrix.
Ray makeRay(float _x, float _y, const float* _invVp);
diff --git a/3rdparty/bgfx/examples/common/entry/entry_ios.mm b/3rdparty/bgfx/examples/common/entry/entry_ios.mm
index e12c224e623..052c161abd4 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_ios.mm
+++ b/3rdparty/bgfx/examples/common/entry/entry_ios.mm
@@ -185,7 +185,7 @@ static void* m_device = NULL;
}
}
#endif
-
+
return [CAEAGLLayer class];
}
@@ -197,15 +197,15 @@ static void* m_device = NULL;
{
return nil;
}
-
+
bgfx::PlatformData pd;
pd.ndt = NULL;
pd.nwh = self.layer;
- pd.context = m_device;
+ pd.context = m_device;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
-
+
return self;
}
@@ -309,7 +309,7 @@ static void* m_device = NULL;
[m_window setRootViewController:viewController];
[m_window makeKeyAndVisible];
-
+
[m_window makeKeyAndVisible];
//float scaleFactor = [[UIScreen mainScreen] scale]; // should use this, but ui is too small on ipad retina
diff --git a/3rdparty/bgfx/examples/common/entry/entry_p.h b/3rdparty/bgfx/examples/common/entry/entry_p.h
index 880f44123e4..502eed673ad 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_p.h
+++ b/3rdparty/bgfx/examples/common/entry/entry_p.h
@@ -14,7 +14,7 @@
#include <string.h> // memcpy
#ifndef ENTRY_CONFIG_USE_SDL
-# define ENTRY_CONFIG_USE_SDL 0
+# define ENTRY_CONFIG_USE_SDL BX_PLATFORM_STEAMLINK
#endif // ENTRY_CONFIG_USE_SDL
#ifndef ENTRY_CONFIG_USE_GLFW
diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
index c5ab2c7d57a..989d0ae0667 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
@@ -11,13 +11,24 @@
# define SDL_MAIN_HANDLED
#endif // BX_PLATFORM_WINDOWS
+#include <bx/bx.h>
+
#include <SDL2/SDL.h>
+
+BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG()
+BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wextern-c-compat")
#include <SDL2/SDL_syswm.h>
+BX_PRAGMA_DIAGNOSTIC_POP_CLANG()
+
#include <bgfx/bgfxplatform.h>
+#if defined(None) // X11 defines this...
+# undef None
+#endif // defined(None)
#include <stdio.h>
#include <bx/thread.h>
#include <bx/handlealloc.h>
+#include <bx/readerwriter.h>
#include <tinystl/allocator.h>
#include <tinystl/string.h>
@@ -74,6 +85,22 @@ namespace entry
return GamepadAxis::Enum(s_translateGamepadAxis[_sdl]);
}
+ struct AxisDpadRemap
+ {
+ Key::Enum first;
+ Key::Enum second;
+ };
+
+ static AxisDpadRemap s_axisDpad[] =
+ {
+ { Key::GamepadLeft, Key::GamepadRight },
+ { Key::GamepadUp, Key::GamepadDown },
+ { Key::None, Key::None },
+ { Key::GamepadLeft, Key::GamepadRight },
+ { Key::GamepadUp, Key::GamepadDown },
+ { Key::None, Key::None },
+ };
+
struct GamepadSDL
{
GamepadSDL()
@@ -91,17 +118,59 @@ namespace entry
m_deadzone[GamepadAxis::RightZ] = 30;
}
- void create(int32_t _jid)
+ void create(const SDL_JoyDeviceEvent& _jev)
{
- m_controller = SDL_GameControllerOpen(_jid);
+ m_joystick = SDL_JoystickOpen(_jev.which);
+ SDL_Joystick* joystick = m_joystick;
+ m_jid = SDL_JoystickInstanceID(joystick);
+ }
+
+ void create(const SDL_ControllerDeviceEvent& _cev)
+ {
+ m_controller = SDL_GameControllerOpen(_cev.which);
SDL_Joystick* joystick = SDL_GameControllerGetJoystick(m_controller);
m_jid = SDL_JoystickInstanceID(joystick);
}
+ void update(EventQueue& _eventQueue, WindowHandle _handle, GamepadHandle _gamepad, GamepadAxis::Enum _axis, int32_t _value)
+ {
+ if (filter(_axis, &_value) )
+ {
+ _eventQueue.postAxisEvent(_handle, _gamepad, _axis, _value);
+
+ if (Key::None != s_axisDpad[_axis].first)
+ {
+ if (_value == 0)
+ {
+ _eventQueue.postKeyEvent(_handle, s_axisDpad[_axis].first, 0, false);
+ _eventQueue.postKeyEvent(_handle, s_axisDpad[_axis].second, 0, false);
+ }
+ else
+ {
+ _eventQueue.postKeyEvent(_handle
+ , 0 > _value ? s_axisDpad[_axis].first : s_axisDpad[_axis].second
+ , 0
+ , true
+ );
+ }
+ }
+ }
+ }
+
void destroy()
{
- SDL_GameControllerClose(m_controller);
- m_controller = NULL;
+ if (NULL != m_controller)
+ {
+ SDL_GameControllerClose(m_controller);
+ m_controller = NULL;
+ }
+
+ if (NULL != m_joystick)
+ {
+ SDL_JoystickClose(m_joystick);
+ m_joystick = NULL;
+ }
+
m_jid = INT32_MAX;
}
@@ -119,6 +188,7 @@ namespace entry
int32_t m_value[GamepadAxis::Count];
int32_t m_deadzone[GamepadAxis::Count];
+ SDL_Joystick* m_joystick;
SDL_GameController* m_controller;
// SDL_Haptic* m_haptic;
SDL_JoystickID m_jid;
@@ -148,6 +218,8 @@ namespace entry
return wmi.info.cocoa.window;
# elif BX_PLATFORM_WINDOWS
return wmi.info.win.window;
+# elif BX_PLATFORM_STEAMLINK
+ return wmi.info.vivante.window;
# endif // BX_PLATFORM_
}
@@ -326,7 +398,6 @@ namespace entry
m_mte.m_argv = _argv;
SDL_Init(0
- | SDL_INIT_VIDEO
| SDL_INIT_GAMECONTROLLER
);
@@ -356,10 +427,18 @@ namespace entry
WindowHandle defaultWindow = { 0 };
setWindowSize(defaultWindow, m_width, m_height, true);
- SDL_RWops* rw = SDL_RWFromFile("gamecontrollerdb.txt", "rb");
- if (NULL != rw)
+ bx::CrtFileReader reader;
+ if (bx::open(&reader, "gamecontrollerdb.txt") )
{
- SDL_GameControllerAddMappingsFromRW(rw, 1);
+ bx::AllocatorI* allocator = getAllocator();
+ uint32_t size = (uint32_t)bx::getSize(&reader);
+ void* data = BX_ALLOC(allocator, size);
+ bx::read(&reader, data, size);
+ bx::close(&reader);
+
+ SDL_GameControllerAddMapping( (char*)data);
+
+ BX_FREE(allocator, data);
}
bool exit = false;
@@ -477,6 +556,7 @@ namespace entry
}
}
break;
+
case SDL_KEYUP:
{
const SDL_KeyboardEvent& kev = event.key;
@@ -530,6 +610,18 @@ namespace entry
}
break;
+ case SDL_JOYAXISMOTION:
+ {
+ const SDL_JoyAxisEvent& jev = event.jaxis;
+ GamepadHandle handle = findGamepad(jev.which);
+ if (isValid(handle) )
+ {
+ GamepadAxis::Enum axis = translateGamepadAxis(jev.axis);
+ m_gamepad[handle.idx].update(m_eventQueue, defaultWindow, handle, axis, jev.value);
+ }
+ }
+ break;
+
case SDL_CONTROLLERAXISMOTION:
{
const SDL_ControllerAxisEvent& aev = event.caxis;
@@ -537,10 +629,23 @@ namespace entry
if (isValid(handle) )
{
GamepadAxis::Enum axis = translateGamepadAxis(aev.axis);
- int32_t value = aev.value;
- if (m_gamepad[handle.idx].filter(axis, &value) )
+ m_gamepad[handle.idx].update(m_eventQueue, defaultWindow, handle, axis, aev.value);
+ }
+ }
+ break;
+
+ case SDL_JOYBUTTONDOWN:
+ case SDL_JOYBUTTONUP:
+ {
+ const SDL_JoyButtonEvent& bev = event.jbutton;
+ GamepadHandle handle = findGamepad(bev.which);
+
+ if (isValid(handle) )
+ {
+ Key::Enum key = translateGamepad(bev.button);
+ if (Key::Count != key)
{
- m_eventQueue.postAxisEvent(defaultWindow, handle, axis, value);
+ m_eventQueue.postKeyEvent(defaultWindow, key, 0, event.type == SDL_JOYBUTTONDOWN);
}
}
}
@@ -562,14 +667,38 @@ namespace entry
}
break;
- case SDL_CONTROLLERDEVICEADDED:
+ case SDL_JOYDEVICEADDED:
{
- const SDL_ControllerDeviceEvent& cev = event.cdevice;
+ GamepadHandle handle = { m_gamepadAlloc.alloc() };
+ if (isValid(handle) )
+ {
+ const SDL_JoyDeviceEvent& jev = event.jdevice;
+ m_gamepad[handle.idx].create(jev);
+ m_eventQueue.postGamepadEvent(defaultWindow, handle, true);
+ }
+ }
+ break;
+
+ case SDL_JOYDEVICEREMOVED:
+ {
+ const SDL_JoyDeviceEvent& jev = event.jdevice;
+ GamepadHandle handle = findGamepad(jev.which);
+ if (isValid(handle) )
+ {
+ m_gamepad[handle.idx].destroy();
+ m_gamepadAlloc.free(handle.idx);
+ m_eventQueue.postGamepadEvent(defaultWindow, handle, false);
+ }
+ }
+ break;
+ case SDL_CONTROLLERDEVICEADDED:
+ {
GamepadHandle handle = { m_gamepadAlloc.alloc() };
if (isValid(handle) )
{
- m_gamepad[handle.idx].create(cev.which);
+ const SDL_ControllerDeviceEvent& cev = event.cdevice;
+ m_gamepad[handle.idx].create(cev);
m_eventQueue.postGamepadEvent(defaultWindow, handle, true);
}
}
diff --git a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
index 247bed44385..37f403ee480 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
@@ -358,7 +358,7 @@ namespace entry
s_translateKey[VK_HOME] = Key::Home;
s_translateKey[VK_END] = Key::End;
s_translateKey[VK_PRIOR] = Key::PageUp;
- s_translateKey[VK_NEXT] = Key::PageUp;
+ s_translateKey[VK_NEXT] = Key::PageDown;
s_translateKey[VK_SNAPSHOT] = Key::Print;
s_translateKey[VK_OEM_PLUS] = Key::Plus;
s_translateKey[VK_OEM_MINUS] = Key::Minus;
diff --git a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
index a058479fabb..8ced748dcbe 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
@@ -61,6 +61,23 @@ namespace entry
GamepadAxis::RightZ,
};
+ struct AxisDpadRemap
+ {
+ Key::Enum first;
+ Key::Enum second;
+ };
+
+ static AxisDpadRemap s_axisDpad[] =
+ {
+ { Key::GamepadLeft, Key::GamepadRight },
+ { Key::GamepadUp, Key::GamepadDown },
+ { Key::None, Key::None },
+ { Key::GamepadLeft, Key::GamepadRight },
+ { Key::GamepadUp, Key::GamepadDown },
+ { Key::None, Key::None },
+ };
+ BX_STATIC_ASSERT(BX_COUNTOF(s_translateAxis) == BX_COUNTOF(s_axisDpad) );
+
struct Joystick
{
Joystick()
@@ -135,6 +152,24 @@ namespace entry
if (filter(axis, &value) )
{
_eventQueue.postAxisEvent(defaultWindow, handle, axis, value);
+
+ if (Key::None != s_axisDpad[axis].first)
+ {
+ if (m_value[axis] == 0)
+ {
+ _eventQueue.postKeyEvent(defaultWindow, s_axisDpad[axis].first, 0, false);
+ _eventQueue.postKeyEvent(defaultWindow, s_axisDpad[axis].second, 0, false);
+ }
+ else
+ {
+ _eventQueue.postKeyEvent(defaultWindow
+ , 0 > m_value[axis] ? s_axisDpad[axis].first : s_axisDpad[axis].second
+ , 0
+ , true
+ );
+ }
+ }
+
}
}
}
diff --git a/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h
index 69a3484dc65..4bf319a2ecf 100644
--- a/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h
+++ b/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h
@@ -36,37 +36,38 @@ static const uint8_t fs_font_basic_glsl[553] =
0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva
0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_4;.}...
};
-static const uint8_t fs_font_basic_dx9[462] =
+static const uint8_t fs_font_basic_dx9[466] =
{
0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
- 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xb0, 0x01, 0x00, 0x03, 0xff, // Color0..........
- 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S..
+ 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xb4, 0x01, 0x00, 0x03, 0xff, // Color0..........
+ 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S..
0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................
0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0..........
0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo
0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor.............
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q..
- 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........@...?...
- 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, // ....?Q..........
- 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0xc0, 0x1f, 0x00, 0x00, // ...........@....
- 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................
- 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, // ................
- 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, 0x90, 0x00, 0x00, 0x00, // ................
- 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, // ...U............
- 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0xaa, // .X.........U....
- 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, // ................
- 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ...U.X..........
- 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // .......U........
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, // .........X......
- 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x42, 0x00, 0x00, // .............B..
- 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, // ................
- 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, // ................
- 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, 0x90, 0x01, 0x00, 0x00, // ................
- 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ..............
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, // .Q..........@...
+ 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, // ?.......?Q......
+ 0xa0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, // ...............@
+ 0xc0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................
+ 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
+ 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, // ................
+ 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // .......U........
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, // .....X.........U
+ 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, // ................
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, // .......U.X......
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, // ................
+ 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, // ...........U....
+ 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, // .............X..
+ 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, // ................
+ 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, // .B..............
+ 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, // ................
+ 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, // ................
+ 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................
+ 0x00, 0x00, // ..
};
static const uint8_t fs_font_basic_dx11[617] =
{
diff --git a/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h
index 030ec333753..9bd34a78a05 100644
--- a/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h
+++ b/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h
@@ -65,56 +65,56 @@ static const uint8_t fs_font_distance_field_glsl[1019] =
0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp
0x76, 0x61, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_9;.}...
};
-static const uint8_t fs_font_distance_field_dx9[754] =
+static const uint8_t fs_font_distance_field_dx9[758] =
{
0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
- 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd4, 0x02, 0x00, 0x03, 0xff, // Color0..........
- 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S..
+ 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd8, 0x02, 0x00, 0x03, 0xff, // Color0..........
+ 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S..
0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................
0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0..........
0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo
0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor.............
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q..
- 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........@...?...
- 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, // ....?Q..........
- 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0xc0, 0x51, 0x00, 0x00, // ...........@.Q..
- 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........A...?...
- 0xc0, 0x00, 0x00, 0x40, 0x40, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ...@@...........
- 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................
- 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, // ................
- 0x80, 0x01, 0x00, 0xff, 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, // ...........U....
- 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, // .........X......
- 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, // ...U............
- 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, // ...........U.X..
- 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, // ................
- 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, // ...............U
- 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, // ................
- 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, // .X..............
- 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, // .....B..........
- 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xc6, // ................
- 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x80, 0x01, 0x00, 0x90, // ................
- 0x91, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x08, 0x00, 0x00, // ................
- 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x07, 0x00, 0x00, // ................
- 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // .......U........
- 0x80, 0x00, 0x00, 0x55, 0x80, 0x5b, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, // ...U.[..........
- 0x90, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, // ................
- 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x06, 0x00, 0x00, // ................
- 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, // ................
- 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, // ...U............
- 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, // ...U.......U....
- 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x55, // .......U.......U
- 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xaa, 0x81, 0x00, 0x00, 0xe4, // ................
- 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x05, 0x00, 0x00, // ...........U....
- 0x03, 0x00, 0x00, 0x11, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, // .......U........
- 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0xff, // ................
- 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, // ................
- 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, // ...............U
- 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, // ................
- 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................
- 0x00, 0x00, // ..
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, // .Q..........@...
+ 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, // ?.......?Q......
+ 0xa0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, // ...............@
+ 0xc0, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, // .Q..........A...
+ 0x3f, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0x40, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, // ?......@@.......
+ 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, // ................
+ 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, // ................
+ 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x55, // ...............U
+ 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, // .............X..
+ 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xff, // .......U........
+ 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, // ...............U
+ 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, // .X..............
+ 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, // ...U............
+ 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, // .....X..........
+ 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, // .........B......
+ 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................
+ 0x80, 0x01, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, // ................
+ 0x80, 0x01, 0x00, 0x90, 0x91, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0xe4, // ................
+ 0x80, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x00, 0x00, 0xf9, // ................
+ 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, // ...........U....
+ 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x5b, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, // .......U.[......
+ 0x80, 0x01, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x01, 0x00, 0xe4, // ................
+ 0x80, 0x01, 0x00, 0xe4, 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, // ................
+ 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, // ................
+ 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, // .......U........
+ 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x55, // .......U.......U
+ 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, // ...........U....
+ 0xa0, 0x02, 0x00, 0x55, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xaa, // ...U............
+ 0x81, 0x00, 0x00, 0xe4, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, // ...............U
+ 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x11, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, // ...........U....
+ 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xaa, // ................
+ 0xa0, 0x02, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x00, 0x00, 0x55, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, // ...U............
+ 0x80, 0x00, 0x00, 0xff, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................
+ 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......
};
static const uint8_t fs_font_distance_field_dx11[1053] =
{
diff --git a/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h
index 46bdf5ab710..154481dc393 100644
--- a/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h
+++ b/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h
@@ -81,65 +81,65 @@ static const uint8_t fs_font_distance_field_subpixel_glsl[1268] =
0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x77, 0x29, 0x3b, 0x0a, // * v_color0.w);.
0x7d, 0x0a, 0x0a, 0x00, // }...
};
-static const uint8_t fs_font_distance_field_subpixel_dx9[902] =
+static const uint8_t fs_font_distance_field_subpixel_dx9[906] =
{
0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
- 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x68, 0x03, 0x00, 0x03, 0xff, // Color0.....h....
- 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S..
+ 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x6c, 0x03, 0x00, 0x03, 0xff, // Color0.....l....
+ 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S..
0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................
0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0..........
0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo
0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor.............
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q..
- 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........@...?...
- 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, // ....?Q..........
- 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0xc0, 0x51, 0x00, 0x00, // ...........@.Q..
- 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, // ...........@@...
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x03, 0x00, 0x0f, 0xa0, 0xc1, 0xaa, 0x2a, // .....Q.........*
- 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, // >...A...?.......
- 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................
- 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, // ................
- 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, 0x90, 0x00, 0x00, 0x00, // ................
- 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, // ...U............
- 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0xaa, // .X.........U....
- 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, // ................
- 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ...U.X..........
- 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // .......U........
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, // .........X......
- 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x5b, 0x00, 0x00, // .............[..
- 0x02, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, // ................
- 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, 0xa1, 0x01, 0x00, 0xe4, 0x90, 0x42, 0x00, 0x00, // .............B..
- 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, // ................
- 0x03, 0x02, 0x00, 0x01, 0x80, 0x02, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, // ................
- 0x04, 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, 0xa0, 0x01, 0x00, 0xe4, // ................
- 0x90, 0x08, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, // ................
- 0x80, 0x07, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, // ................
- 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x42, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, // .........B......
- 0x80, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x02, 0x00, 0x04, // ................
- 0x80, 0x03, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................
- 0x80, 0x02, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x02, // ................
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, // .......U........
- 0x80, 0x01, 0x00, 0xe4, 0x91, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................
- 0x80, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, // ................
- 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, // ................
- 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, // ................
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x55, 0xa1, 0x03, 0x00, 0xaa, 0xa0, 0x04, 0x00, 0x00, // .......U........
- 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x55, 0xa0, 0x03, 0x00, 0xaa, // ...........U....
- 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0x00, // ...........U....
- 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0x55, 0x81, 0x02, 0x00, 0x90, // ...........U....
- 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x02, 0x00, 0x55, 0x80, 0x00, 0x00, 0xff, // ...........U....
- 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, // ................
- 0x03, 0x00, 0x00, 0x17, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x04, 0x00, 0x00, // ................
- 0x04, 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x55, // ...............U
- 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, // ................
- 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, // ................
- 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xff, // ................
- 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, // .Q..........@...
+ 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, // ?.......?Q......
+ 0xa0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, // ...............@
+ 0xc0, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, // .Q.............@
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x03, 0x00, 0x0f, // @........Q......
+ 0xa0, 0xc1, 0xaa, 0x2a, 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ...*>...A...?...
+ 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x90, 0x1f, 0x00, 0x00, // ................
+ 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
+ 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, // ................
+ 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // .......U........
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, // .....X.........U
+ 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, // ................
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, // .......U.X......
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, // ................
+ 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, // ...........U....
+ 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, // .............X..
+ 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, // ................
+ 0xa0, 0x5b, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, // .[..............
+ 0x04, 0x02, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, 0xa1, 0x01, 0x00, 0xe4, // ................
+ 0x90, 0x42, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, // .B..............
+ 0xa0, 0x09, 0x00, 0x00, 0x03, 0x02, 0x00, 0x01, 0x80, 0x02, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, // ................
+ 0x80, 0x04, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, // ................
+ 0xa0, 0x01, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0xe4, // ................
+ 0x80, 0x01, 0x00, 0xe4, 0x80, 0x07, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, // ................
+ 0x80, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x42, 0x00, 0x00, // .............B..
+ 0x03, 0x03, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, // ................
+ 0x03, 0x02, 0x00, 0x04, 0x80, 0x03, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, // ................
+ 0x03, 0x00, 0x00, 0x01, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, // ................
+ 0x03, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, // ...........U....
+ 0x02, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x91, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, // ................
+ 0x80, 0x00, 0x00, 0xe4, 0x80, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xe4, // ................
+ 0x80, 0x00, 0x00, 0xe4, 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, // ................
+ 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, // ................
+ 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x55, 0xa1, 0x03, 0x00, 0xaa, // ...........U....
+ 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x55, // ...............U
+ 0xa0, 0x03, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, // ...............U
+ 0x81, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0x55, // ...............U
+ 0x81, 0x02, 0x00, 0x90, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x02, 0x00, 0x55, // ...............U
+ 0x80, 0x00, 0x00, 0xff, 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x17, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xf9, // ................
+ 0x80, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, // ................
+ 0xa0, 0x02, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, // ...U............
+ 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................
+ 0x80, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................
+ 0x80, 0x00, 0x00, 0xff, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ..........
};
static const uint8_t fs_font_distance_field_subpixel_dx11[1305] =
{
diff --git a/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h
index 5df95fa7cce..884743b9973 100644
--- a/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h
+++ b/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h
@@ -28,11 +28,11 @@ static const uint8_t vs_font_basic_glsl[431] =
0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 =
0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}...
};
-static const uint8_t vs_font_basic_dx9[335] =
+static const uint8_t vs_font_basic_dx9[339] =
{
0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod
0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
- 0x2c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ,.......#.CTAB..
+ 0x30, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // 0.......$.CTAB..
0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0.....
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_
@@ -40,17 +40,18 @@ static const uint8_t vs_font_basic_dx9[335] =
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs
0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft (
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C
- 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952
- 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111...........
- 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
- 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
- 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
- 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x05, 0x00, // ................
- 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, // ............U...
- 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, // ................
- 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................
- 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................
- 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...............
+ 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100
+ 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........
+ 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
+ 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................
+ 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................
+ 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
+ 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // U...............
+ 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................
+ 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................
+ 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................
+ 0x00, 0x00, 0x00, // ...
};
static const uint8_t vs_font_basic_dx11[580] =
{
diff --git a/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h
index 6fea18b931a..ebc7589c408 100644
--- a/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h
+++ b/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h
@@ -28,11 +28,11 @@ static const uint8_t vs_font_distance_field_glsl[431] =
0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 =
0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}...
};
-static const uint8_t vs_font_distance_field_dx9[335] =
+static const uint8_t vs_font_distance_field_dx9[339] =
{
0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod
0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
- 0x2c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ,.......#.CTAB..
+ 0x30, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // 0.......$.CTAB..
0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0.....
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_
@@ -40,17 +40,18 @@ static const uint8_t vs_font_distance_field_dx9[335] =
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs
0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft (
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C
- 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952
- 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111...........
- 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
- 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
- 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
- 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x05, 0x00, // ................
- 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, // ............U...
- 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, // ................
- 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................
- 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................
- 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...............
+ 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100
+ 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........
+ 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
+ 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................
+ 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................
+ 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
+ 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // U...............
+ 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................
+ 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................
+ 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................
+ 0x00, 0x00, 0x00, // ...
};
static const uint8_t vs_font_distance_field_dx11[580] =
{
diff --git a/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h
index bd885e453e3..6b0d75236d6 100644
--- a/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h
+++ b/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h
@@ -28,11 +28,11 @@ static const uint8_t vs_font_distance_field_subpixel_glsl[431] =
0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 =
0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}...
};
-static const uint8_t vs_font_distance_field_subpixel_dx9[335] =
+static const uint8_t vs_font_distance_field_subpixel_dx9[339] =
{
0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod
0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
- 0x2c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ,.......#.CTAB..
+ 0x30, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // 0.......$.CTAB..
0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0.....
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_
@@ -40,17 +40,18 @@ static const uint8_t vs_font_distance_field_subpixel_dx9[335] =
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs
0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft (
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C
- 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952
- 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111...........
- 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
- 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
- 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
- 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x05, 0x00, // ................
- 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, // ............U...
- 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, // ................
- 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................
- 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................
- 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...............
+ 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100
+ 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........
+ 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
+ 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................
+ 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................
+ 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
+ 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // U...............
+ 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................
+ 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................
+ 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................
+ 0x00, 0x00, 0x00, // ...
};
static const uint8_t vs_font_distance_field_subpixel_dx11[580] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h
index 611a46bc560..d64b2bdf7ca 100644
--- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h
@@ -7,17 +7,17 @@ static const uint8_t fs_imgui_color_glsl[89] =
0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col
0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}...
};
-static const uint8_t fs_imgui_color_dx9[137] =
+static const uint8_t fs_imgui_color_dx9[141] =
{
- 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I..|.....
- 0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
+ 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I........
+ 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................
0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
- 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
- 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111.....
- 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................
- 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .........
+ 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10
+ 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384..
+ 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, // ................
+ 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .............
};
static const uint8_t fs_imgui_color_dx11[260] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h
index 265aef506c1..f274ada3d9c 100644
--- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h
@@ -24,12 +24,12 @@ static const uint8_t fs_imgui_cubemap_glsl[363] =
0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_1;.}...
};
-static const uint8_t fs_imgui_cubemap_dx9[390] =
+static const uint8_t fs_imgui_cubemap_dx9[394] =
{
0x46, 0x53, 0x48, 0x04, 0xe3, 0xc2, 0x5c, 0x65, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH....e...s_tex
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, // Color0......u_im
0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, // ageLodEnabled...
- 0x00, 0x01, 0x00, 0x50, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, // ...P.......0.CTA
+ 0x00, 0x01, 0x00, 0x54, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x31, 0x00, 0x43, 0x54, 0x41, // ...T.......1.CTA
0x42, 0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, // B...............
0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, // .............D..
0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........P......
@@ -40,17 +40,17 @@ static const uint8_t fs_imgui_cubemap_dx9[390] =
0x65, 0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // ed..............
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q..
- 0x05, 0x01, 0x00, 0x0f, 0xa0, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x00, 0x00, 0x00, // .......L?..L>...
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, // ................
- 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x01, 0x00, 0x00, // ................
- 0x02, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, // ................
- 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, // ....._..........
- 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................
- 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, // ...........U....
- 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x55, // .......U.......U
- 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ......
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, // .Q.........L?..L
+ 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, // >...............
+ 0x80, 0x00, 0x00, 0x07, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, // ................
+ 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, // ................
+ 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._......
+ 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, // ................
+ 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, // ...............U
+ 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, // ...........U....
+ 0xa0, 0x01, 0x00, 0x55, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ...U......
};
static const uint8_t fs_imgui_cubemap_dx11[441] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h
index 8496e53c794..618848fa5a1 100644
--- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h
@@ -24,12 +24,12 @@ static const uint8_t fs_imgui_image_glsl[360] =
0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // agColor = tmpvar
0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _1;.}...
};
-static const uint8_t fs_imgui_image_dx9[394] =
+static const uint8_t fs_imgui_image_dx9[398] =
{
0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH.o.><...s_tex
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, // Color0......u_im
0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, // ageLodEnabled...
- 0x00, 0x01, 0x00, 0x54, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, // ...T.......0.CTA
+ 0x00, 0x01, 0x00, 0x58, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x31, 0x00, 0x43, 0x54, 0x41, // ...X.......1.CTA
0x42, 0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, // B...............
0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, // .............D..
0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........P......
@@ -40,17 +40,17 @@ static const uint8_t fs_imgui_image_dx9[394] =
0x65, 0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // ed..............
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q..
- 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, // ........?......L
- 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, // ?..L>...........
- 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, // ................
- 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, // ................
- 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._......
- 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, // ................
- 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0x80, 0x01, 0x00, 0xe4, // ................
- 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, // ...........U....
- 0x80, 0x00, 0x00, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ..........
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, // .Q..........?...
+ 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ...L?..L>.......
+ 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, // ................
+ 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, // ................
+ 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, // ............._..
+ 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................
+ 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, // ................
+ 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, // ...............U
+ 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ..............
};
static const uint8_t fs_imgui_image_dx11[445] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h
index 237bdb1e10c..593de84d168 100644
--- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h
@@ -28,13 +28,13 @@ static const uint8_t fs_imgui_image_swizz_glsl[425] =
0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva
0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_1;.}...
};
-static const uint8_t fs_imgui_image_swizz_dx9[458] =
+static const uint8_t fs_imgui_image_swizz_dx9[462] =
{
0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x03, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH.o.><...s_tex
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, // Color0......u_im
0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, // ageLodEnabled...
0x00, 0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x12, 0x01, 0x01, // ....u_swizzle...
- 0x00, 0x01, 0x00, 0x84, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x38, 0x00, 0x43, 0x54, 0x41, // ...........8.CTA
+ 0x00, 0x01, 0x00, 0x88, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x39, 0x00, 0x43, 0x54, 0x41, // ...........9.CTA
0x42, 0x1c, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x03, 0x00, 0x00, // B...............
0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, // .............X..
0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........d......
@@ -47,18 +47,18 @@ static const uint8_t fs_imgui_image_swizz_dx9[458] =
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, // .........u_swizz
0x6c, 0x65, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // le.ps_3_0.Micros
0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha
- 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, // der Compiler 9.2
- 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, // 9.952.3111...Q..
- 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, // ........?......L
- 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, // ?..L>...........
- 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, // ................
- 0x03, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, // ................
- 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._......
- 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................
- 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, // ................
- 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, // ...............U
- 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, // ................
- 0x80, 0x00, 0x00, 0x40, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ...@......
+ 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10.
+ 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0xab, // 0.10011.16384...
+ 0xab, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, // .Q..........?...
+ 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ...L?..L>.......
+ 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, // ................
+ 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, // ................
+ 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, // ............._..
+ 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, // ................
+ 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................
+ 0x02, 0x00, 0x00, 0x0c, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, // ................
+ 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, // ...U............
+ 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0x40, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // .......@......
};
static const uint8_t fs_imgui_image_swizz_dx11[493] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h
index 5a54b079fe2..14d7aef3e0b 100644
--- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h
@@ -42,12 +42,12 @@ static const uint8_t fs_imgui_latlong_glsl[651] =
0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp
0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_4;.}...
};
-static const uint8_t fs_imgui_latlong_dx9[554] =
+static const uint8_t fs_imgui_latlong_dx9[558] =
{
0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH.o.><...s_tex
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, // Color0......u_im
0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, // ageLodEnabled...
- 0x00, 0x01, 0x00, 0xf4, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, // ...........0.CTA
+ 0x00, 0x01, 0x00, 0xf8, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x31, 0x00, 0x43, 0x54, 0x41, // ...........1.CTA
0x42, 0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, // B...............
0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, // .............D..
0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........P......
@@ -58,27 +58,27 @@ static const uint8_t fs_imgui_latlong_dx9[554] =
0x65, 0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // ed..............
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q..
- 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0xc9, 0x40, 0xdb, 0x0f, 0x49, // ........?...@..I
- 0xc0, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0xcd, 0xcc, 0x4c, // .....Q.........L
- 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, // ?..L>...........
- 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
- 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, // ................
- 0xa0, 0x00, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
- 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, // ...............U
- 0xa0, 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, // .....%..........
- 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0x00, // ...........U....
- 0xa0, 0x01, 0x00, 0x00, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
- 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, // ...............U
- 0xa0, 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, // .....%..........
- 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x05, 0x80, 0x01, 0x00, 0xc5, 0x80, 0x02, 0x00, 0x55, // ...............U
- 0x81, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, // ................
- 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._......
- 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, // ................
- 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, // ...............U
- 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, // ...........U....
- 0xa0, 0x02, 0x00, 0x55, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ...U......
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0xc9, // .Q..........?...
+ 0x40, 0xdb, 0x0f, 0x49, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, // @..I.....Q......
+ 0xa0, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...L?..L>.......
+ 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, // ................
+ 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................
+ 0x80, 0x01, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, // ................
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x01, 0x00, 0x55, 0xa0, 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, // ...U.....%......
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, // ...............U
+ 0x90, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, // ................
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x01, 0x00, 0x55, 0xa0, 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, // ...U.....%......
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x05, 0x80, 0x01, 0x00, 0xc5, // ................
+ 0x80, 0x02, 0x00, 0x55, 0x81, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x00, // ...U............
+ 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, // ............._..
+ 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................
+ 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // ................
+ 0x80, 0x00, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, // ...U...........U
+ 0x80, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x55, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .......U......
};
static const uint8_t fs_imgui_latlong_dx11[617] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h
index 08d722db698..5fc0768dd13 100644
--- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h
@@ -20,25 +20,25 @@ static const uint8_t fs_imgui_texture_glsl[290] =
0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, // r = tmpvar_1;.}.
0x0a, 0x00, // ..
};
-static const uint8_t fs_imgui_texture_dx9[258] =
+static const uint8_t fs_imgui_texture_dx9[262] =
{
0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
- 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xe4, 0x00, 0x00, 0x03, 0xff, // Color0..........
- 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S..
+ 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xe8, 0x00, 0x00, 0x03, 0xff, // Color0..........
+ 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S..
0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................
0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0..........
0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo
0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor.............
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, // .29.952.3111....
- 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................
- 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, // ................
- 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, // .B..............
- 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, // ................
- 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................
- 0x00, 0x00, // ..
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................
+ 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
+ 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, // .....B..........
+ 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x00, 0x00, 0xff, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................
+ 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......
};
static const uint8_t fs_imgui_texture_dx11[421] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h
index ed79a9399c5..bbfafdf88d5 100644
--- a/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h
@@ -16,10 +16,10 @@ static const uint8_t fs_ocornut_imgui_glsl[238] =
0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x2a, 0x20, 0x76, // = (tmpvar_1 * v
0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _color0);.}...
};
-static const uint8_t fs_ocornut_imgui_dx9[237] =
+static const uint8_t fs_ocornut_imgui_dx9[241] =
{
0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
- 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd4, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x21, 0x00, // 0.............!.
+ 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd8, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, // 0.............".
0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, // CTAB....O.......
0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, // ............H...
0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x38, 0x00, 0x00, 0x00, // 0...........8...
@@ -27,12 +27,13 @@ static const uint8_t fs_ocornut_imgui_dx9[237] =
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, // ............ps_3
0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, // _0.Microsoft (R)
0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, // HLSL Shader Com
- 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, // piler 9.29.952.3
- 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // 111.............
- 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................
- 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ........B.......
- 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x0f, 0x80, // ................
- 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .............
+ 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, // piler 10.0.10011
+ 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, // .16384..........
+ 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, // ................
+ 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, // ............B...
+ 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, // ................
+ 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, // ................
+ 0x00, // .
};
static const uint8_t fs_ocornut_imgui_dx11[396] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp
index 3bc68d3d61d..4cdc5f30fe5 100644
--- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp
+++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp
@@ -468,7 +468,7 @@ struct Imgui
IMGUI_create(_data, _size, _fontSize, m_allocator);
- m_nvg = nvgCreate(1, m_view);
+ m_nvg = nvgCreate(1, m_view, m_allocator);
nvgCreateFontMem(m_nvg, "default", (unsigned char*)_data, INT32_MAX, 0);
nvgFontSize(m_nvg, _fontSize);
nvgFontFace(m_nvg, "default");
@@ -3572,3 +3572,10 @@ bool imguiMouseOverArea()
{
return s_imgui.m_insideArea;
}
+
+bgfx::ProgramHandle imguiGetImageProgram(uint8_t _mip)
+{
+ const float lodEnabled[4] = { float(_mip), 1.0f, 0.0f, 0.0f };
+ bgfx::setUniform(s_imgui.u_imageLodEnabled, lodEnabled);
+ return s_imgui.m_imageProgram;
+}
diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.h b/3rdparty/bgfx/examples/common/imgui/imgui.h
index 75269500c85..0ab18cb9f8a 100644
--- a/3rdparty/bgfx/examples/common/imgui/imgui.h
+++ b/3rdparty/bgfx/examples/common/imgui/imgui.h
@@ -208,12 +208,13 @@ bool imguiMouseOverArea();
namespace ImGui
{
-#define IMGUI_FLAGS_NONE UINT16_C(0x0000)
-#define IMGUI_FLAGS_ALPHA_BLEND UINT16_C(0x0001)
+#define IMGUI_FLAGS_NONE UINT8_C(0x00)
+#define IMGUI_FLAGS_ALPHA_BLEND UINT8_C(0x01)
// Helper function for passing bgfx::TextureHandle to ImGui::Image.
inline void Image(bgfx::TextureHandle _handle
- , uint16_t _flags
+ , uint8_t _flags
+ , uint8_t _mip
, const ImVec2& _size
, const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
, const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
@@ -221,9 +222,10 @@ namespace ImGui
, const ImVec4& _borderCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
)
{
- union { struct { uint16_t flags; bgfx::TextureHandle handle; } s; ImTextureID ptr; } texture;
- texture.s.flags = _flags;
+ union { struct { bgfx::TextureHandle handle; uint8_t flags; uint8_t mip; } s; ImTextureID ptr; } texture;
texture.s.handle = _handle;
+ texture.s.flags = _flags;
+ texture.s.mip = _mip;
Image(texture.ptr, _size, _uv0, _uv1, _tintCol, _borderCol);
}
@@ -236,12 +238,13 @@ namespace ImGui
, const ImVec4& _borderCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
)
{
- Image(_handle, IMGUI_FLAGS_ALPHA_BLEND, _size, _uv0, _uv1, _tintCol, _borderCol);
+ Image(_handle, IMGUI_FLAGS_ALPHA_BLEND, 0, _size, _uv0, _uv1, _tintCol, _borderCol);
}
// Helper function for passing bgfx::TextureHandle to ImGui::ImageButton.
inline bool ImageButton(bgfx::TextureHandle _handle
- , uint16_t _flags
+ , uint8_t _flags
+ , uint8_t _mip
, const ImVec2& _size
, const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
, const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
@@ -250,9 +253,10 @@ namespace ImGui
, const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
)
{
- union { struct { uint16_t flags; bgfx::TextureHandle handle; } s; ImTextureID ptr; } texture;
- texture.s.flags = _flags;
+ union { struct { bgfx::TextureHandle handle; uint8_t flags; uint8_t mip; } s; ImTextureID ptr; } texture;
texture.s.handle = _handle;
+ texture.s.flags = _flags;
+ texture.s.mip = _mip;
return ImageButton(texture.ptr, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol);
}
@@ -266,7 +270,7 @@ namespace ImGui
, const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
)
{
- return ImageButton(_handle, IMGUI_FLAGS_ALPHA_BLEND, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol);
+ return ImageButton(_handle, IMGUI_FLAGS_ALPHA_BLEND, 0, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol);
}
} // namespace ImGui
diff --git a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp
index 4545bb998a0..f6f0a4e2bdd 100644
--- a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp
+++ b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp
@@ -305,15 +305,21 @@ struct OcornutImguiContext
;
bgfx::TextureHandle th = m_texture;
+ bgfx::ProgramHandle program = m_program;
if (NULL != cmd->TextureId)
{
- union { ImTextureID ptr; struct { uint16_t flags; bgfx::TextureHandle handle; } s; } texture = { cmd->TextureId };
+ union { ImTextureID ptr; struct { bgfx::TextureHandle handle; uint8_t flags; uint8_t mip; } s; } texture = { cmd->TextureId };
state |= 0 != (IMGUI_FLAGS_ALPHA_BLEND & texture.s.flags)
? BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)
: BGFX_STATE_NONE
;
th = texture.s.handle;
+ if (0 != texture.s.mip)
+ {
+ extern bgfx::ProgramHandle imguiGetImageProgram(uint8_t _mip);
+ program = imguiGetImageProgram(texture.s.mip);
+ }
}
else
{
@@ -331,7 +337,7 @@ struct OcornutImguiContext
bgfx::setTexture(0, s_tex, th);
bgfx::setVertexBuffer(&tvb, 0, numVertices);
bgfx::setIndexBuffer(&tib, offset, cmd->ElemCount);
- bgfx::submit(cmd->ViewId, m_program);
+ bgfx::submit(cmd->ViewId, program);
}
offset += cmd->ElemCount;
diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h
index 4867ea1a86c..1b8aa95fb28 100644
--- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h
@@ -22,27 +22,27 @@ static const uint8_t vs_imgui_color_glsl[324] =
0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, // or0 = a_color0;.
0x7d, 0x0a, 0x0a, 0x00, // }...
};
-static const uint8_t vs_imgui_color_dx9[290] =
+static const uint8_t vs_imgui_color_dx9[294] =
{
0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH....I...u_vie
- 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x04, 0x01, 0x00, 0x03, 0xfe, // wProj...........
- 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S..
+ 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x08, 0x01, 0x00, 0x03, 0xfe, // wProj...........
+ 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S..
0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................
0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .L...0..........
0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .<.......u_viewP
0x72, 0x6f, 0x6a, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // roj.............
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....vs_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, // .29.952.3111....
- 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
- 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ................
- 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x05, 0x00, 0x00, // ................
- 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, // ...........U....
- 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, // ................
- 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, // ................
- 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................
- 0x00, 0x00, // ..
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, // ................
+ 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, // ...............U
+ 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................
+ 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, // ................
+ 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, // ................
+ 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......
};
static const uint8_t vs_imgui_color_dx11[465] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h
index 6467376b5a7..154c4e416e3 100644
--- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h
@@ -22,11 +22,11 @@ static const uint8_t vs_imgui_cubemap_glsl[329] =
0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x2e, // rmal = a_normal.
0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // xyz;.}...
};
-static const uint8_t vs_imgui_cubemap_dx9[319] =
+static const uint8_t vs_imgui_cubemap_dx9[323] =
{
0x56, 0x53, 0x48, 0x04, 0xe3, 0xc2, 0x5c, 0x65, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....e...u_mod
0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
- 0x1c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........#.CTAB..
+ 0x20, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // .......$.CTAB..
0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0.....
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_
@@ -34,16 +34,17 @@ static const uint8_t vs_imgui_cubemap_dx9[319] =
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs
0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft (
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C
- 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952
- 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111...........
- 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, // ................
- 0x00, 0x80, 0x01, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................
- 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U...........
- 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................
- 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
- 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
- 0x00, 0x02, 0x01, 0x00, 0x07, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...............
+ 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100
+ 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, // 11.16384........
+ 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
+ 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................
+ 0x00, 0x02, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U.......
+ 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................
+ 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................
+ 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................
+ 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................
+ 0x00, 0x00, 0x00, // ...
};
static const uint8_t vs_imgui_cubemap_dx11[510] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h
index b34b38c4122..f3711052b08 100644
--- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h
@@ -22,27 +22,27 @@ static const uint8_t vs_imgui_image_glsl[336] =
0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x61, // v_texcoord0 = a
0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _texcoord0;.}...
};
-static const uint8_t vs_imgui_image_dx9[290] =
+static const uint8_t vs_imgui_image_dx9[294] =
{
0x56, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH.o.><...u_vie
- 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x04, 0x01, 0x00, 0x03, 0xfe, // wProj...........
- 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S..
+ 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x08, 0x01, 0x00, 0x03, 0xfe, // wProj...........
+ 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S..
0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................
0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .L...0..........
0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .<.......u_viewP
0x72, 0x6f, 0x6a, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // roj.............
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....vs_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, // .29.952.3111....
- 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................
- 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ................
- 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, // ................
- 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, // ...........U....
- 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, // ................
- 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, // ................
- 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................
- 0x00, 0x00, // ..
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................
+ 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
+ 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, // ................
+ 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, // ...............U
+ 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, // ................
+ 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, // ................
+ 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, // ................
+ 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......
};
static const uint8_t vs_imgui_image_dx11[473] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h
index 8b84198ba33..4cf8bb28af7 100644
--- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h
@@ -23,11 +23,11 @@ static const uint8_t vs_imgui_latlong_glsl[337] =
0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // a_texcoord0;.}..
0x00, // .
};
-static const uint8_t vs_imgui_latlong_dx9[319] =
+static const uint8_t vs_imgui_latlong_dx9[323] =
{
0x56, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod
0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
- 0x1c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........#.CTAB..
+ 0x20, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // .......$.CTAB..
0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0.....
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_
@@ -35,16 +35,17 @@ static const uint8_t vs_imgui_latlong_dx9[319] =
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs
0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft (
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C
- 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952
- 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111...........
- 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................
- 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................
- 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U...........
- 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................
- 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
- 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
- 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...............
+ 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100
+ 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // 11.16384........
+ 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
+ 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................
+ 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U.......
+ 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................
+ 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................
+ 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................
+ 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................
+ 0x00, 0x00, 0x00, // ...
};
static const uint8_t vs_imgui_latlong_dx11[518] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h
index a5c839c5c08..34ab3e2da96 100644
--- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h
@@ -28,29 +28,29 @@ static const uint8_t vs_imgui_texture_glsl[419] =
0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, // r0 = a_color0;.}
0x0a, 0x0a, 0x00, // ...
};
-static const uint8_t vs_imgui_texture_dx9[326] =
+static const uint8_t vs_imgui_texture_dx9[330] =
{
0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie
- 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x28, 0x01, 0x00, 0x03, 0xfe, // wProj......(....
- 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S..
+ 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x2c, 0x01, 0x00, 0x03, 0xfe, // wProj......,....
+ 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S..
0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................
0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .L...0..........
0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .<.......u_viewP
0x72, 0x6f, 0x6a, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // roj.............
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....vs_3_0.Micr
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
- 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
- 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, // .29.952.3111....
- 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
- 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, // ................
- 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, // ................
- 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................
- 0x80, 0x02, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, // ................
- 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, // ...U............
- 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ................
- 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 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, // ......
+ 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1
+ 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384.
+ 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................
+ 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ................
+ 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, // ................
+ 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ................
+ 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, // .......U........
+ 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, // ................
+ 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 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_imgui_texture_dx11[575] =
{
diff --git a/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h
index ba968aaa2a6..81ed318597a 100644
--- a/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h
+++ b/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h
@@ -34,11 +34,11 @@ static const uint8_t vs_ocornut_imgui_glsl[523] =
0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, // v_color0 = a_c
0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // olor0;.}...
};
-static const uint8_t vs_ocornut_imgui_dx9[367] =
+static const uint8_t vs_ocornut_imgui_dx9[371] =
{
0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0b, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie
- 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x50, 0x01, 0x00, 0x03, // wTexel......P...
- 0xfe, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, // ....".CTAB....S.
+ 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x54, 0x01, 0x00, 0x03, // wTexel......T...
+ 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, // ....#.CTAB....S.
0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................
0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, // ..L...0.........
0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..<.......u_view
@@ -46,19 +46,20 @@ static const uint8_t vs_ocornut_imgui_dx9[367] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......vs_3_0.Mic
0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL
0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler
- 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, // 9.29.952.3111.Q.
- 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, // .........@......
- 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .?..............
- 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
- 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
- 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
- 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0xe0, 0x05, 0x00, // ................
- 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xe4, 0x90, 0x04, 0x00, // ................
- 0x00, 0x04, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, // ................
- 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, // U...........U...
- 0x00, 0xa1, 0x01, 0x00, 0xaa, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0xe0, 0x01, 0x00, // ................
- 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, // ...............
+ 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, // 10.0.10011.16384
+ 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // ..Q..........@..
+ 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // .....?..........
+ 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
+ 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................
+ 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................
+ 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
+ 0xe4, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................
+ 0x00, 0xa0, 0x01, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x00, // ....U...........
+ 0x55, 0x80, 0x01, 0x00, 0x00, 0xa1, 0x01, 0x00, 0xaa, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // U...............
+ 0x0c, 0xe0, 0x01, 0x00, 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[612] =
{
diff --git a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h
index f2de36d49ad..c7ed6294e86 100644
--- a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h
+++ b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h
@@ -195,7 +195,7 @@ static const uint8_t fs_nanovg_fill_glsl[3095] =
0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // gColor = result_
0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1;.}...
};
-static const uint8_t fs_nanovg_fill_dx9[1543] =
+static const uint8_t fs_nanovg_fill_dx9[1547] =
{
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x08, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, // 0......u_extentR
@@ -206,8 +206,8 @@ static const uint8_t fs_nanovg_fill_dx9[1543] =
0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, // _params.......u_
0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x12, // scissorExtScale.
0x01, 0x08, 0x00, 0x01, 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, // ......u_scissorM
- 0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x03, 0x00, 0x6c, 0x05, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // at......l.......
- 0x63, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, 0x00, 0x00, 0x03, // c.CTAB....W.....
+ 0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x03, 0x00, 0x70, 0x05, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // at......p.......
+ 0x64, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, 0x00, 0x00, 0x03, // d.CTAB....W.....
0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x01, // ..............P.
0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xc4, 0x00, // ................
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x00, 0x01, 0x00, // ................
@@ -231,69 +231,69 @@ static const uint8_t fs_nanovg_fill_dx9[1543] =
0x6f, 0x72, 0x4d, 0x61, 0x74, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // orMat.ps_3_0.Mic
0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL
0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler
- 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, // 9.29.952.3111.Q.
- 0x00, 0x05, 0x0b, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .........?...@..
- 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x0c, 0x00, 0x0f, 0xa0, 0x00, 0x00, // .....?Q.........
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, // .....?..@@......
- 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................
- 0x01, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, // ................
- 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x90, 0x0b, 0x00, // ................
- 0x55, 0xa0, 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // U...............
- 0x00, 0x8c, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // ................
- 0x00, 0x80, 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, // ....U...........
- 0x00, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, // ................
- 0x55, 0x90, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // U...............
- 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x04, 0x00, // ................
- 0xd0, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x80, 0x03, 0x00, // ....U...........
- 0xd0, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
- 0x06, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xd0, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, // ................
- 0x01, 0x80, 0x09, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x09, 0x00, // ................
- 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, 0xe9, 0x80, 0x01, 0x00, // U...............
- 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, 0x44, 0xa0, 0x00, 0x00, // ............D...
- 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x44, 0xa0, 0x00, 0x00, // U...........D...
- 0x00, 0x90, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, // ................
- 0xe4, 0x80, 0x02, 0x00, 0x44, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, // ....D...........
- 0xe4, 0x8b, 0x08, 0x00, 0x44, 0xa1, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x07, 0x80, 0x0b, 0x00, // ....D...........
- 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x1c, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x08, 0x00, // ................
- 0xe4, 0xa1, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, 0x01, 0x00, // ................
- 0xff, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // ................
- 0xff, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x04, 0x80, 0x02, 0x00, // ................
- 0xaa, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x23, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0c, 0x80, 0x0a, 0x00, // ......#.........
- 0xb4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x08, // ..B.............
- 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0f, 0x80, 0x03, 0x00, 0x00, 0x80, 0x0c, 0x00, // ................
- 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x03, 0x00, 0x0f, 0x80, 0x02, 0x00, // @.....X.........
- 0xff, 0x81, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, // ................
- 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xff, 0x80, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, // ..........).....
- 0xff, 0xa0, 0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x04, 0x00, 0x0f, 0x80, 0x0b, 0x00, // ....U...........
- 0xff, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x04, 0x80, 0x0c, 0x00, // ..*.............
- 0xaa, 0xa0, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x05, 0x00, 0xaa, 0x80, 0x42, 0x00, // ..)...........B.
- 0x00, 0x03, 0x05, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, // ................
- 0x00, 0x04, 0x06, 0x00, 0x0f, 0x80, 0x05, 0x00, 0x00, 0x80, 0x0c, 0x00, 0x40, 0xa0, 0x0c, 0x00, // ............@...
- 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x05, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xff, 0x81, 0x05, 0x00, // ..X.............
- 0xe4, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x05, 0x00, 0x08, 0x80, 0x00, 0x00, // ................
- 0xff, 0x80, 0x05, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x04, 0x00, 0x0f, 0x80, 0x05, 0x00, // ................
- 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x04, 0x00, // ......*.........
- 0x0f, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x58, 0x00, // ......+...+...X.
- 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................
- 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x09, 0x00, 0xaa, 0xa1, 0x09, 0x00, // ................
- 0x60, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xe4, 0x8b, 0x02, 0x00, // `...............
- 0xf4, 0x81, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x00, 0x00, 0xa4, 0x80, 0x0c, 0x00, // ................
- 0x00, 0xa0, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x02, 0x00, 0xed, 0x80, 0x02, 0x00, // ..Z.............
- 0xed, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................
- 0xff, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0b, 0x00, // ................
- 0x00, 0x03, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x0a, 0x00, // ........U.......
- 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x55, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x02, 0x00, // ........U.......
- 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, // ............U...
- 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x09, 0x00, 0xaa, 0xa1, 0x04, 0x00, // ........U.......
- 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, // ................
- 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x05, 0x00, // U...............
- 0x00, 0x03, 0x00, 0x00, 0x12, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, // ............U...
- 0x00, 0x02, 0x03, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x03, 0x00, // ................
- 0x0f, 0x80, 0x03, 0x00, 0xe4, 0x81, 0x07, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x03, 0x00, // ................
- 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x05, 0x00, // ....U...........
- 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xff, 0x80, 0x58, 0x00, // ..............X.
- 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xaa, 0x81, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, // ................
- 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // .......
+ 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, // 10.0.10011.16384
+ 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // ..Q..........?..
+ 0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x0c, 0x00, // .@.......?Q.....
+ 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, // .........?..@@..
+ 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, // ................
+ 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
+ 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, // ................
+ 0x00, 0x90, 0x0b, 0x00, 0x55, 0xa0, 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ....U...........
+ 0x01, 0x80, 0x00, 0x00, 0x00, 0x8c, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, // ........U.......
+ 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x01, 0x80, 0x01, 0x00, 0x55, 0x90, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ....U...........
+ 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x06, 0x80, 0x04, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U.......
+ 0x06, 0x80, 0x03, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
+ 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xd0, 0xa0, 0x06, 0x00, // ................
+ 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x09, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, // ................
+ 0x02, 0x80, 0x09, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, // ....U...........
+ 0xe9, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, // ................
+ 0x44, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0c, 0x80, 0x00, 0x00, // D...U...........
+ 0x44, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // D...............
+ 0x0c, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x44, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ........D.......
+ 0x0c, 0x80, 0x01, 0x00, 0xe4, 0x8b, 0x08, 0x00, 0x44, 0xa1, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, // ........D.......
+ 0x07, 0x80, 0x0b, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x1c, 0x80, 0x01, 0x00, // ................
+ 0xe4, 0x80, 0x08, 0x00, 0xe4, 0xa1, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ................
+ 0x04, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x23, 0x00, 0x00, 0x02, 0x02, 0x00, // ..........#.....
+ 0x0c, 0x80, 0x0a, 0x00, 0xb4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x01, 0x00, // ......B.........
+ 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0f, 0x80, 0x03, 0x00, // ................
+ 0x00, 0x80, 0x0c, 0x00, 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x03, 0x00, // ....@.....X.....
+ 0x0f, 0x80, 0x02, 0x00, 0xff, 0x81, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, // ................
+ 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xff, 0x80, 0x29, 0x00, // ..............).
+ 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x04, 0x00, // ........U.......
+ 0x0f, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, // ......*.........
+ 0x04, 0x80, 0x0c, 0x00, 0xaa, 0xa0, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x05, 0x00, // ......).........
+ 0xaa, 0x80, 0x42, 0x00, 0x00, 0x03, 0x05, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, // ..B.............
+ 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x06, 0x00, 0x0f, 0x80, 0x05, 0x00, 0x00, 0x80, 0x0c, 0x00, // ................
+ 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x05, 0x00, 0x0f, 0x80, 0x02, 0x00, // @.....X.........
+ 0xff, 0x81, 0x05, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x05, 0x00, // ................
+ 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x05, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x04, 0x00, // ................
+ 0x0f, 0x80, 0x05, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, // ..........*.....
+ 0x00, 0x02, 0x04, 0x00, 0x0f, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..........+...+.
+ 0x00, 0x00, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, // ..X.............
+ 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x09, 0x00, // ................
+ 0xaa, 0xa1, 0x09, 0x00, 0x60, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, // ....`...........
+ 0xe4, 0x8b, 0x02, 0x00, 0xf4, 0x81, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x00, 0x00, // ................
+ 0xa4, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x02, 0x00, // ......Z.........
+ 0xed, 0x80, 0x02, 0x00, 0xed, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
+ 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................
+ 0xff, 0x80, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, // ............U...
+ 0xaa, 0x80, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x55, 0x80, 0x0c, 0x00, // ............U...
+ 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, // ................
+ 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x09, 0x00, // U...........U...
+ 0xaa, 0xa1, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x02, 0x00, // ................
+ 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x0a, 0x00, // ....U...........
+ 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x12, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, // ................
+ 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x02, 0x00, // U...............
+ 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0x81, 0x07, 0x00, 0xe4, 0xa0, 0x04, 0x00, // ................
+ 0x00, 0x04, 0x03, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x06, 0x00, // ........U.......
+ 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, // ................
+ 0xff, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xaa, 0x81, 0x03, 0x00, // ..X.............
+ 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ...........
};
static const uint8_t fs_nanovg_fill_dx11[2298] =
{
diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.h b/3rdparty/bgfx/examples/common/nanovg/nanovg.h
index 1f55dcd3f70..692d1bd2be8 100644
--- a/3rdparty/bgfx/examples/common/nanovg/nanovg.h
+++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.h
@@ -598,8 +598,10 @@ struct NVGparams {
};
typedef struct NVGparams NVGparams;
-NVGcontext* nvgCreate(int edgeaa, unsigned char viewid);
-void nvgViewId(struct NVGcontext* ctx, unsigned char viewid);
+namespace bx { struct AllocatorI; }
+
+NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _allocator = NULL);
+void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId);
void nvgDelete(struct NVGcontext* ctx);
// Constructor and destructor, called by the render back-end.
diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp
index 3fd944178d0..1da34bd790f 100644
--- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp
+++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp
@@ -23,14 +23,13 @@
#define NVG_ANTIALIAS 1
#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
#include <math.h>
#include "nanovg.h"
#include <bgfx/bgfx.h>
#include <bx/bx.h>
+#include <bx/allocator.h>
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244); // warning C4244: '=' : conversion from '' to '', possible loss of data
@@ -113,6 +112,8 @@ namespace
struct GLNVGcontext
{
+ bx::AllocatorI* m_allocator;
+
bgfx::ProgramHandle prog;
bgfx::UniformHandle u_scissorMat;
bgfx::UniformHandle u_paintMat;
@@ -128,9 +129,10 @@ namespace
uint64_t state;
bgfx::TextureHandle th;
+ bgfx::TextureHandle texMissing;
bgfx::TransientVertexBuffer tvb;
- uint8_t viewid;
+ uint8_t m_viewId;
struct GLNVGtexture* textures;
float view[2];
@@ -176,7 +178,7 @@ namespace
{
int old = gl->ctextures;
gl->ctextures = (gl->ctextures == 0) ? 2 : gl->ctextures*2;
- gl->textures = (struct GLNVGtexture*)realloc(gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures);
+ gl->textures = (struct GLNVGtexture*)BX_REALLOC(gl->m_allocator, gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures);
memset(&gl->textures[old], 0xff, (gl->ctextures-old)*sizeof(struct GLNVGtexture) );
if (gl->textures == NULL)
@@ -263,6 +265,11 @@ namespace
, true
);
+ const bgfx::Memory* mem = bgfx::alloc(4*4*4);
+ uint32_t* bgra8 = (uint32_t*)mem->data;
+ memset(bgra8, 0, 4*4*4);
+ gl->texMissing = bgfx::createTexture2D(4, 4, 0, bgfx::TextureFormat::BGRA8, 0, mem);
+
gl->u_scissorMat = bgfx::createUniform("u_scissorMat", bgfx::UniformType::Mat3);
gl->u_paintMat = bgfx::createUniform("u_paintMat", bgfx::UniformType::Mat3);
gl->u_innerCol = bgfx::createUniform("u_innerCol", bgfx::UniformType::Vec4);
@@ -323,9 +330,20 @@ namespace
, 1
, NVG_TEXTURE_RGBA == _type ? bgfx::TextureFormat::RGBA8 : bgfx::TextureFormat::R8
, BGFX_TEXTURE_NONE
- , mem
);
+ if (NULL != mem)
+ {
+ bgfx::updateTexture2D(tex->id
+ , 0
+ , 0
+ , 0
+ , tex->width
+ , tex->height
+ , mem
+ );
+ }
+
return bgfx::isValid(tex->id) ? tex->id.idx : 0;
}
@@ -347,7 +365,12 @@ namespace
uint32_t bytesPerPixel = NVG_TEXTURE_RGBA == tex->type ? 4 : 1;
uint32_t pitch = tex->width * bytesPerPixel;
- bgfx::updateTexture2D(tex->id, 0, x, y, w, h
+ bgfx::updateTexture2D(tex->id
+ , 0
+ , x
+ , y
+ , w
+ , h
, bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
, pitch
);
@@ -444,8 +467,7 @@ namespace
memcpy(frag->extent, paint->extent, sizeof(frag->extent) );
frag->strokeMult = (width*0.5f + fringe*0.5f) / fringe;
- bgfx::TextureHandle invalid = BGFX_INVALID_HANDLE;
- gl->th = invalid;
+ gl->th = gl->texMissing;
if (paint->image != 0)
{
tex = glnvg__findTexture(gl, paint->image);
@@ -460,7 +482,7 @@ namespace
else
{
frag->type = NSVG_SHADER_FILLGRAD;
- frag->radius = paint->radius;
+ frag->radius = paint->radius;
frag->feather = paint->feather;
}
@@ -502,7 +524,7 @@ namespace
bgfx::setUniform(gl->u_extentRadius, &frag->extent[0]);
bgfx::setUniform(gl->u_params, &frag->feather);
- bgfx::TextureHandle handle = BGFX_INVALID_HANDLE;
+ bgfx::TextureHandle handle = gl->texMissing;
if (image != 0)
{
@@ -527,7 +549,7 @@ namespace
struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr;
gl->view[0] = (float)width;
gl->view[1] = (float)height;
- bgfx::setViewRect(gl->viewid, 0, 0, width, height);
+ bgfx::setViewRect(gl->m_viewId, 0, 0, width, height);
}
static void fan(uint32_t _start, uint32_t _count)
@@ -575,7 +597,7 @@ namespace
bgfx::setVertexBuffer(&gl->tvb);
bgfx::setTexture(0, gl->s_tex, gl->th);
fan(paths[i].fillOffset, paths[i].fillCount);
- bgfx::submit(gl->viewid, gl->prog);
+ bgfx::submit(gl->m_viewId, gl->prog);
}
}
@@ -599,7 +621,7 @@ namespace
);
bgfx::setVertexBuffer(&gl->tvb, paths[i].strokeOffset, paths[i].strokeCount);
bgfx::setTexture(0, gl->s_tex, gl->th);
- bgfx::submit(gl->viewid, gl->prog);
+ bgfx::submit(gl->m_viewId, gl->prog);
}
}
@@ -614,7 +636,7 @@ namespace
| BGFX_STENCIL_OP_FAIL_Z_ZERO
| BGFX_STENCIL_OP_PASS_Z_ZERO
);
- bgfx::submit(gl->viewid, gl->prog);
+ bgfx::submit(gl->m_viewId, gl->prog);
}
static void glnvg__convexFill(struct GLNVGcontext* gl, struct GLNVGcall* call)
@@ -631,7 +653,7 @@ namespace
bgfx::setVertexBuffer(&gl->tvb);
bgfx::setTexture(0, gl->s_tex, gl->th);
fan(paths[i].fillOffset, paths[i].fillCount);
- bgfx::submit(gl->viewid, gl->prog);
+ bgfx::submit(gl->m_viewId, gl->prog);
}
if (gl->edgeAntiAlias)
@@ -644,7 +666,7 @@ namespace
);
bgfx::setVertexBuffer(&gl->tvb, paths[i].strokeOffset, paths[i].strokeCount);
bgfx::setTexture(0, gl->s_tex, gl->th);
- bgfx::submit(gl->viewid, gl->prog);
+ bgfx::submit(gl->m_viewId, gl->prog);
}
}
}
@@ -664,7 +686,7 @@ namespace
);
bgfx::setVertexBuffer(&gl->tvb, paths[i].strokeOffset, paths[i].strokeCount);
bgfx::setTexture(0, gl->s_tex, gl->th);
- bgfx::submit(gl->viewid, gl->prog);
+ bgfx::submit(gl->m_viewId, gl->prog);
}
}
@@ -677,7 +699,7 @@ namespace
bgfx::setState(gl->state);
bgfx::setVertexBuffer(&gl->tvb, call->vertexOffset, call->vertexCount);
bgfx::setTexture(0, gl->s_tex, gl->th);
- bgfx::submit(gl->viewid, gl->prog);
+ bgfx::submit(gl->m_viewId, gl->prog);
}
}
@@ -770,7 +792,7 @@ namespace
if (gl->ncalls+1 > gl->ccalls)
{
gl->ccalls = gl->ccalls == 0 ? 32 : gl->ccalls * 2;
- gl->calls = (struct GLNVGcall*)realloc(gl->calls, sizeof(struct GLNVGcall) * gl->ccalls);
+ gl->calls = (struct GLNVGcall*)BX_REALLOC(gl->m_allocator, gl->calls, sizeof(struct GLNVGcall) * gl->ccalls);
}
ret = &gl->calls[gl->ncalls++];
memset(ret, 0, sizeof(struct GLNVGcall) );
@@ -783,7 +805,7 @@ namespace
if (gl->npaths + n > gl->cpaths) {
GLNVGpath* paths;
int cpaths = glnvg__maxi(gl->npaths + n, 128) + gl->cpaths / 2; // 1.5x Overallocate
- paths = (GLNVGpath*)realloc(gl->paths, sizeof(GLNVGpath) * cpaths);
+ paths = (GLNVGpath*)BX_REALLOC(gl->m_allocator, gl->paths, sizeof(GLNVGpath) * cpaths);
if (paths == NULL) return -1;
gl->paths = paths;
gl->cpaths = cpaths;
@@ -800,7 +822,7 @@ namespace
{
NVGvertex* verts;
int cverts = glnvg__maxi(gl->nverts + n, 4096) + gl->cverts/2; // 1.5x Overallocate
- verts = (NVGvertex*)realloc(gl->verts, sizeof(NVGvertex) * cverts);
+ verts = (NVGvertex*)BX_REALLOC(gl->m_allocator, gl->verts, sizeof(NVGvertex) * cverts);
if (verts == NULL) return -1;
gl->verts = verts;
gl->cverts = cverts;
@@ -816,7 +838,7 @@ namespace
if (gl->nuniforms+n > gl->cuniforms)
{
gl->cuniforms = gl->cuniforms == 0 ? glnvg__maxi(n, 32) : gl->cuniforms * 2;
- gl->uniforms = (unsigned char*)realloc(gl->uniforms, gl->cuniforms * structSize);
+ gl->uniforms = (unsigned char*)BX_REALLOC(gl->m_allocator, gl->uniforms, gl->cuniforms * structSize);
}
ret = gl->nuniforms * structSize;
gl->nuniforms += n;
@@ -976,6 +998,7 @@ namespace
}
bgfx::destroyProgram(gl->prog);
+ bgfx::destroyTexture(gl->texMissing);
bgfx::destroyUniform(gl->u_scissorMat);
bgfx::destroyUniform(gl->u_paintMat);
@@ -1001,18 +1024,32 @@ namespace
}
}
- free(gl->textures);
-
- free(gl);
+ BX_FREE(gl->m_allocator, gl->uniforms);
+ BX_FREE(gl->m_allocator, gl->verts);
+ BX_FREE(gl->m_allocator, gl->paths);
+ BX_FREE(gl->m_allocator, gl->calls);
+ BX_FREE(gl->m_allocator, gl->textures);
+ BX_FREE(gl->m_allocator, gl);
}
} // namespace
-NVGcontext* nvgCreate(int edgeaa, unsigned char viewid)
+NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _allocator)
{
+ if (NULL == _allocator)
+ {
+#if BX_CONFIG_ALLOCATOR_CRT
+ static bx::CrtAllocator allocator;
+ _allocator = &allocator;
+#else
+ BX_CHECK(false, "No allocator has been passed to nvgCreate(). Either specify a bx::AllocatorI instance or enable BX_CONFIG_ALLOCATOR_CRT directive.");
+ return NULL;
+#endif // BX_CONFIG_ALLOCATOR_CRT
+ }
+
struct NVGparams params;
struct NVGcontext* ctx = NULL;
- struct GLNVGcontext* gl = (struct GLNVGcontext*)malloc(sizeof(struct GLNVGcontext) );
+ struct GLNVGcontext* gl = (struct GLNVGcontext*)BX_ALLOC(_allocator, sizeof(struct GLNVGcontext) );
if (gl == NULL) goto error;
memset(gl, 0, sizeof(struct GLNVGcontext) );
@@ -1031,8 +1068,9 @@ NVGcontext* nvgCreate(int edgeaa, unsigned char viewid)
params.userPtr = gl;
params.edgeAntiAlias = edgeaa;
+ gl->m_allocator = _allocator;
gl->edgeAntiAlias = edgeaa;
- gl->viewid = uint8_t(viewid);
+ gl->m_viewId = uint8_t(_viewId);
ctx = nvgCreateInternal(&params);
if (ctx == NULL) goto error;
@@ -1049,11 +1087,11 @@ error:
return NULL;
}
-void nvgViewId(struct NVGcontext* ctx, unsigned char viewid)
+void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId)
{
struct NVGparams* params = nvgInternalParams(ctx);
struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr;
- gl->viewid = uint8_t(viewid);
+ gl->m_viewId = uint8_t(_viewId);
}
void nvgDelete(struct NVGcontext* ctx)
diff --git a/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h
index aeac0d14115..e744417898c 100644
--- a/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h
+++ b/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h
@@ -35,12 +35,12 @@ static const uint8_t vs_nanovg_fill_glsl[541] =
0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, // gl_Position = t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mpvar_1;.}...
};
-static const uint8_t vs_nanovg_fill_dx9[432] =
+static const uint8_t vs_nanovg_fill_dx9[436] =
{
0x56, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x02, 0x00, 0x0b, 0x75, 0x5f, 0x68, 0x61, 0x6c, // VSH........u_hal
0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x01, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, // fTexel.......u_v
- 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x80, 0x01, 0x00, // iewSize.........
- 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x2a, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x72, // .....*.CTAB....r
+ 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x84, 0x01, 0x00, // iewSize.........
+ 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x72, // .....+.CTAB....r
0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, // ................
0x91, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, // ...k...D........
0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, // ...P.......`....
@@ -50,20 +50,21 @@ static const uint8_t vs_nanovg_fill_dx9[432] =
0x77, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // wSize.vs_3_0.Mic
0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL
0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler
- 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0x51, // 9.29.952.3111..Q
- 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x00, // ..............?.
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, // ................
- 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, // ................
- 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, // ................
- 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x02, // ................
- 0x00, 0x03, 0xe0, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0xa0, 0x01, // ................
- 0x00, 0xe4, 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x02, // ................
- 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xd0, 0x90, 0x00, 0x00, 0xd0, 0x90, 0x04, // ................
- 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, // .........U......
- 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x04, // .............U..
- 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0x00, 0x81, 0x02, // ................
- 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0xe0, 0x02, 0x00, 0x64, 0xa0, 0x01, // .U...........d..
- 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ................
+ 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, // 10.0.10011.16384
+ 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0xbf, 0x00, // ...Q............
+ 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, // ..?.............
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, // ................
+ 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, // ................
+ 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, // ................
+ 0x00, 0x01, 0x80, 0x02, 0x00, 0x03, 0xe0, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x03, 0xe0, 0x01, // ................
+ 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xe4, 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, // ................
+ 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xd0, 0x90, 0x00, // ................
+ 0x00, 0xd0, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x55, 0x80, 0x00, // .............U..
+ 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, // ................
+ 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x00, 0xaa, 0x80, 0x00, // .U..............
+ 0x00, 0x00, 0x81, 0x02, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0xe0, 0x02, // .....U..........
+ 0x00, 0x64, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, // .d..............
+ 0xff, 0x00, 0x00, 0x00, // ....
};
static const uint8_t vs_nanovg_fill_dx11[577] =
{
diff --git a/3rdparty/bgfx/examples/common/shaderlib.sh b/3rdparty/bgfx/examples/common/shaderlib.sh
index da7bad784cb..a6a51199a1f 100644
--- a/3rdparty/bgfx/examples/common/shaderlib.sh
+++ b/3rdparty/bgfx/examples/common/shaderlib.sh
@@ -60,11 +60,11 @@ vec3 decodeNormalSphereMap(vec2 _encodedNormal)
return vec3(normalize(_encodedNormal.xy) * sqrt(1.0 - zz*zz), zz);
}
-// Reference:
-// Octahedron normal vector encoding
-// http://kriscg.blogspot.com/2014/04/octahedron-normal-vector-encoding.html
vec2 octahedronWrap(vec2 _val)
{
+ // Reference:
+ // Octahedron normal vector encoding
+ // http://kriscg.blogspot.com/2014/04/octahedron-normal-vector-encoding.html
return (1.0 - abs(_val.yx) )
* mix(vec2_splat(-1.0), vec2_splat(1.0), vec2(greaterThanEqual(_val.xy, vec2_splat(0.0) ) ) );
}
@@ -87,11 +87,11 @@ vec3 decodeNormalOctahedron(vec2 _encodedNormal)
return normalize(normal);
}
-// Reference:
-// RGB/XYZ Matrices
-// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
vec3 convertRGB2XYZ(vec3 _rgb)
{
+ // Reference:
+ // RGB/XYZ Matrices
+ // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
vec3 xyz;
xyz.x = dot(vec3(0.4124564, 0.3575761, 0.1804375), _rgb);
xyz.y = dot(vec3(0.2126729, 0.7151522, 0.0721750), _rgb);
@@ -246,6 +246,24 @@ vec4 toFilmic(vec4 _rgba)
return vec4(toFilmic(_rgba.xyz), _rgba.w);
}
+vec3 toAcesFilmic(vec3 _rgb)
+{
+ // Reference:
+ // ACES Filmic Tone Mapping Curve
+ // https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
+ float aa = 2.51f;
+ float bb = 0.03f;
+ float cc = 2.43f;
+ float dd = 0.59f;
+ float ee = 0.14f;
+ return saturate( (_rgb*(aa*_rgb + bb) )/(_rgb*(cc*_rgb + dd) + ee) );
+}
+
+vec4 toAcesFilmic(vec4 _rgba)
+{
+ return vec4(toAcesFilmic(_rgba.xyz), _rgba.w);
+}
+
vec3 luma(vec3 _rgb)
{
float yy = dot(vec3(0.2126729, 0.7151522, 0.0721750), _rgb);
diff --git a/3rdparty/bgfx/examples/runtime/font/kenney-icon-font.ttf b/3rdparty/bgfx/examples/runtime/font/kenney-icon-font.ttf
new file mode 100644
index 00000000000..9a3e406003c
--- /dev/null
+++ b/3rdparty/bgfx/examples/runtime/font/kenney-icon-font.ttf
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt b/3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt
index 9ad8778a00b..7c23f500c73 100644
--- a/3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt
+++ b/3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt
@@ -8,7 +8,6 @@ ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,
4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,
25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,
4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
-xinput,X360 Controller,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,platform:Windows,
6d0418c2000000000000504944564944,Logitech RumblePad 2 USB,platform:Windows,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,
36280100000000000000504944564944,OUYA Controller,platform:Windows,a:b0,b:b3,y:b2,x:b1,start:b14,guide:b15,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b8,dpleft:b10,dpdown:b9,dpright:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b12,righttrigger:b13,
4f0400b3000000000000504944564944,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Windows,
@@ -16,6 +15,18 @@ xinput,X360 Controller,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b
00f0f100000000000000504944564944,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Windows,
28040140000000000000504944564944,GamePad Pro USB,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,lefttrigger:b6,righttrigger:b7,
ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0,start:b5,back:b4,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b8,righttrigger:b9,
+8f0e0300000000000000504944564944,Piranha xtreme,platform:Windows,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,
+8f0e0d31000000000000504944564944,Multilaser JS071 USB,platform:Windows,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,
+10080300000000000000504944564944,PS2 USB,platform:Windows,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a4,righty:a2,lefttrigger:b4,righttrigger:b5,
+79000600000000000000504944564944,G-Shark GS-GP702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Windows,
+4b12014d000000000000504944564944,NYKO AIRFLO,a:b0,b:b1,x:b2,y:b3,back:b8,guide:b10,start:b9,leftstick:a0,rightstick:a2,leftshoulder:a3,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:h0.6,lefty:h0.12,rightx:h0.9,righty:h0.4,lefttrigger:b6,righttrigger:b7,platform:Windows,
+d6206dca000000000000504944564944,PowerA Pro Ex,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows,
+a3060cff000000000000504944564944,Saitek P2500,a:b2,b:b3,y:b1,x:b0,start:b4,guide:b10,back:b5,leftstick:b8,rightstick:b9,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,platform:Windows,
+8f0e0300000000000000504944564944,Trust GTX 28,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows,
+4f0415b3000000000000504944564944,Thrustmaster Dual Analog 3.2,platform:Windows,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,
+6f0e1e01000000000000504944564944,Rock Candy Gamepad for PS3,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,
+83056020000000000000504944564944,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Windows,
+10080100000000000000504944564944,PS1 USB,platform:Windows,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,
# OS X
0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
@@ -28,6 +39,13 @@ ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0
5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
891600000000000000fd000000000000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Mac OS X,
4f0400000000000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Mac OS X,
+8f0e0000000000000300000000000000,Piranha xtreme,platform:Mac OS X,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,
+0d0f0000000000004d00000000000000,HORI Gem Pad 3,platform:Mac OS X,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,
+79000000000000000600000000000000,G-Shark GP-702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Mac OS X,
+4f0400000000000015b3000000000000,Thrustmaster Dual Analog 3.2,platform:Mac OS X,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,
+AD1B00000000000001F9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,y:b9,x:b10,start:b6,guide:b8,back:b7,dpup:b2,dpleft:b0,dpdown:b3,dpright:b1,leftx:a0,lefty:a1,lefttrigger:b12,righttrigger:,leftshoulder:b11,platform:Mac OS X,
+83050000000000006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Mac OS X,
# Linux
0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
@@ -39,6 +57,7 @@ ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0
030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
030000004c050000c405000011010000,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,platform:Linux,
+030000006f0e00003001000001010000,EA Sports PS3 Controller,platform:Linux,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,
03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
@@ -73,3 +92,17 @@ ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0
03000000666600000488000000010000,Super Joy Box 5 Pro,platform:Linux,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,dpup:b12,dpleft:b15,dpdown:b14,dpright:b13,
05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,platform:Linux,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,
05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,platform:Linux,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,
+030000008916000001fd000024010000,Razer Onza Classic Edition,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:b11,dpdown:b14,dpright:b12,dpup:b13,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,
+030000005e040000d102000001010000,Microsoft X-Box One pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,
+03000000790000001100000010010000,RetroLink Saturn Classic Controller,platform:Linux,x:b3,a:b0,b:b1,y:b4,back:b5,guide:b2,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,
+050000007e0500003003000001000000,Nintendo Wii U Pro Controller,platform:Linux,a:b0,b:b1,x:b3,y:b2,back:b8,start:b9,guide:b10,leftshoulder:b4,rightshoulder:b5,leftstick:b11,rightstick:b12,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16,
+030000005e0400008e02000004010000,Microsoft X-Box 360 pad,platform:Linux,a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,guide:b8,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,
+030000000d0f00002200000011010000,HORI CO.,LTD. REAL ARCADE Pro.V3,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,
+030000000d0f00001000000011010000,HORI CO.,LTD. FIGHTING STICK 3,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7
+03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,
+0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),platform:Linux,a:b0,b:b1,x:b2,y:b3,start:b7,back:b6,guide:b8,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,lefttrigger:a5,righttrigger:a4,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a2,righty:a3,
+03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Linux,
+030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,
+030000006f0e00001304000000010000,Generic X-Box pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:a0,rightstick:a3,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,
+03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,
+03000000830500006020000010010000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Linux,
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.bin
index 0b6b5ca926c..e9ac1a71c49 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin
index 91bf18c2ea8..e599c4ec016 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin
index c928ae4e8f1..c2ac4161f46 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin
index c97ca5675b0..acb5c01247e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin
index 720d6b8dc55..3430e96d811 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin
index 9f95aece5c2..6c4859be087 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin
index f925d7d809b..95467349adc 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin
index d4834651b14..d1612f8ca11 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin
index c4eacfeab5f..f6b2ac6587d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin
index 0d561a3cc8c..52ac4285db6 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin
index 28db96648ca..221a4278dd8 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin
index 871b1ffeeeb..03b37762125 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin
index 245584b6255..11f1c23b014 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin
index 77396aed05d..19d9bba4d4a 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin
index 1ee9d986f8e..9581dddcd64 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin
index b45bb02343e..8746b286f44 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
index 74dbfb1da69..9957e3b8588 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
index a46422934f3..3c72697a9d3 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin
index 7f9f9ea632d..834b235eebe 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin
index 546505bb112..0ae83c419f1 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin
index 5b77da87cc3..87536cda4d4 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin
index faad3b63666..5129fdb6b0b 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
index 4cdde93ea09..08a5970da44 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
index 99228d720c5..39d3bff0226 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin
index 25fddf2151b..0991b66851f 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin
index 44fd0cfd999..bd64ce32deb 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin
index 071e3a6f3a4..5f675f24a27 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin
index ba7432d9619..0f69b9b3764 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.bin
index a074cd8a3e2..2cc6dbea34d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.bin
index 57876856254..9dadf5e9261 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.bin
index bdffeb9c076..5bfd5497f0b 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.bin
index cc13a509ba8..fc355b76371 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.bin
index 4cac33773e7..33a85bb2955 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin
index bdffeb9c076..5bfd5497f0b 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.bin
index c8cbf705ea2..f9f1020c1e6 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.bin
index 5c16613bad5..78cbbc32f25 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.bin
index f426518b036..4d331a3cab1 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.bin
index 38c67736508..1670d6734f8 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.bin
index f2be253e8b7..e5ca082614c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin
index 0fe106a0adb..b73df0e1d7f 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.bin
index 7c2c50723bd..7553b3acc94 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.bin
index 0598ce6cc4f..d02ad5de9e4 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin
index f9c5bdf5f56..993845cb75b 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin
index 873b11cf560..3a3ecaba313 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin
index a68ed6cf51d..2e49131b0a3 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.bin
index bdffeb9c076..5bfd5497f0b 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.bin
index 09e8453a1d6..ac5cc0d0512 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.bin
index 38475da682f..05269c3a821 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.bin
index b041df0bda7..29c0b1608bd 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin
index 6e7587839de..b209ea65d9d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin
index 332cd07bc4a..4c5d7f1b374 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin
index 082338cd294..ff4c6e01b17 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.bin
index c52033f7e3b..c20337adffc 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.bin
index d3cd94464fb..64a2ea353d2 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin
index 1759b12105b..b48ca9a9d75 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin
index d0c8760806a..99f5564ce4d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin
index 20951048b0c..420080db2fd 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin
index af417ecab7a..2b80ccad6c3 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin
index 4e7732f4fca..3bbfea99ae7 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin
index cf1fc2e04a7..c9d81f6fa64 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin
index 292a4b08b79..308f93ef2e3 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin
index 77938acdc89..3de4dcbce87 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin
index 975f1e5efed..c53e8814a34 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin
index 72026a33e4c..d29c6e8c1ed 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin
index 5617f4386b0..ca069354ca4 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin
index 5cea5e1128a..c316724a908 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin
index d033bd26429..bef6549d95b 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin
index 4ed6a979733..55bce42f02a 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin
index 0a87a3d68dc..7427157c5fa 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin
index c5c2fe28bd4..a8c173e3c39 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
index 695b9378a8d..984458101ee 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
index c226b1e4713..e96824aae10 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin
index cdc2cf41abb..bf00e8523f3 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin
index d969966ce64..ac96c99da43 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin
index 9ef4d3962f9..0e69a3950ac 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin
index 87e13f45af2..a1ce662b545 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
index aeaa4e73b9e..80befb85a01 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
index 8866fbbb2d6..f0bdfd66f7b 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin
index bb19f6244d2..856c659ffe6 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin
index 3b34c1191f9..769c938165e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin
index e9210b80d52..35f6b45a29d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin
index 8eeb1b3e105..4a9dd81714e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin
index 4a693345ca4..605ede3bb29 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin
index 1c98ebebaa9..e73a81647e3 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin
index f146f09bfc0..227ada1b7b9 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin
index 89745b960ce..a83254c5e89 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin
index 4cac33773e7..33a85bb2955 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin
index b4f15210552..6fa413cd90c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin
index f2b3c657c04..23cba5789f1 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin
index e9210b80d52..35f6b45a29d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin
index 8eeb1b3e105..4a9dd81714e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin
index d2b3c50f5ec..3502c300df9 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin
index 3b34c1191f9..769c938165e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin
index f35fe6e1dfd..7528dcbf854 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin
index 57089f27fe2..e240cc56e5f 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin
index 49110e0ed14..19ca642da9a 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin
index 7752be6658d..e4fa04e2975 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin
index b201b42a274..a3163370c84 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin
index 57089f27fe2..e240cc56e5f 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin
index 49110e0ed14..19ca642da9a 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin
index 7752be6658d..e4fa04e2975 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin
index 4ba5d987404..29eab256097 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin
index 95a432fd6e7..3b5a8f31a62 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin
index 6e349468748..40f240d9f77 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin
index a299cf2199c..fe9b49ff047 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin
index 4cac33773e7..33a85bb2955 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin
index 216041c92be..1c09e0732be 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.bin
index 4ea4fa1d0b6..5e7db6345db 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin
index 764e661c6e9..e244ed7a481 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.bin
index 1759b12105b..b48ca9a9d75 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin
index 5c8c5a455f5..25b96b2653f 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.bin
index 1759b12105b..b48ca9a9d75 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin
index 812a7288250..c11e9833063 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin
index 3b34c1191f9..769c938165e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.bin
index 4cac33773e7..33a85bb2955 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin
index 00b56862be3..c2d78611cd0 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.bin
index a40cefb711a..f2e470f0574 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.bin
index 9b583ab3ef4..c67c50a41d1 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.bin
index abc86d23a09..d489147527a 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.bin
index 97e41b8eee1..77ee54087de 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin
index 8793fcf84de..2ca54ab6730 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin
index 905e8dd5d7a..f6316a80f0e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin
index 8b22edabe2b..c3e8cd2f156 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.bin
index ae10af6fa40..4c80f4cad6d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.bin
index 19f743864cb..fc28518a841 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.bin
index 5b24007c6dc..91c7a717fe5 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.bin
index 6bed4a49eb9..fcfb16e0d0d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin
index 6bed4a49eb9..fcfb16e0d0d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.bin
index ae10af6fa40..4c80f4cad6d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.bin
index aafc58d61d7..db3143a6259 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.bin
index f8a154140aa..7bafd238112 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin
index c1734e3e3fc..56f1ecb2e44 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin
index a4e8c3d11e9..4218e8ab377 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin
index 92fb53dd59b..c0e84000a3a 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.bin
index 9cc463534d9..1334941f88a 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.bin
index 62f5bd31dae..242f27e7b1f 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.bin
index 0bd10c7a53f..9f612d35860 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.bin
index fa1d3b9a442..d727140eef3 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.bin
index 63ec02a3531..9db127f1b78 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin
index 4550c08d137..63a27d6a014 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin
index 93a692801b5..afd241b6c2e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin
index 6b819879e75..5b190835b30 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin
index 3bc8a261ee5..4953a46cb26 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin
index 9e7c86f7bb1..3fe61829886 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin
index 2c6c09c36c8..fb516014651 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin
index 7a0105a308d..37de03aa63e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin
index 4550c08d137..63a27d6a014 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin
index 17606423b6c..056267dd34d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin
index 3e5827745c0..46332ef6918 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin
index 329980ae388..0d28593e06a 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin
index a04a6320173..96799c4e15d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin
index 347b4ed021b..c2695fe4a16 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin
index f948ab9105f..305be162e1d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin
index ff9efe36483..5875aa635d7 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin
index 4550c08d137..63a27d6a014 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin
index 7571a1e53fa..2b3dd0ebae0 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin
index e632b911c39..c97d58d5a67 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.bin
index f5b0d896104..d33c32f16d0 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.bin
index 4550c08d137..63a27d6a014 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin
index 3bd185477f5..94b26f0a41d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.bin
index 4550c08d137..63a27d6a014 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin
index bedf096177e..0c0fe9fffee 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.bin
index a299604962c..fe8592c138d 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin
index 7257af2e87f..fcdfc2e180c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.bin
index 9e69b0bb4a4..71f4167608c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.bin
index 1c043f0ad5c..155eea03f6c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin
index 63ec02a3531..9db127f1b78 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin
index e594526cf19..df53debb5b1 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin
index 51ae8f2dbaf..2ae88a47fff 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin
index 72ed5111aee..700694d399e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin
index 7c77f0cbbfe..525a27cdd51 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin
index 789141dcccc..04c38666671 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin
index 3c1d07e15f6..27d8231f863 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin
index 1503d413ab3..4ca43066c34 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin
index f79e214b2da..4b3fea74139 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin
index c6f6593ea1e..7c5095f0e29 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin
index 74c0c1cf2a9..b77c2c824c4 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin
index c0e05951bdd..3988caee216 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin
index 19062f01b8c..9a8ae99224e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin
index 6187725d9f2..1965c493afa 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin
index 133e398538c..31b8e22ba35 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin
index 422bf35ec8e..c867113fd8c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin
index 9f78cbeee15..c78a27741db 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin
index 5ee79f73a28..85cebb56f07 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
index 4bb6fa06e51..93c5b80ef33 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
index d0be094575a..4769169ac7f 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin
index 44a131f69ad..18a43e1ea27 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin
index ccababe2e1b..f42d12496d6 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin
index 74ff8b8dd26..50e5c4f14cb 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin
index 754e424ea12..3e96ec50a4c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
index 53f2ea31f22..df85bd9510c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
index 0b0a1bbbf16..2d63ad15e45 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin
index ad331bd4ffd..772ec28f6ed 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin
index c50ce9cc452..d8509532b15 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin
index d6bdeb0b6c9..3997cd62a98 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin
index c1c6b516290..a366ac46963 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin
index db9d665275d..0fd472eda28 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin
index c50ce9cc452..d8509532b15 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin
index 227b76c4fa2..5844d74493e 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin
index d6bdeb0b6c9..384de3f5387 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin
index 32f69e5aed2..1bfc2361d5c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin
index d77b34792fa..f8ae5bc9b81 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin
index 4f66a07bb0f..f5a580f1289 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin
index 7249ac3fc01..1e7a4d25acd 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin
index 57a0637840f..3c41f4ed3f7 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin
index daa9d7bc412..b930d047c81 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin
index 5213127e2b3..5b5e123eaec 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin
index 0728fd38ac9..9e5441e5839 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin
index 40a6fe35f34..62a4fab7411 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin
index 27694944113..7ae79a1339c 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin
index 68de56248ff..52a0b821316 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin
index e9d07c376e4..08808de87a7 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin
index eceb44fdf0f..3218ab5f3cc 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin
index d7893ba4369..0f8e094c7e9 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin
index 3638832c180..797ec0bcdbe 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin
index 957f309bc5e..c649bf07a24 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin
index 03143cba754..5f0c1c7c365 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
index 202b3b76236..5b07162b001 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
index 492e6e805b1..34d5c091ce2 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin
index 81ea89086ae..53f13abd5c8 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin
index 46a9e14444f..3ba96599cd4 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin
index 5af575e1be6..d1d4d641bdb 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin
index 17290531064..5b675445db3 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
index 79058cad0d7..cbcecf1feb4 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
index 5915c930f4e..a2aeda4ead7 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin
index 93b5a2a0bb2..fd9d3902609 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin
index f8fa7a5d8b6..f1180dceb51 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin
index 6148b430945..960eba1e085 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin
index d59593b94a3..a592392cdd6 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin
index 6602f5e43e0..acda8d5f64f 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin
index f8fa7a5d8b6..f1180dceb51 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin
index 8e0fb26cd2b..a036a3a6254 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin
index 6148b430945..7286ee6bf99 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin
index ccec78ba002..4d4b4469ace 100644
--- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin
+++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin
Binary files differ
diff --git a/3rdparty/bgfx/include/bgfx/bgfx.h b/3rdparty/bgfx/include/bgfx/bgfx.h
index 16c5e46a6e7..e30d7417158 100644
--- a/3rdparty/bgfx/include/bgfx/bgfx.h
+++ b/3rdparty/bgfx/include/bgfx/bgfx.h
@@ -532,6 +532,14 @@ namespace bgfx
bool cubeMap; //!< Texture is cubemap.
};
+ ///
+ struct Attachment
+ {
+ TextureHandle handle; //!< Texture handle.
+ uint16_t mip; //!< Mip level.
+ uint16_t layer; //!< Cubemap side or depth layer/slice.
+ };
+
/// Transform data.
///
/// @attention C99 equivalent is `bgfx_transform_t`.
@@ -1362,8 +1370,8 @@ namespace bgfx
/// Update Cube texture.
///
/// @param[in] _handle Texture handle.
- /// @param[in] _side Cubemap side, where 0 is +X, 1 is -X, 2 is +Y, 3 is
- /// -Y, 4 is +Z, and 5 is -Z.
+ /// @param[in] _side Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
+ /// where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
///
/// +----------+
/// |-z 2|
@@ -1470,6 +1478,17 @@ namespace bgfx
///
FrameBufferHandle createFrameBuffer(uint8_t _num, const TextureHandle* _handles, bool _destroyTextures = false);
+ /// Create frame buffer.
+ ///
+ /// @param[in] _num Number of texture attachments.
+ /// @param[in] _attachment Attachment info. See: `Attachment`.
+ /// @param[in] _destroyTextures If true, textures will be destroyed when
+ /// frame buffer is destroyed.
+ ///
+ /// @attention C99 equivalent is `bgfx_create_frame_buffer_from_handles`.
+ ///
+ FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures = false);
+
/// Create frame buffer for multiple window rendering.
///
/// @param[in] _nwh OS' target native window handle.
diff --git a/3rdparty/bgfx/include/bgfx/bgfxdefines.h b/3rdparty/bgfx/include/bgfx/bgfxdefines.h
index d0e4db91bce..b80622743a6 100644
--- a/3rdparty/bgfx/include/bgfx/bgfxdefines.h
+++ b/3rdparty/bgfx/include/bgfx/bgfxdefines.h
@@ -6,7 +6,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
-#define BGFX_API_VERSION UINT32_C(2)
+#define BGFX_API_VERSION UINT32_C(9)
///
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
@@ -300,7 +300,7 @@
#define BGFX_TEXTURE_RT_MSAA_X16 UINT32_C(0x00005000) //!<
#define BGFX_TEXTURE_RT_MSAA_SHIFT 12 //!<
#define BGFX_TEXTURE_RT_MSAA_MASK UINT32_C(0x00007000) //!<
-#define BGFX_TEXTURE_RT_BUFFER_ONLY UINT32_C(0x00008000) //!<
+#define BGFX_TEXTURE_RT_WRITE_ONLY UINT32_C(0x00008000) //!<
#define BGFX_TEXTURE_RT_MASK UINT32_C(0x0000f000) //!<
#define BGFX_TEXTURE_COMPARE_LESS UINT32_C(0x00010000) //!<
#define BGFX_TEXTURE_COMPARE_LEQUAL UINT32_C(0x00020000) //!<
@@ -422,4 +422,12 @@
#define BGFX_HMD_DEVICE_RESOLUTION UINT8_C(0x01) //!< Has HMD native resolution.
#define BGFX_HMD_RENDERING UINT8_C(0x02) //!< Rendering to HMD.
+///
+#define BGFX_CUBE_MAP_POSITIVE_X UINT8_C(0x00) //!< Cubemap +x.
+#define BGFX_CUBE_MAP_NEGATIVE_X UINT8_C(0x01) //!< Cubemap -x.
+#define BGFX_CUBE_MAP_POSITIVE_Y UINT8_C(0x02) //!< Cubemap +y.
+#define BGFX_CUBE_MAP_NEGATIVE_Y UINT8_C(0x03) //!< Cubemap -y.
+#define BGFX_CUBE_MAP_POSITIVE_Z UINT8_C(0x04) //!< Cubemap +z.
+#define BGFX_CUBE_MAP_NEGATIVE_Z UINT8_C(0x05) //!< Cubemap -z.
+
#endif // BGFX_DEFINES_H_HEADER_GUARD
diff --git a/3rdparty/bgfx/include/bgfx/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/bgfxplatform.h
index b9107a26e39..52b330112d5 100644
--- a/3rdparty/bgfx/include/bgfx/bgfxplatform.h
+++ b/3rdparty/bgfx/include/bgfx/bgfxplatform.h
@@ -11,6 +11,7 @@
// necessary to use this header in conjunction with creating windows.
#include <bx/platform.h>
+#include <bgfx/bgfx.h>
namespace bgfx
{
@@ -45,10 +46,10 @@ namespace bgfx
///
struct PlatformData
{
- void* ndt; //!< Native display type
- void* nwh; //!< Native window handle
- void* context; //!< GL context, or D3D device
- void* backBuffer; //!< GL backbuffer, or D3D render target view
+ void* ndt; //!< Native display type.
+ void* nwh; //!< Native window handle.
+ void* context; //!< GL context, or D3D device.
+ void* backBuffer; //!< GL backbuffer, or D3D render target view.
void* backBufferDS; //!< Backbuffer depth/stencil.
};
@@ -58,7 +59,73 @@ namespace bgfx
///
/// @attention C99 equivalent is `bgfx_set_platform_data`.
///
- void setPlatformData(const PlatformData& _hooks);
+ void setPlatformData(const PlatformData& _data);
+
+ /// Internal data.
+ ///
+ /// @attention C99 equivalent is `bgfx_internal_data_t`.
+ ///
+ struct InternalData
+ {
+ const struct Caps* caps; //!< Renderer capabilities.
+ void* context; //!< GL context, or D3D device.
+ };
+
+ /// Get internal data for interop.
+ ///
+ /// @attention It's expected you understand some bgfx internals before you
+ /// use this call.
+ ///
+ /// @warning Must be called only on render thread.
+ ///
+ /// @attention C99 equivalent is `bgfx_get_internal_data`.
+ ///
+ const InternalData* getInternalData();
+
+ /// Override internal texture with externally created texture. Previously
+ /// created internal texture will released.
+ ///
+ /// @attention It's expected you understand some bgfx internals before you
+ /// use this call.
+ ///
+ /// @param[in] _handle Texture handle.
+ /// @param[in] _ptr Native API pointer to texture.
+ ///
+ /// @returns Native API pointer to texture. If result is 0, texture is not created yet from the
+ /// main thread.
+ ///
+ /// @warning Must be called only on render thread.
+ ///
+ /// @attention C99 equivalent is `bgfx_override_internal_texture_ptr`.
+ ///
+ uintptr_t overrideInternal(TextureHandle _handle, uintptr_t _ptr);
+
+ /// Override internal texture by creating new texture. Previously created
+ /// internal texture will released.
+ ///
+ /// @attention It's expected you understand some bgfx internals before you
+ /// use this call.
+ ///
+ /// @param[in] _handle Texture handle.
+ /// @param[in] _width Width.
+ /// @param[in] _height Height.
+ /// @param[in] _numMips Number of mip-maps.
+ /// @param[in] _format Texture format. See: `TextureFormat::Enum`.
+ /// @param[in] _flags Default texture sampling mode is linear, and wrap mode
+ /// is repeat.
+ /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
+ /// mode.
+ /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
+ /// sampling.
+ ///
+ /// @returns Native API pointer to texture. If result is 0, texture is not created yet from the
+ /// main thread.
+ ///
+ /// @warning Must be called only on render thread.
+ ///
+ /// @attention C99 equivalent is `bgfx_override_internal_texture`.
+ ///
+ uintptr_t overrideInternal(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE);
} // namespace bgfx
@@ -212,6 +279,9 @@ namespace bgfx
# elif BX_PLATFORM_WINDOWS
pd.ndt = NULL;
pd.nwh = wmi.info.win.window;
+# elif BX_PLATFORM_STEAMLINK
+ pd.ndt = wmi.info.vivante.display;
+ pd.nwh = wmi.info.vivante.window;
# endif // BX_PLATFORM_
pd.context = NULL;
pd.backBuffer = NULL;
diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfx.h b/3rdparty/bgfx/include/bgfx/c99/bgfx.h
index a3b31ee9ed3..cba442ef0be 100644
--- a/3rdparty/bgfx/include/bgfx/c99/bgfx.h
+++ b/3rdparty/bgfx/include/bgfx/c99/bgfx.h
@@ -40,7 +40,6 @@
#endif // defined(__cplusplus)
#include <bgfx/bgfxdefines.h>
-#include <bgfx/c99/bgfxplatform.h>
typedef enum bgfx_renderer_type
{
@@ -351,6 +350,15 @@ typedef struct bgfx_texture_info
} bgfx_texture_info_t;
/**/
+typedef struct bgfx_attachment
+{
+ bgfx_texture_handle_t handle;
+ uint16_t mip;
+ uint16_t layer;
+
+} bgfx_attachment_t;
+
+/**/
typedef struct bgfx_caps_gpu
{
uint16_t vendorId;
@@ -430,140 +438,6 @@ typedef struct bgfx_allocator_vtbl
} bgfx_allocator_vtbl_t;
/**/
-typedef struct bgfx_interface_vtbl
-{
- bgfx_render_frame_t (*render_frame)();
- void (*set_platform_data)(bgfx_platform_data_t* _pd);
- void (*vertex_decl_begin)(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer);
- void (*vertex_decl_add)(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
- void (*vertex_decl_skip)(bgfx_vertex_decl_t* _decl, uint8_t _num);
- void (*vertex_decl_end)(bgfx_vertex_decl_t* _decl);
- void (*vertex_pack)(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, void* _data, uint32_t _index);
- void (*vertex_unpack)(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, const void* _data, uint32_t _index);
- void (*vertex_convert)(const bgfx_vertex_decl_t* _destDecl, void* _destData, const bgfx_vertex_decl_t* _srcDecl, const void* _srcData, uint32_t _num);
- uint16_t (*weld_vertices)(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon);
- void (*image_swizzle_bgra8)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
- void (*image_rgba8_downsample_2x2)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
- uint8_t (*get_supported_renderers)(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]);
- const char* (*get_renderer_name)(bgfx_renderer_type_t _type);
- bool (*init)(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator);
- void (*shutdown)();
- void (*reset)(uint32_t _width, uint32_t _height, uint32_t _flags);
- uint32_t (*frame)();
- bgfx_renderer_type_t (*get_renderer_type)();
- const bgfx_caps_t* (*get_caps)();
- const bgfx_hmd_t* (*get_hmd)();
- const bgfx_stats_t* (*get_stats)();
- const bgfx_memory_t* (*alloc)(uint32_t _size);
- const bgfx_memory_t* (*copy)(const void* _data, uint32_t _size);
- const bgfx_memory_t* (*make_ref)(const void* _data, uint32_t _size);
- const bgfx_memory_t* (*make_ref_release)(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData);
- void (*set_debug)(uint32_t _debug);
- void (*dbg_text_clear)(uint8_t _attr, bool _small);
- void (*dbg_text_printf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
- void (*dbg_text_image)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch);
- bgfx_index_buffer_handle_t (*create_index_buffer)(const bgfx_memory_t* _mem, uint16_t _flags);
- void (*destroy_index_buffer)(bgfx_index_buffer_handle_t _handle);
- bgfx_vertex_buffer_handle_t (*create_vertex_buffer)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
- void (*destroy_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle);
- bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer)(uint32_t _num, uint16_t _flags);
- bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer_mem)(const bgfx_memory_t* _mem, uint16_t _flags);
- void (*update_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem);
- void (*destroy_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle);
- bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
- bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
- void (*update_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem);
- void (*destroy_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle);
- bool (*check_avail_transient_index_buffer)(uint32_t _num);
- bool (*check_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl);
- bool (*check_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride);
- bool (*check_avail_transient_buffers)(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices);
- void (*alloc_transient_index_buffer)(bgfx_transient_index_buffer_t* _tib, uint32_t _num);
- void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl);
- bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices);
- const bgfx_instance_data_buffer_t* (*alloc_instance_data_buffer)(uint32_t _num, uint16_t _stride);
- bgfx_indirect_buffer_handle_t (*create_indirect_buffer)(uint32_t _num);
- void (*destroy_indirect_buffer)(bgfx_indirect_buffer_handle_t _handle);
- bgfx_shader_handle_t (*create_shader)(const bgfx_memory_t* _mem);
- uint16_t (*get_shader_uniforms)(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max);
- void (*destroy_shader)(bgfx_shader_handle_t _handle);
- bgfx_program_handle_t (*create_program)(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
- bgfx_program_handle_t (*create_compute_program)(bgfx_shader_handle_t _csh, bool _destroyShaders);
- void (*destroy_program)(bgfx_program_handle_t _handle);
- void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format);
- bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info);
- bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
- bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
- bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
- bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
- void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
- void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem);
- void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
- void (*destroy_texture)(bgfx_texture_handle_t _handle);
- bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags);
- bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags);
- bgfx_frame_buffer_handle_t (*create_frame_buffer_from_handles)(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures);
- bgfx_frame_buffer_handle_t (*create_frame_buffer_from_nwh)(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat);
- void (*destroy_frame_buffer)(bgfx_frame_buffer_handle_t _handle);
- bgfx_uniform_handle_t (*create_uniform)(const char* _name, bgfx_uniform_type_t _type, uint16_t _num);
- void (*destroy_uniform)(bgfx_uniform_handle_t _handle);
- bgfx_occlusion_query_handle_t (*create_occlusion_query)();
- bgfx_occlusion_query_result_t (*get_result)(bgfx_occlusion_query_handle_t _handle);
- void (*destroy_occlusion_query)(bgfx_occlusion_query_handle_t _handle);
- void (*set_palette_color)(uint8_t _index, const float _rgba[4]);
- void (*set_view_name)(uint8_t _id, const char* _name);
- void (*set_view_rect)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
- void (*set_view_scissor)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
- void (*set_view_clear)(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil);
- void (*set_view_clear_mrt)(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7);
- void (*set_view_seq)(uint8_t _id, bool _enabled);
- void (*set_view_frame_buffer)(uint8_t _id, bgfx_frame_buffer_handle_t _handle);
- void (*set_view_transform)(uint8_t _id, const void* _view, const void* _proj);
- void (*set_view_transform_stereo)(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR);
- void (*set_view_remap)(uint8_t _id, uint8_t _num, const void* _remap);
- void (*set_marker)(const char* _marker);
- void (*set_state)(uint64_t _state, uint32_t _rgba);
- void (*set_condition)(bgfx_occlusion_query_handle_t _handle, bool _visible);
- void (*set_stencil)(uint32_t _fstencil, uint32_t _bstencil);
- uint16_t (*set_scissor)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
- void (*set_scissor_cached)(uint16_t _cache);
- uint32_t (*set_transform)(const void* _mtx, uint16_t _num);
- uint32_t (*alloc_transform)(bgfx_transform_t* _transform, uint16_t _num);
- void (*set_transform_cached)(uint32_t _cache, uint16_t _num);
- void (*set_uniform)(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num);
- void (*set_index_buffer)(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
- void (*set_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
- void (*set_transient_index_buffer)(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices);
- void (*set_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
- void (*set_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices);
- void (*set_transient_vertex_buffer)(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices);
- void (*set_instance_data_buffer)(const bgfx_instance_data_buffer_t* _idb, uint32_t _num);
- void (*set_instance_data_from_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
- void (*set_instance_data_from_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
- void (*set_texture)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
- void (*set_texture_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, uint32_t _flags);
- uint32_t (*touch)(uint8_t _id);
- uint32_t (*submit)(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth);
- uint32_t (*submit_occlusion_query)(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth);
- uint32_t (*submit_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth);
- void (*set_image)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
- void (*set_image_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format);
- void (*set_compute_index_buffer)(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
- void (*set_compute_vertex_buffer)(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
- void (*set_compute_dynamic_index_buffer)(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
- void (*set_compute_dynamic_vertex_buffer)(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
- void (*set_compute_indirect_buffer)(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
- uint32_t (*dispatch)(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags);
- uint32_t (*dispatch_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags);
- void (*discard)();
- void (*blit)(uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth);
- void (*save_screen_shot)(const char* _filePath);
-
-} bgfx_interface_vtbl_t;
-
-typedef bgfx_interface_vtbl_t* (*PFN_BGFX_GET_INTERFACE)(uint32_t _version);
-
-/**/
BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer);
/**/
@@ -774,7 +648,7 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width,
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags);
/**/
-BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures);
+BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures);
/**/
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat);
diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h
index ff2125f18c4..61ff57d2b29 100644
--- a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h
+++ b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h
@@ -13,6 +13,7 @@
// necessary to use this header in conjunction with creating windows.
#include <bx/platform.h>
+#include <bgfx/c99/bgfxplatform.h>
typedef enum bgfx_render_frame
{
@@ -41,6 +42,160 @@ typedef struct bgfx_platform_data
} bgfx_platform_data_t;
-BGFX_C_API void bgfx_set_platform_data(bgfx_platform_data_t* _pd);
+/**/
+BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t* _data);
+
+typedef struct bgfx_internal_data
+{
+ const struct bgfx_caps* caps;
+ void* context;
+
+} bgfx_internal_data_t;
+
+/**/
+BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data();
+
+/**/
+BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr);
+
+/**/
+BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
+
+/**/
+typedef struct bgfx_interface_vtbl
+{
+ bgfx_render_frame_t (*render_frame)();
+ void (*set_platform_data)(const bgfx_platform_data_t* _data);
+ const bgfx_internal_data_t* (*get_internal_data)();
+ uintptr_t (*override_internal_texture_ptr)(bgfx_texture_handle_t _handle, uintptr_t _ptr);
+ uintptr_t (*override_internal_texture)(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
+ void (*vertex_decl_begin)(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer);
+ void (*vertex_decl_add)(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
+ void (*vertex_decl_skip)(bgfx_vertex_decl_t* _decl, uint8_t _num);
+ void (*vertex_decl_end)(bgfx_vertex_decl_t* _decl);
+ void (*vertex_pack)(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, void* _data, uint32_t _index);
+ void (*vertex_unpack)(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, const void* _data, uint32_t _index);
+ void (*vertex_convert)(const bgfx_vertex_decl_t* _destDecl, void* _destData, const bgfx_vertex_decl_t* _srcDecl, const void* _srcData, uint32_t _num);
+ uint16_t (*weld_vertices)(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon);
+ void (*image_swizzle_bgra8)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
+ void (*image_rgba8_downsample_2x2)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
+ uint8_t (*get_supported_renderers)(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]);
+ const char* (*get_renderer_name)(bgfx_renderer_type_t _type);
+ bool (*init)(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator);
+ void (*shutdown)();
+ void (*reset)(uint32_t _width, uint32_t _height, uint32_t _flags);
+ uint32_t (*frame)();
+ bgfx_renderer_type_t (*get_renderer_type)();
+ const bgfx_caps_t* (*get_caps)();
+ const bgfx_hmd_t* (*get_hmd)();
+ const bgfx_stats_t* (*get_stats)();
+ const bgfx_memory_t* (*alloc)(uint32_t _size);
+ const bgfx_memory_t* (*copy)(const void* _data, uint32_t _size);
+ const bgfx_memory_t* (*make_ref)(const void* _data, uint32_t _size);
+ const bgfx_memory_t* (*make_ref_release)(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData);
+ void (*set_debug)(uint32_t _debug);
+ void (*dbg_text_clear)(uint8_t _attr, bool _small);
+ void (*dbg_text_printf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
+ void (*dbg_text_image)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch);
+ bgfx_index_buffer_handle_t (*create_index_buffer)(const bgfx_memory_t* _mem, uint16_t _flags);
+ void (*destroy_index_buffer)(bgfx_index_buffer_handle_t _handle);
+ bgfx_vertex_buffer_handle_t (*create_vertex_buffer)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
+ void (*destroy_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle);
+ bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer)(uint32_t _num, uint16_t _flags);
+ bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer_mem)(const bgfx_memory_t* _mem, uint16_t _flags);
+ void (*update_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem);
+ void (*destroy_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle);
+ bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
+ bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
+ void (*update_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem);
+ void (*destroy_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle);
+ bool (*check_avail_transient_index_buffer)(uint32_t _num);
+ bool (*check_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl);
+ bool (*check_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride);
+ bool (*check_avail_transient_buffers)(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices);
+ void (*alloc_transient_index_buffer)(bgfx_transient_index_buffer_t* _tib, uint32_t _num);
+ void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl);
+ bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices);
+ const bgfx_instance_data_buffer_t* (*alloc_instance_data_buffer)(uint32_t _num, uint16_t _stride);
+ bgfx_indirect_buffer_handle_t (*create_indirect_buffer)(uint32_t _num);
+ void (*destroy_indirect_buffer)(bgfx_indirect_buffer_handle_t _handle);
+ bgfx_shader_handle_t (*create_shader)(const bgfx_memory_t* _mem);
+ uint16_t (*get_shader_uniforms)(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max);
+ void (*destroy_shader)(bgfx_shader_handle_t _handle);
+ bgfx_program_handle_t (*create_program)(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
+ bgfx_program_handle_t (*create_compute_program)(bgfx_shader_handle_t _csh, bool _destroyShaders);
+ void (*destroy_program)(bgfx_program_handle_t _handle);
+ void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format);
+ bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info);
+ bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+ bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
+ bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+ bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+ void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
+ void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem);
+ void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
+ void (*destroy_texture)(bgfx_texture_handle_t _handle);
+ bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags);
+ bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags);
+ bgfx_frame_buffer_handle_t (*create_frame_buffer_from_attachment)(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures);
+ bgfx_frame_buffer_handle_t (*create_frame_buffer_from_nwh)(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat);
+ void (*destroy_frame_buffer)(bgfx_frame_buffer_handle_t _handle);
+ bgfx_uniform_handle_t (*create_uniform)(const char* _name, bgfx_uniform_type_t _type, uint16_t _num);
+ void (*destroy_uniform)(bgfx_uniform_handle_t _handle);
+ bgfx_occlusion_query_handle_t (*create_occlusion_query)();
+ bgfx_occlusion_query_result_t (*get_result)(bgfx_occlusion_query_handle_t _handle);
+ void (*destroy_occlusion_query)(bgfx_occlusion_query_handle_t _handle);
+ void (*set_palette_color)(uint8_t _index, const float _rgba[4]);
+ void (*set_view_name)(uint8_t _id, const char* _name);
+ void (*set_view_rect)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
+ void (*set_view_scissor)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
+ void (*set_view_clear)(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil);
+ void (*set_view_clear_mrt)(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7);
+ void (*set_view_seq)(uint8_t _id, bool _enabled);
+ void (*set_view_frame_buffer)(uint8_t _id, bgfx_frame_buffer_handle_t _handle);
+ void (*set_view_transform)(uint8_t _id, const void* _view, const void* _proj);
+ void (*set_view_transform_stereo)(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR);
+ void (*set_view_remap)(uint8_t _id, uint8_t _num, const void* _remap);
+ void (*set_marker)(const char* _marker);
+ void (*set_state)(uint64_t _state, uint32_t _rgba);
+ void (*set_condition)(bgfx_occlusion_query_handle_t _handle, bool _visible);
+ void (*set_stencil)(uint32_t _fstencil, uint32_t _bstencil);
+ uint16_t (*set_scissor)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
+ void (*set_scissor_cached)(uint16_t _cache);
+ uint32_t (*set_transform)(const void* _mtx, uint16_t _num);
+ uint32_t (*alloc_transform)(bgfx_transform_t* _transform, uint16_t _num);
+ void (*set_transform_cached)(uint32_t _cache, uint16_t _num);
+ void (*set_uniform)(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num);
+ void (*set_index_buffer)(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
+ void (*set_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
+ void (*set_transient_index_buffer)(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices);
+ void (*set_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
+ void (*set_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices);
+ void (*set_transient_vertex_buffer)(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices);
+ void (*set_instance_data_buffer)(const bgfx_instance_data_buffer_t* _idb, uint32_t _num);
+ void (*set_instance_data_from_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
+ void (*set_instance_data_from_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
+ void (*set_texture)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
+ void (*set_texture_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, uint32_t _flags);
+ uint32_t (*touch)(uint8_t _id);
+ uint32_t (*submit)(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth);
+ uint32_t (*submit_occlusion_query)(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth);
+ uint32_t (*submit_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth);
+ void (*set_image)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
+ void (*set_image_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format);
+ void (*set_compute_index_buffer)(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
+ void (*set_compute_vertex_buffer)(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
+ void (*set_compute_dynamic_index_buffer)(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
+ void (*set_compute_dynamic_vertex_buffer)(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
+ void (*set_compute_indirect_buffer)(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
+ uint32_t (*dispatch)(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags);
+ uint32_t (*dispatch_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags);
+ void (*discard)();
+ void (*blit)(uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth);
+ void (*save_screen_shot)(const char* _filePath);
+
+} bgfx_interface_vtbl_t;
+
+typedef bgfx_interface_vtbl_t* (*PFN_BGFX_GET_INTERFACE)(uint32_t _version);
#endif // BGFX_PLATFORM_C99_H_HEADER_GUARD
diff --git a/3rdparty/bgfx/makefile b/3rdparty/bgfx/makefile
index f583e7891db..afa61759a85 100644
--- a/3rdparty/bgfx/makefile
+++ b/3rdparty/bgfx/makefile
@@ -20,7 +20,8 @@ endif
# $(info $(OS))
-GENIE=../bx/tools/bin/$(OS)/genie $(GENIE_FLAGS)
+BX_DIR?=../bx
+GENIE?=$(BX_DIR)/tools/bin/$(OS)/genie
all:
$(GENIE) --with-tools --with-shared-lib vs2008
@@ -214,6 +215,14 @@ rpi-release: .build/projects/gmake-rpi
$(MAKE) -R -C .build/projects/gmake-rpi config=release
rpi: rpi-debug rpi-release
+build-darwin: osx
+
+build-linux: linux-debug64 linux-release64
+
+build-windows: mingw-gcc
+
+build: build-$(OS)
+
rebuild-shaders:
$(MAKE) -R -C examples rebuild
@@ -268,16 +277,16 @@ BUILD_TOOLS_SUFFIX=Release
EXE=.exe
endif
-tools/bin/$(OS)/shaderc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
- $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG)
- $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
-
-tools/bin/$(OS)/geometryc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
+geometryc: .build/projects/$(BUILD_PROJECT_DIR)
$(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG)
- $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
+ $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/geometryc$(EXE)
+
+shaderc: .build/projects/$(BUILD_PROJECT_DIR)
+ $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG)
+ $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/shaderc$(EXE)
-tools/bin/$(OS)/texturec$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
+texturec: .build/projects/$(BUILD_PROJECT_DIR)
$(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f texturec.make config=$(BUILD_TOOLS_CONFIG)
- $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/texturec$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
+ $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/texturec$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/texturec$(EXE)
-tools: tools/bin/$(OS)/shaderc$(EXE) tools/bin/$(OS)/geometryc$(EXE) tools/bin/$(OS)/texturec$(EXE)
+tools: geometryc shaderc texturec
diff --git a/3rdparty/bgfx/scripts/bgfx.lua b/3rdparty/bgfx/scripts/bgfx.lua
index ce2effb0f88..97ec723ddba 100644
--- a/3rdparty/bgfx/scripts/bgfx.lua
+++ b/3rdparty/bgfx/scripts/bgfx.lua
@@ -36,7 +36,7 @@ function bgfxProject(_name, _kind, _defines)
includedirs {
path.join(BGFX_DIR, "3rdparty"),
path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
- path.join(BGFX_DIR, "../bx/include"),
+ path.join(BX_DIR, "include"),
}
defines {
@@ -88,12 +88,18 @@ function bgfxProject(_name, _kind, _defines)
"-weak_framework Metal",
}
- configuration { "not nacl" }
+ configuration { "not nacl", "not linux-steamlink" }
includedirs {
--nacl has GLES2 headers modified...
+ --steamlink has EGL headers modified...
path.join(BGFX_DIR, "3rdparty/khronos"),
}
+ configuration { "linux-steamlink" }
+ defines {
+ "EGL_API_FB",
+ }
+
configuration {}
includedirs {
diff --git a/3rdparty/bgfx/scripts/example-common.lua b/3rdparty/bgfx/scripts/example-common.lua
index 1832f9836ac..fcaca364f64 100644
--- a/3rdparty/bgfx/scripts/example-common.lua
+++ b/3rdparty/bgfx/scripts/example-common.lua
@@ -60,6 +60,11 @@ project ("example-common")
"ENTRY_CONFIG_USE_GLFW=1",
}
end
+
+ configuration { "linux-steamlink" }
+ defines {
+ "EGL_API_FB",
+ }
configuration { "osx or ios* or tvos*" }
files {
diff --git a/3rdparty/bgfx/scripts/genie.lua b/3rdparty/bgfx/scripts/genie.lua
index 0696469ca1c..52554366dfb 100644
--- a/3rdparty/bgfx/scripts/genie.lua
+++ b/3rdparty/bgfx/scripts/genie.lua
@@ -66,9 +66,13 @@ solution "bgfx"
startproject "example-00-helloworld"
BGFX_DIR = path.getabsolute("..")
+BX_DIR = os.getenv("BX_DIR")
+
local BGFX_BUILD_DIR = path.join(BGFX_DIR, ".build")
local BGFX_THIRD_PARTY_DIR = path.join(BGFX_DIR, "3rdparty")
-BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx"))
+if not BX_DIR then
+ BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx"))
+end
if not os.isdir(BX_DIR) then
print("bx not found at " .. BX_DIR)
@@ -140,20 +144,15 @@ function exampleProject(_name)
defines { "ENTRY_CONFIG_USE_SDL=1" }
links { "SDL2" }
- configuration { "x32", "windows" }
- libdirs { "$(SDL2_DIR)/lib/x86" }
-
- configuration { "x64", "windows" }
- libdirs { "$(SDL2_DIR)/lib/x64" }
+ configuration { "osx" }
+ libdirs { "$(SDL2_DIR)/lib" }
configuration {}
end
if _OPTIONS["with-glfw"] then
defines { "ENTRY_CONFIG_USE_GLFW=1" }
- links {
- "glfw3"
- }
+ links { "glfw3" }
configuration { "linux or freebsd" }
links {
@@ -305,13 +304,21 @@ function exampleProject(_name)
kind "ConsoleApp"
targetextension ".bc"
- configuration { "linux-* or freebsd" }
+ configuration { "linux-* or freebsd", "not linux-steamlink" }
links {
"X11",
"GL",
"pthread",
}
+ configuration { "linux-steamlink" }
+ links {
+ "EGL",
+ "GLESv2",
+ "SDL2",
+ "pthread",
+ }
+
configuration { "rpi" }
links {
"X11",
@@ -415,7 +422,6 @@ end
if _OPTIONS["with-tools"] then
group "tools"
- dofile "makedisttex.lua"
dofile "shaderc.lua"
dofile "texturec.lua"
dofile "geometryc.lua"
diff --git a/3rdparty/bgfx/scripts/makedisttex.lua b/3rdparty/bgfx/scripts/makedisttex.lua
deleted file mode 100644
index 01705a08262..00000000000
--- a/3rdparty/bgfx/scripts/makedisttex.lua
+++ /dev/null
@@ -1,19 +0,0 @@
---
--- Copyright 2010-2016 Branimir Karadzic. All rights reserved.
--- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
---
-
-project "makedisttex"
- uuid "b0561b30-91bb-11e1-b06e-023ad46e7d26"
- kind "ConsoleApp"
-
- includedirs {
- path.join(BX_DIR, "include"),
- path.join(BGFX_DIR, "3rdparty"),
- }
-
- files {
- path.join(BGFX_DIR, "3rdparty/edtaa3/**.cpp"),
- path.join(BGFX_DIR, "3rdparty/edtaa3/**.h"),
- path.join(BGFX_DIR, "tools/makedisttex.cpp"),
- }
diff --git a/3rdparty/bgfx/scripts/shader.mk b/3rdparty/bgfx/scripts/shader.mk
index 002b7564b3e..d7e0e151597 100644
--- a/3rdparty/bgfx/scripts/shader.mk
+++ b/3rdparty/bgfx/scripts/shader.mk
@@ -6,6 +6,11 @@
THISDIR:=$(dir $(lastword $(MAKEFILE_LIST)))
include $(THISDIR)/tools.mk
+# Define SHADERS_DIR if your shader files are in a different dir than the makefile including this.
+# Notice: If defined, SHADERS_DIR should end with dir slash '/'.
+# Example:
+# SHADERS_DIR=shader_files/
+
ifndef TARGET
.PHONY: all
all:
@@ -67,18 +72,18 @@ CS_FLAGS+=-i $(THISDIR)../src/
BUILD_OUTPUT_DIR=$(addprefix ./, $(RUNTIME_DIR)/$(SHADER_PATH))
BUILD_INTERMEDIATE_DIR=$(addprefix $(BUILD_DIR)/, $(SHADER_PATH))
-VS_SOURCES=$(wildcard vs_*.sc)
-VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(VS_SOURCES))))
+VS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), vs_*.sc)))
+VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(VS_SOURCES)))))
-FS_SOURCES=$(wildcard fs_*.sc)
-FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(FS_SOURCES))))
+FS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), fs_*.sc)))
+FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(FS_SOURCES)))))
-CS_SOURCES=$(wildcard cs_*.sc)
-CS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(CS_SOURCES))))
+CS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), cs_*.sc)))
+CS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(CS_SOURCES)))))
-VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(VS_SOURCES))))
-FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(FS_SOURCES))))
-CS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(CS_SOURCES))))
+VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(VS_SOURCES)))))
+FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(FS_SOURCES)))))
+CS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(CS_SOURCES)))))
BIN = $(VS_BIN) $(FS_BIN)
ASM = $(VS_ASM) $(FS_ASM)
@@ -98,17 +103,17 @@ endif
endif
endif
-$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : vs_%.sc
+$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : $(SHADERS_DIR)vs_%.sc
@echo [$(<)]
$(SILENT) $(SHADERC) $(VS_FLAGS) --type vertex --depends -o $(@) -f $(<) --disasm
$(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
-$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : fs_%.sc
+$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : $(SHADERS_DIR)fs_%.sc
@echo [$(<)]
$(SILENT) $(SHADERC) $(FS_FLAGS) --type fragment --depends -o $(@) -f $(<) --disasm
$(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
-$(BUILD_INTERMEDIATE_DIR)/cs_%.bin : cs_%.sc
+$(BUILD_INTERMEDIATE_DIR)/cs_%.bin : $(SHADERS_DIR)cs_%.sc
@echo [$(<)]
$(SILENT) $(SHADERC) $(CS_FLAGS) --type compute --depends -o $(@) -f $(<) --disasm
$(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
diff --git a/3rdparty/bgfx/scripts/shaderc.lua b/3rdparty/bgfx/scripts/shaderc.lua
index b2a5b5c54a0..4c09f847745 100644
--- a/3rdparty/bgfx/scripts/shaderc.lua
+++ b/3rdparty/bgfx/scripts/shaderc.lua
@@ -55,11 +55,6 @@ project "shaderc"
path.join(GLSL_OPTIMIZER, "include/c99"),
}
- configuration { "vs* or mingw*" }
- links {
- "d3dcompiler",
- }
-
configuration {}
defines { -- fcpp
@@ -73,6 +68,7 @@ project "shaderc"
path.join(BX_DIR, "include"),
path.join(BGFX_DIR, "include"),
+ path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
FCPP_DIR,
path.join(GLSL_OPTIMIZER, "include"),
diff --git a/3rdparty/bgfx/scripts/texturec.lua b/3rdparty/bgfx/scripts/texturec.lua
index 8b9beed609e..dac357b6b86 100644
--- a/3rdparty/bgfx/scripts/texturec.lua
+++ b/3rdparty/bgfx/scripts/texturec.lua
@@ -19,8 +19,12 @@ project "texturec"
path.join(BGFX_DIR, "src/image.*"),
path.join(BGFX_DIR, "3rdparty/libsquish/**.cpp"),
path.join(BGFX_DIR, "3rdparty/libsquish/**.h"),
+ path.join(BGFX_DIR, "3rdparty/edtaa3/**.cpp"),
+ path.join(BGFX_DIR, "3rdparty/edtaa3/**.h"),
path.join(BGFX_DIR, "3rdparty/etc1/**.cpp"),
path.join(BGFX_DIR, "3rdparty/etc1/**.h"),
+ path.join(BGFX_DIR, "3rdparty/etc2/**.cpp"),
+ path.join(BGFX_DIR, "3rdparty/etc2/**.hpp"),
path.join(BGFX_DIR, "3rdparty/nvtt/**.cpp"),
path.join(BGFX_DIR, "3rdparty/nvtt/**.h"),
path.join(BGFX_DIR, "3rdparty/pvrtc/**.cpp"),
diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp
index a6882850ba9..e16d4f71c3f 100644
--- a/3rdparty/bgfx/src/bgfx.cpp
+++ b/3rdparty/bgfx/src/bgfx.cpp
@@ -112,10 +112,10 @@ namespace bgfx
strcat(filePath, ".tga");
bx::CrtFileWriter writer;
- if (0 == writer.open(filePath) )
+ if (bx::open(&writer, filePath) )
{
imageWriteTga(&writer, _width, _height, _pitch, _data, false, _yflip);
- writer.close();
+ bx::close(&writer);
}
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
}
@@ -277,6 +277,7 @@ namespace bgfx
static Context* s_ctx = NULL;
static bool s_renderFrameCalled = false;
+ InternalData g_internalData;
PlatformData g_platformData;
void AllocatorStub::checkLeaks()
@@ -292,19 +293,75 @@ namespace bgfx
#endif // BGFX_CONFIG_MEMORY_TRACKING
}
- void setPlatformData(const PlatformData& _pd)
+ void setPlatformData(const PlatformData& _data)
{
if (NULL != s_ctx)
{
BGFX_FATAL(true
- && g_platformData.ndt == _pd.ndt
- && g_platformData.nwh == _pd.nwh
- && g_platformData.context == _pd.context
+ && g_platformData.ndt == _data.ndt
+ && g_platformData.nwh == _data.nwh
+ && g_platformData.context == _data.context
, Fatal::UnableToInitialize
, "Only backbuffer pointer can be changed after initialization!"
);
}
- memcpy(&g_platformData, &_pd, sizeof(PlatformData) );
+ memcpy(&g_platformData, &_data, sizeof(PlatformData) );
+ }
+
+ const InternalData* getInternalData()
+ {
+ BGFX_CHECK_RENDER_THREAD();
+ return &g_internalData;
+ }
+
+ uintptr_t overrideInternal(TextureHandle _handle, uintptr_t _ptr)
+ {
+ BGFX_CHECK_RENDER_THREAD();
+ RendererContextI* rci = s_ctx->m_renderCtx;
+ if (0 == rci->getInternal(_handle) )
+ {
+ return 0;
+ }
+
+ rci->overrideInternal(_handle, _ptr);
+
+ return rci->getInternal(_handle);
+ }
+
+ uintptr_t overrideInternal(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags)
+ {
+ BGFX_CHECK_RENDER_THREAD();
+ RendererContextI* rci = s_ctx->m_renderCtx;
+ if (0 == rci->getInternal(_handle) )
+ {
+ return 0;
+ }
+
+ uint32_t size = sizeof(uint32_t) + sizeof(TextureCreate);
+ Memory* mem = const_cast<Memory*>(alloc(size) );
+
+ bx::StaticMemoryBlockWriter writer(mem->data, mem->size);
+ uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
+ bx::write(&writer, magic);
+
+ TextureCreate tc;
+ tc.m_flags = _flags;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_sides = 0;
+ tc.m_depth = 0;
+ tc.m_numMips = uint8_t(bx::uint16_max(1, _numMips) );
+ tc.m_format = _format;
+ tc.m_cubeMap = false;
+ tc.m_mem = NULL;
+ bx::write(&writer, tc);
+
+ rci->destroyTexture(_handle);
+ rci->createTexture(_handle, mem, _flags, 0);
+
+ release(mem);
+
+ return rci->getInternal(_handle);
}
void setGraphicsDebuggerPresent(bool _present)
@@ -1026,6 +1083,15 @@ namespace bgfx
static void dumpCaps()
{
+ BX_TRACE("Sort key masks:");
+ BX_TRACE("\t View %016" PRIx64, SORT_KEY_VIEW_MASK);
+ BX_TRACE("\t Draw bit %016" PRIx64, SORT_KEY_DRAW_BIT);
+ BX_TRACE("\t Seq %016" PRIx64, SORT_KEY_SEQ_MASK);
+ BX_TRACE("\tD Trans %016" PRIx64, SORT_KEY_DRAW_TRANS_MASK);
+ BX_TRACE("\tD Program %016" PRIx64, SORT_KEY_DRAW_PROGRAM_MASK);
+ BX_TRACE("\tC Program %016" PRIx64, SORT_KEY_COMPUTE_PROGRAM_MASK);
+ BX_TRACE("\tD Depth %016" PRIx64, SORT_KEY_DRAW_DEPTH_MASK);
+
BX_TRACE("Supported capabilities (renderer %s, vendor 0x%04x, device 0x%04x):"
, s_ctx->m_renderCtx->getRendererName()
, g_caps.vendorId
@@ -1217,6 +1283,8 @@ namespace bgfx
frame();
}
+ g_internalData.caps = getCaps();
+
return true;
}
@@ -1263,6 +1331,7 @@ namespace bgfx
m_render->destroy();
#endif // BGFX_CONFIG_MULTITHREADED
+ memset(&g_internalData, 0, sizeof(InternalData) );
s_ctx = NULL;
m_submit->destroy();
@@ -2190,13 +2259,10 @@ again:
uint8_t num;
_cmdbuf.read(num);
- TextureHandle textureHandles[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
- for (uint32_t ii = 0; ii < num; ++ii)
- {
- _cmdbuf.read(textureHandles[ii]);
- }
+ Attachment attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
+ _cmdbuf.read(attachment, sizeof(Attachment) * num);
- m_renderCtx->createFrameBuffer(handle, num, textureHandles);
+ m_renderCtx->createFrameBuffer(handle, num, attachment);
}
}
break;
@@ -2825,13 +2891,6 @@ again:
);
}
- uint32_t size = sizeof(uint32_t)+sizeof(TextureCreate);
- const Memory* mem = alloc(size);
-
- bx::StaticMemoryBlockWriter writer(mem->data, mem->size);
- uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
- bx::write(&writer, magic);
-
if (BackbufferRatio::Count != _ratio)
{
_width = uint16_t(s_ctx->m_resolution.m_width);
@@ -2839,6 +2898,13 @@ again:
getTextureSizeFromRatio(_ratio, _width, _height);
}
+ uint32_t size = sizeof(uint32_t)+sizeof(TextureCreate);
+ const Memory* mem = alloc(size);
+
+ bx::StaticMemoryBlockWriter writer(mem->data, mem->size);
+ uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
+ bx::write(&writer, magic);
+
TextureCreate tc;
tc.m_flags = _flags;
tc.m_width = _width;
@@ -2846,7 +2912,7 @@ again:
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = _numMips;
- tc.m_format = uint8_t(_format);
+ tc.m_format = _format;
tc.m_cubeMap = false;
tc.m_mem = _mem;
bx::write(&writer, tc);
@@ -2897,15 +2963,15 @@ again:
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_flags = _flags;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = _depth;
+ tc.m_flags = _flags;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_sides = 0;
+ tc.m_depth = _depth;
tc.m_numMips = _numMips;
- tc.m_format = uint8_t(_format);
+ tc.m_format = _format;
tc.m_cubeMap = false;
- tc.m_mem = _mem;
+ tc.m_mem = _mem;
bx::write(&writer, tc);
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count);
@@ -2947,7 +3013,7 @@ again:
tc.m_sides = 6;
tc.m_depth = 0;
tc.m_numMips = _numMips;
- tc.m_format = uint8_t(_format);
+ tc.m_format = _format;
tc.m_cubeMap = true;
tc.m_mem = _mem;
bx::write(&writer, tc);
@@ -3043,14 +3109,27 @@ again:
FrameBufferHandle createFrameBuffer(uint8_t _num, const TextureHandle* _handles, bool _destroyTextures)
{
+ Attachment attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
+ for (uint8_t ii = 0; ii < _num; ++ii)
+ {
+ Attachment& at = attachment[ii];
+ at.handle = _handles[ii];
+ at.mip = 0;
+ at.layer = 0;
+ }
+ return createFrameBuffer(_num, attachment, _destroyTextures);
+ }
+
+ FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures)
+ {
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(_num != 0, "Number of frame buffer attachments can't be 0.");
BX_CHECK(_num <= BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS, "Number of frame buffer attachments is larger than allowed %d (max: %d)."
, _num
, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS
);
- BX_CHECK(NULL != _handles, "_handles can't be NULL");
- return s_ctx->createFrameBuffer(_num, _handles, _destroyTextures);
+ BX_CHECK(NULL != _attachment, "_attachment can't be NULL");
+ return s_ctx->createFrameBuffer(_num, _attachment, _destroyTextures);
}
FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat)
@@ -3488,6 +3567,32 @@ again:
#include <bgfx/c99/bgfx.h>
#include <bgfx/c99/bgfxplatform.h>
+#define FLAGS_MASK_TEST(_flags, _mask) ( (_flags) == ( (_flags) & (_mask) ) )
+
+BX_STATIC_ASSERT(FLAGS_MASK_TEST(0
+ | BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER
+ | BGFX_TEXTURE_INTERNAL_SHARED
+ , BGFX_TEXTURE_RESERVED_MASK
+ ) );
+
+BX_STATIC_ASSERT(FLAGS_MASK_TEST(0
+ | BGFX_RESET_INTERNAL_FORCE
+ , BGFX_RESET_RESERVED_MASK
+ ) );
+
+BX_STATIC_ASSERT(FLAGS_MASK_TEST(0
+ | BGFX_STATE_INTERNAL_SCISSOR
+ | BGFX_STATE_INTERNAL_OCCLUSION_QUERY
+ , BGFX_STATE_RESERVED_MASK
+ ) );
+
+BX_STATIC_ASSERT(FLAGS_MASK_TEST(0
+ | BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE
+ , BGFX_SUBMIT_RESERVED_MASK
+ ) );
+
+#undef FLAGS_MASK_TEST
+
BX_STATIC_ASSERT(bgfx::Fatal::Count == bgfx::Fatal::Enum(BGFX_FATAL_COUNT) );
BX_STATIC_ASSERT(bgfx::RendererType::Count == bgfx::RendererType::Enum(BGFX_RENDERER_TYPE_COUNT) );
BX_STATIC_ASSERT(bgfx::Attrib::Count == bgfx::Attrib::Enum(BGFX_ATTRIB_COUNT) );
@@ -3504,6 +3609,7 @@ BX_STATIC_ASSERT(sizeof(bgfx::InstanceDataBuffer) == sizeof(bgfx_instance_dat
BX_STATIC_ASSERT(sizeof(bgfx::TextureInfo) == sizeof(bgfx_texture_info_t) );
BX_STATIC_ASSERT(sizeof(bgfx::Caps) == sizeof(bgfx_caps_t) );
BX_STATIC_ASSERT(sizeof(bgfx::PlatformData) == sizeof(bgfx_platform_data_t) );
+BX_STATIC_ASSERT(sizeof(bgfx::InternalData) == sizeof(bgfx_internal_data_t) );
namespace bgfx
{
@@ -4018,10 +4124,10 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backb
return handle.c;
}
-BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures)
+BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
- handle.cpp = bgfx::createFrameBuffer(_num, (const bgfx::TextureHandle*)_handles, _destroyTextures);
+ handle.cpp = bgfx::createFrameBuffer(_num, (const bgfx::Attachment*)_attachment, _destroyTextures);
return handle.c;
}
@@ -4364,9 +4470,26 @@ BGFX_C_API bgfx_render_frame_t bgfx_render_frame()
return bgfx_render_frame_t(bgfx::renderFrame() );
}
-BGFX_C_API void bgfx_set_platform_data(bgfx_platform_data_t* _pd)
+BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t* _data)
{
- bgfx::setPlatformData(*(bgfx::PlatformData*)_pd);
+ bgfx::setPlatformData(*(const bgfx::PlatformData*)_data);
+}
+
+BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data()
+{
+ return (const bgfx_internal_data_t*)bgfx::getInternalData();
+}
+
+BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr)
+{
+ union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
+ return bgfx::overrideInternal(handle.cpp, _ptr);
+}
+
+BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags)
+{
+ union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
+ return bgfx::overrideInternal(handle.cpp, _width, _height, _numMips, bgfx::TextureFormat::Enum(_format), _flags);
}
BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
@@ -4376,6 +4499,9 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
#define BGFX_IMPORT \
BGFX_IMPORT_FUNC(render_frame) \
BGFX_IMPORT_FUNC(set_platform_data) \
+ BGFX_IMPORT_FUNC(get_internal_data) \
+ BGFX_IMPORT_FUNC(override_internal_texture_ptr) \
+ BGFX_IMPORT_FUNC(override_internal_texture) \
BGFX_IMPORT_FUNC(vertex_decl_begin) \
BGFX_IMPORT_FUNC(vertex_decl_add) \
BGFX_IMPORT_FUNC(vertex_decl_skip) \
@@ -4444,7 +4570,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
BGFX_IMPORT_FUNC(destroy_texture) \
BGFX_IMPORT_FUNC(create_frame_buffer) \
BGFX_IMPORT_FUNC(create_frame_buffer_scaled) \
- BGFX_IMPORT_FUNC(create_frame_buffer_from_handles) \
+ BGFX_IMPORT_FUNC(create_frame_buffer_from_attachment) \
BGFX_IMPORT_FUNC(create_frame_buffer_from_nwh) \
BGFX_IMPORT_FUNC(destroy_frame_buffer) \
BGFX_IMPORT_FUNC(create_uniform) \
diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h
index fc13eeb06b7..1434b5ca41f 100644
--- a/3rdparty/bgfx/src/bgfx_p.h
+++ b/3rdparty/bgfx/src/bgfx_p.h
@@ -201,6 +201,7 @@ namespace stl
#define BGFX_MAX_COMPUTE_BINDINGS 8
#define BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER UINT32_C(0x10000000)
+#define BGFX_TEXTURE_INTERNAL_SHARED UINT32_C(0x20000000)
#define BGFX_RESET_INTERNAL_FORCE UINT32_C(0x80000000)
@@ -212,9 +213,9 @@ namespace stl
#define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9"
#define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11"
#define BGFX_RENDERER_DIRECT3D12_NAME "Direct3D 12"
-#define BGFX_RENDERER_METAL_NAME "Metal"
-#define BGFX_RENDERER_VULKAN_NAME "Vulkan"
-#define BGFX_RENDERER_NULL_NAME "NULL"
+#define BGFX_RENDERER_METAL_NAME "Metal"
+#define BGFX_RENDERER_VULKAN_NAME "Vulkan"
+#define BGFX_RENDERER_NULL_NAME "NULL"
#if BGFX_CONFIG_RENDERER_OPENGL
# if BGFX_CONFIG_RENDERER_OPENGL >= 31 && BGFX_CONFIG_RENDERER_OPENGL <= 33
@@ -256,6 +257,7 @@ namespace stl
namespace bgfx
{
+ extern InternalData g_internalData;
extern PlatformData g_platformData;
#if BGFX_CONFIG_MAX_DRAW_CALLS < (64<<10)
@@ -309,13 +311,13 @@ namespace bgfx
struct TextureCreate
{
+ TextureFormat::Enum m_format;
uint32_t m_flags;
uint16_t m_width;
uint16_t m_height;
uint16_t m_sides;
uint16_t m_depth;
uint8_t m_numMips;
- uint8_t m_format;
bool m_cubeMap;
const Memory* m_mem;
};
@@ -448,13 +450,7 @@ namespace bgfx
const uint32_t width = (bx::uint32_min(m_width, _width +_x)-_x)*2;
const uint32_t height = bx::uint32_min(m_height, _height+_y)-_y;
const uint32_t dstPitch = m_width*2;
-
- for (uint32_t yy = 0; yy < height; ++yy)
- {
- memcpy(dst, src, width);
- dst += dstPitch;
- src += _pitch;
- }
+ bx::memCopy(dst, src, width, height, _pitch, dstPitch);
}
}
@@ -577,8 +573,14 @@ namespace bgfx
const char* getPredefinedUniformName(PredefinedUniform::Enum _enum);
PredefinedUniform::Enum nameToPredefinedUniformEnum(const char* _name);
- struct CommandBuffer
+ class CommandBuffer
{
+ BX_CLASS(CommandBuffer
+ , NO_COPY
+ , NO_ASSIGNMENT
+ );
+
+ public:
CommandBuffer()
: m_pos(0)
, m_size(BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE)
@@ -694,32 +696,30 @@ namespace bgfx
uint32_t m_pos;
uint32_t m_size;
uint8_t m_buffer[BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE];
-
- private:
- CommandBuffer(const CommandBuffer&);
- void operator=(const CommandBuffer&);
};
-#define SORT_KEY_DRAW_BIT (UINT64_C(1)<<0x36)
+#define SORT_KEY_NUM_BITS_TRANS 2
-#define SORT_KEY_SEQ_SHIFT 0x2b
-#define SORT_KEY_SEQ_MASK (UINT64_C(0x7ff)<<SORT_KEY_SEQ_SHIFT)
+#define SORT_KEY_DRAW_BIT (UINT64_C(1)<<0x36)
#define SORT_KEY_VIEW_SHIFT 0x37
#define SORT_KEY_VIEW_MASK ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<<SORT_KEY_VIEW_SHIFT)
-#define SORT_KEY_DRAW_TRANS_SHIFT 0x29
-#define SORT_KEY_DRAW_TRANS_MASK (UINT64_C(0x3)<<SORT_KEY_DRAW_TRANS_SHIFT)
+#define SORT_KEY_DRAW_DEPTH_SHIFT 0
+#define SORT_KEY_DRAW_DEPTH_MASK ( ( (UINT64_C(1)<<BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH)-1)<<SORT_KEY_DRAW_DEPTH_SHIFT)
-#define SORT_KEY_DRAW_PROGRAM_SHIFT 0x20
+#define SORT_KEY_DRAW_PROGRAM_SHIFT (SORT_KEY_DRAW_DEPTH_SHIFT+BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH)
#define SORT_KEY_DRAW_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_DRAW_PROGRAM_SHIFT)
-#define SORT_KEY_DRAW_DEPTH_SHIFT 0
-#define SORT_KEY_DRAW_DEPTH_MASK ( (uint64_t(UINT32_MAX) )<<SORT_KEY_DRAW_DEPTH_SHIFT)
-
-#define SORT_KEY_COMPUTE_PROGRAM_SHIFT 0x22
+#define SORT_KEY_COMPUTE_PROGRAM_SHIFT (SORT_KEY_DRAW_DEPTH_SHIFT+BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH+SORT_KEY_NUM_BITS_TRANS)
#define SORT_KEY_COMPUTE_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_COMPUTE_PROGRAM_SHIFT)
+#define SORT_KEY_DRAW_TRANS_SHIFT (SORT_KEY_DRAW_PROGRAM_SHIFT+BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM)
+#define SORT_KEY_DRAW_TRANS_MASK (UINT64_C(0x3)<<SORT_KEY_DRAW_TRANS_SHIFT)
+
+#define SORT_KEY_SEQ_SHIFT (SORT_KEY_DRAW_TRANS_SHIFT+SORT_KEY_NUM_BITS_TRANS)
+#define SORT_KEY_SEQ_MASK ( ( (UINT64_C(1)<<BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ)-1)<<SORT_KEY_SEQ_SHIFT)
+
BX_STATIC_ASSERT(BGFX_CONFIG_MAX_VIEWS <= 256);
BX_STATIC_ASSERT( (BGFX_CONFIG_MAX_PROGRAMS & (BGFX_CONFIG_MAX_PROGRAMS-1) ) == 0); // Must be power of 2.
BX_STATIC_ASSERT( (0 // Render key mask shouldn't overlap.
@@ -800,7 +800,7 @@ namespace bgfx
/// Returns true if item is command.
bool decode(uint64_t _key)
{
- m_seq = uint16_t( (_key & SORT_KEY_SEQ_MASK ) >> SORT_KEY_SEQ_SHIFT);
+ m_seq = uint32_t( (_key & SORT_KEY_SEQ_MASK ) >> SORT_KEY_SEQ_SHIFT);
m_view = uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT);
if (_key & SORT_KEY_DRAW_BIT)
{
@@ -832,15 +832,15 @@ namespace bgfx
void reset()
{
m_depth = 0;
- m_program = 0;
m_seq = 0;
+ m_program = 0;
m_view = 0;
m_trans = 0;
}
uint32_t m_depth;
+ uint32_t m_seq;
uint16_t m_program;
- uint16_t m_seq;
uint8_t m_view;
uint8_t m_trans;
};
@@ -927,6 +927,10 @@ namespace bgfx
float* toPtr(uint32_t _cacheIdx)
{
+ BX_CHECK(_cacheIdx < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache out of bounds index %d (max: %d)"
+ , _cacheIdx
+ , BGFX_CONFIG_MAX_MATRIX_CACHE
+ );
return m_cache[_cacheIdx].un.val;
}
@@ -1495,8 +1499,12 @@ namespace bgfx
void setTransform(uint32_t _cache, uint16_t _num)
{
+ BX_CHECK(_cache < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache out of bounds index %d (max: %d)"
+ , _cache
+ , BGFX_CONFIG_MAX_MATRIX_CACHE
+ );
m_draw.m_matrix = _cache;
- m_draw.m_num = _num;
+ m_draw.m_num = uint16_t(bx::uint32_min(_cache+_num, BGFX_CONFIG_MAX_MATRIX_CACHE-1) - _cache);
}
void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
@@ -2041,8 +2049,10 @@ namespace bgfx
virtual void updateTextureEnd() = 0;
virtual void readTexture(TextureHandle _handle, void* _data) = 0;
virtual void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height) = 0;
+ virtual void overrideInternal(TextureHandle _handle, uintptr_t _ptr) = 0;
+ virtual uintptr_t getInternal(TextureHandle _handle) = 0;
virtual void destroyTexture(TextureHandle _handle) = 0;
- virtual void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) = 0;
+ virtual void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) = 0;
virtual void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) = 0;
virtual void destroyFrameBuffer(FrameBufferHandle _handle) = 0;
virtual void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) = 0;
@@ -3174,14 +3184,14 @@ namespace bgfx
cmdbuf.write(_mem);
}
- bool checkFrameBuffer(uint8_t _num, const TextureHandle* _handles) const
+ bool checkFrameBuffer(uint8_t _num, const Attachment* _attachment) const
{
uint8_t color = 0;
uint8_t depth = 0;
for (uint32_t ii = 0; ii < _num; ++ii)
{
- TextureHandle texHandle = _handles[ii];
+ TextureHandle texHandle = _attachment[ii].handle;
if (isDepth(TextureFormat::Enum(m_textureRef[texHandle.idx].m_format)))
{
++depth;
@@ -3197,9 +3207,9 @@ namespace bgfx
;
}
- BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(uint8_t _num, const TextureHandle* _handles, bool _destroyTextures) )
+ BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures) )
{
- BX_CHECK(checkFrameBuffer(_num, _handles)
+ BX_CHECK(checkFrameBuffer(_num, _attachment)
, "Too many frame buffer attachments (num attachments: %d, max color attachments %d)!"
, _num
, g_caps.maxFBAttachments
@@ -3218,26 +3228,26 @@ namespace bgfx
FrameBufferRef& ref = m_frameBufferRef[handle.idx];
ref.m_window = false;
memset(ref.un.m_th, 0xff, sizeof(ref.un.m_th) );
- BackbufferRatio::Enum bbRatio = BackbufferRatio::Enum(m_textureRef[_handles[0].idx].m_bbRatio);
+ BackbufferRatio::Enum bbRatio = BackbufferRatio::Enum(m_textureRef[_attachment[0].handle.idx].m_bbRatio);
for (uint32_t ii = 0; ii < _num; ++ii)
{
- TextureHandle texHandle = _handles[ii];
+ TextureHandle texHandle = _attachment[ii].handle;
BGFX_CHECK_HANDLE("createFrameBuffer texture handle", m_textureHandle, texHandle);
BX_CHECK(bbRatio == m_textureRef[texHandle.idx].m_bbRatio, "Mismatch in texture back-buffer ratio.");
BX_UNUSED(bbRatio);
- cmdbuf.write(texHandle);
-
ref.un.m_th[ii] = texHandle;
textureIncRef(texHandle);
}
+
+ cmdbuf.write(_attachment, sizeof(Attachment) * _num);
}
if (_destroyTextures)
{
for (uint32_t ii = 0; ii < _num; ++ii)
{
- textureTakeOwnership(_handles[ii]);
+ textureTakeOwnership(_attachment[ii].handle);
}
}
diff --git a/3rdparty/bgfx/src/bgfx_shader.sh b/3rdparty/bgfx/src/bgfx_shader.sh
index a82a03e2fbb..77998652e9d 100644
--- a/3rdparty/bgfx/src/bgfx_shader.sh
+++ b/3rdparty/bgfx/src/bgfx_shader.sh
@@ -12,6 +12,22 @@
#ifndef __cplusplus
+#if BGFX_SHADER_LANGUAGE_HLSL > 3
+# define BRANCH [branch]
+# define LOOP [loop]
+# define UNROLL [unroll]
+#else
+# define BRANCH
+# define LOOP
+# define UNROLL
+#endif // BGFX_SHADER_LANGUAGE_HLSL > 3
+
+#if BGFX_SHADER_LANGUAGE_HLSL > 3 && BGFX_SHADER_TYPE_FRAGMENT
+# define EARLY_DEPTH_STENCIL [earlydepthstencil]
+#else
+# define EARLY_DEPTH_STENCIL
+#endif // BGFX_SHADER_LANGUAGE_HLSL > 3 && BGFX_SHADER_TYPE_FRAGMENT
+
#if BGFX_SHADER_LANGUAGE_HLSL
# define dFdx(_x) ddx(_x)
# define dFdy(_y) ddy(-_y)
@@ -59,13 +75,13 @@ struct BgfxSampler2DShadow
float bgfxShadow2D(BgfxSampler2DShadow _sampler, vec3 _coord)
{
- return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, _coord.xy, _coord.z * 2.0 - 1.0);
+ return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, _coord.xy, _coord.z);
}
float bgfxShadow2DProj(BgfxSampler2DShadow _sampler, vec4 _coord)
{
vec3 coord = _coord.xyz * rcp(_coord.w);
- return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, coord.xy, coord.z * 2.0 - 1.0);
+ return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, coord.xy, coord.z);
}
struct BgfxSampler3D
@@ -180,9 +196,9 @@ float bgfxShadow2D(sampler2DShadow _sampler, vec3 _coord)
{
#if 0
float occluder = tex2D(_sampler, _coord.xy).x;
- return step(_coord.z * 2.0 - 1.0, occluder);
+ return step(_coord.z, occluder);
#else
- return tex2Dproj(_sampler, vec4(_coord.xy, _coord.z * 2.0 - 1.0, 1.0) ).x;
+ return tex2Dproj(_sampler, vec4(_coord.xy, _coord.z, 1.0) ).x;
#endif // 0
}
@@ -191,7 +207,7 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord)
#if 0
vec3 coord = _coord.xyz * rcp(_coord.w);
float occluder = tex2D(_sampler, coord.xy).x;
- return step(coord.z * 2.0 - 1.0, occluder);
+ return step(coord.z, occluder);
#else
return tex2Dproj(_sampler, _coord).x;
#endif // 0
diff --git a/3rdparty/bgfx/src/config.h b/3rdparty/bgfx/src/config.h
index 5966105ea15..edfa69da75a 100644
--- a/3rdparty/bgfx/src/config.h
+++ b/3rdparty/bgfx/src/config.h
@@ -65,6 +65,7 @@
|| BX_PLATFORM_NACL \
|| BX_PLATFORM_QNX \
|| BX_PLATFORM_RPI \
+ || BX_PLATFORM_STEAMLINK \
? 1 : 0)
# endif // BGFX_CONFIG_RENDERER_OPENGLES
@@ -77,8 +78,10 @@
|| BGFX_CONFIG_RENDERER_DIRECT3D9 \
|| BGFX_CONFIG_RENDERER_DIRECT3D11 \
|| BGFX_CONFIG_RENDERER_DIRECT3D12 \
+ || BGFX_CONFIG_RENDERER_METAL \
|| BGFX_CONFIG_RENDERER_OPENGL \
|| BGFX_CONFIG_RENDERER_OPENGLES \
+ || BGFX_CONFIG_RENDERER_VULKAN \
? 1 : 0) )
# endif // BGFX_CONFIG_RENDERER_NULL
#else
@@ -175,19 +178,7 @@
#endif // BGFX_CONFIG_DEBUG_OCCLUSION
#ifndef BGFX_CONFIG_MULTITHREADED
-# define BGFX_CONFIG_MULTITHREADED ( (!BGFX_CONFIG_RENDERER_NULL)&&(0 \
- || BX_PLATFORM_ANDROID \
- || BX_PLATFORM_BSD \
- || BX_PLATFORM_LINUX \
- || BX_PLATFORM_IOS \
- || BX_PLATFORM_NACL \
- || BX_PLATFORM_OSX \
- || BX_PLATFORM_QNX \
- || BX_PLATFORM_RPI \
- || BX_PLATFORM_WINDOWS \
- || BX_PLATFORM_WINRT \
- || BX_PLATFORM_XBOX360 \
- ? 1 : 0) )
+# define BGFX_CONFIG_MULTITHREADED ( (0 == BX_PLATFORM_EMSCRIPTEN) ? 1 : 0)
#endif // BGFX_CONFIG_MULTITHREADED
#ifndef BGFX_CONFIG_MAX_DRAW_CALLS
@@ -206,6 +197,21 @@
# define BGFX_CONFIG_MAX_RECT_CACHE (4<<10)
#endif // BGFX_CONFIG_MAX_RECT_CACHE
+#ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH
+# define BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH 32
+#endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH
+
+#ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ
+# define BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ 11
+#endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ
+
+#ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM
+# define BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM 9
+#endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM
+
+// Cannot be configured directly. Must must be power of 2.
+#define BGFX_CONFIG_MAX_PROGRAMS (1<<BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM)
+
#ifndef BGFX_CONFIG_MAX_VIEWS
// Do not change. Must be power of 2.
# define BGFX_CONFIG_MAX_VIEWS 256
@@ -249,11 +255,6 @@
# define BGFX_CONFIG_MAX_SHADERS 512
#endif // BGFX_CONFIG_MAX_FRAGMENT_SHADERS
-#ifndef BGFX_CONFIG_MAX_PROGRAMS
-// Must be power of 2.
-# define BGFX_CONFIG_MAX_PROGRAMS 512
-#endif // BGFX_CONFIG_MAX_PROGRAMS
-
#ifndef BGFX_CONFIG_MAX_TEXTURES
# define BGFX_CONFIG_MAX_TEXTURES (4<<10)
#endif // BGFX_CONFIG_MAX_TEXTURES
diff --git a/3rdparty/bgfx/src/glcontext_eagl.mm b/3rdparty/bgfx/src/glcontext_eagl.mm
index 253a31226c0..544fe0373d3 100644
--- a/3rdparty/bgfx/src/glcontext_eagl.mm
+++ b/3rdparty/bgfx/src/glcontext_eagl.mm
@@ -66,6 +66,8 @@ namespace bgfx { namespace gl
);
import();
+
+ g_internalData.context = m_context;
}
void GlContext::destroy()
diff --git a/3rdparty/bgfx/src/glcontext_egl.cpp b/3rdparty/bgfx/src/glcontext_egl.cpp
index d29a3422795..960500ac155 100644
--- a/3rdparty/bgfx/src/glcontext_egl.cpp
+++ b/3rdparty/bgfx/src/glcontext_egl.cpp
@@ -314,6 +314,8 @@ EGL_IMPORT
}
import();
+
+ g_internalData.context = m_context;
}
void GlContext::destroy()
diff --git a/3rdparty/bgfx/src/glcontext_glx.cpp b/3rdparty/bgfx/src/glcontext_glx.cpp
index 4e7e38f3bbe..20de9d71435 100644
--- a/3rdparty/bgfx/src/glcontext_glx.cpp
+++ b/3rdparty/bgfx/src/glcontext_glx.cpp
@@ -211,6 +211,8 @@ namespace bgfx { namespace gl
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glXSwapBuffers( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh);
+
+ g_internalData.context = m_context;
}
void GlContext::destroy()
diff --git a/3rdparty/bgfx/src/glcontext_nsgl.mm b/3rdparty/bgfx/src/glcontext_nsgl.mm
index e7acb814cab..b20de537500 100644
--- a/3rdparty/bgfx/src/glcontext_nsgl.mm
+++ b/3rdparty/bgfx/src/glcontext_nsgl.mm
@@ -115,6 +115,8 @@ namespace bgfx { namespace gl
}
import();
+
+ g_internalData.context = m_context;
}
void GlContext::destroy()
diff --git a/3rdparty/bgfx/src/glcontext_ppapi.cpp b/3rdparty/bgfx/src/glcontext_ppapi.cpp
index 977cd6c96da..a4290cc3005 100644
--- a/3rdparty/bgfx/src/glcontext_ppapi.cpp
+++ b/3rdparty/bgfx/src/glcontext_ppapi.cpp
@@ -191,6 +191,8 @@ namespace bgfx { namespace gl
{
BX_UNUSED(_width, _height);
BX_TRACE("GlContext::create");
+
+ g_internalData.context = m_context;
}
void GlContext::destroy()
diff --git a/3rdparty/bgfx/src/glcontext_wgl.cpp b/3rdparty/bgfx/src/glcontext_wgl.cpp
index 3c52702a6e5..eafee4f94b2 100644
--- a/3rdparty/bgfx/src/glcontext_wgl.cpp
+++ b/3rdparty/bgfx/src/glcontext_wgl.cpp
@@ -268,6 +268,8 @@ namespace bgfx { namespace gl
}
import();
+
+ g_internalData.context = m_context;
}
void GlContext::destroy()
diff --git a/3rdparty/bgfx/src/glimports.h b/3rdparty/bgfx/src/glimports.h
index 5891bd55ec9..527f96f128d 100644
--- a/3rdparty/bgfx/src/glimports.h
+++ b/3rdparty/bgfx/src/glimports.h
@@ -149,6 +149,7 @@ typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, G
typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
typedef const GLubyte* (GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
+typedef const GLubyte* (GL_APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
@@ -332,6 +333,7 @@ GL_IMPORT______(true, PFNGLGETQUERYOBJECTUI64VPROC, glGetQueryObj
GL_IMPORT______(false, PFNGLGETSHADERIVPROC, glGetShaderiv);
GL_IMPORT______(false, PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog);
GL_IMPORT______(false, PFNGLGETSTRINGPROC, glGetString);
+GL_IMPORT______(true, PFNGLGETSTRINGIPROC, glGetStringi);
GL_IMPORT______(false, PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation);
#if BGFX_CONFIG_RENDERER_OPENGL || !(BGFX_CONFIG_RENDERER_OPENGLES < 30)
GL_IMPORT______(true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer);
@@ -468,6 +470,8 @@ GL_IMPORT_____x(true, PFNGLGETCOMPRESSEDTEXIMAGEPROC, glGetCompress
GL_IMPORT_____x(true, PFNGLGETTEXIMAGEPROC, glGetTexImage);
# if BGFX_CONFIG_RENDERER_OPENGLES < 30
+GL_IMPORT______(true, PFNGLGETSTRINGIPROC, glGetStringi);
+
GL_IMPORT_OES__(true, PFNGLTEXIMAGE3DPROC, glTexImage3D);
GL_IMPORT_OES__(true, PFNGLTEXSUBIMAGE3DPROC, glTexSubImage3D);
GL_IMPORT_OES__(true, PFNGLCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3D);
@@ -538,6 +542,8 @@ GL_IMPORT_NV___(true, PFNGLQUERYCOUNTERPROC, glQueryCounte
GL_IMPORT (true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer, glDiscardFramebufferEXT);
# elif !BGFX_USE_GL_DYNAMIC_LIB
+GL_IMPORT______(true, PFNGLGETSTRINGIPROC, glGetStringi);
+
GL_IMPORT______(true, PFNGLTEXIMAGE3DPROC, glTexImage3D);
GL_IMPORT______(true, PFNGLTEXSUBIMAGE3DPROC, glTexSubImage3D);
GL_IMPORT______(true, PFNGLCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3D);
diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp
index 69bad82e943..34dcae9e54c 100644
--- a/3rdparty/bgfx/src/image.cpp
+++ b/3rdparty/bgfx/src/image.cpp
@@ -4,8 +4,6 @@
*/
#include "bgfx_p.h"
-#include <math.h> // powf, sqrtf
-
#include "image.h"
namespace bgfx
@@ -253,7 +251,7 @@ namespace bgfx
uint8_t numMips = 0;
for (uint32_t width = _width, height = _height, depth = _depth
- ; blockWidth < width && blockHeight < height && 1 < depth
+ ; blockWidth < width || blockHeight < height || 1 < depth
; ++numMips)
{
width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth);
@@ -326,7 +324,7 @@ namespace bgfx
}
}
- void imageRgba8Downsample2x2Ref(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst)
+ void imageRgba8Downsample2x2Ref(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
{
const uint32_t dstwidth = _width/2;
const uint32_t dstheight = _height/2;
@@ -340,35 +338,35 @@ namespace bgfx
uint8_t* dst = (uint8_t*)_dst;
const uint8_t* src = (const uint8_t*)_src;
- for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstheight; ++yy, src += ystep)
+ for (uint32_t yy = 0, ystep = _pitch*2; yy < dstheight; ++yy, src += ystep)
{
const uint8_t* rgba = src;
for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 8, dst += 4)
{
- float rr = powf(rgba[ 0], 2.2f);
- float gg = powf(rgba[ 1], 2.2f);
- float bb = powf(rgba[ 2], 2.2f);
- float aa = rgba[ 3];
- rr += powf(rgba[ 4], 2.2f);
- gg += powf(rgba[ 5], 2.2f);
- bb += powf(rgba[ 6], 2.2f);
- aa += rgba[ 7];
- rr += powf(rgba[_srcPitch+0], 2.2f);
- gg += powf(rgba[_srcPitch+1], 2.2f);
- bb += powf(rgba[_srcPitch+2], 2.2f);
- aa += rgba[_srcPitch+3];
- rr += powf(rgba[_srcPitch+4], 2.2f);
- gg += powf(rgba[_srcPitch+5], 2.2f);
- bb += powf(rgba[_srcPitch+6], 2.2f);
- aa += rgba[_srcPitch+7];
+ float rr = bx::fpow(rgba[ 0], 2.2f);
+ float gg = bx::fpow(rgba[ 1], 2.2f);
+ float bb = bx::fpow(rgba[ 2], 2.2f);
+ float aa = rgba[ 3];
+ rr += bx::fpow(rgba[ 4], 2.2f);
+ gg += bx::fpow(rgba[ 5], 2.2f);
+ bb += bx::fpow(rgba[ 6], 2.2f);
+ aa += rgba[ 7];
+ rr += bx::fpow(rgba[_pitch+0], 2.2f);
+ gg += bx::fpow(rgba[_pitch+1], 2.2f);
+ bb += bx::fpow(rgba[_pitch+2], 2.2f);
+ aa += rgba[_pitch+3];
+ rr += bx::fpow(rgba[_pitch+4], 2.2f);
+ gg += bx::fpow(rgba[_pitch+5], 2.2f);
+ bb += bx::fpow(rgba[_pitch+6], 2.2f);
+ aa += rgba[_pitch+7];
rr *= 0.25f;
gg *= 0.25f;
bb *= 0.25f;
aa *= 0.25f;
- rr = powf(rr, 1.0f/2.2f);
- gg = powf(gg, 1.0f/2.2f);
- bb = powf(bb, 1.0f/2.2f);
+ rr = bx::fpow(rr, 1.0f/2.2f);
+ gg = bx::fpow(gg, 1.0f/2.2f);
+ bb = bx::fpow(bb, 1.0f/2.2f);
dst[0] = (uint8_t)rr;
dst[1] = (uint8_t)gg;
dst[2] = (uint8_t)bb;
@@ -377,7 +375,7 @@ namespace bgfx
}
}
- void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst)
+ void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
{
const uint32_t dstwidth = _width/2;
const uint32_t dstheight = _height/2;
@@ -402,15 +400,15 @@ namespace bgfx
const float4_t linear = float4_ld(2.2f, 2.2f, 2.2f, 1.0f);
const float4_t quater = float4_splat(0.25f);
- for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstheight; ++yy, src += ystep)
+ for (uint32_t yy = 0, ystep = _pitch*2; yy < dstheight; ++yy, src += ystep)
{
const uint8_t* rgba = src;
for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 8, dst += 4)
{
const float4_t abgr0 = float4_splat(rgba);
const float4_t abgr1 = float4_splat(rgba+4);
- const float4_t abgr2 = float4_splat(rgba+_srcPitch);
- const float4_t abgr3 = float4_splat(rgba+_srcPitch+4);
+ const float4_t abgr2 = float4_splat(rgba+_pitch);
+ const float4_t abgr3 = float4_splat(rgba+_pitch+4);
const float4_t abgr0m = float4_and(abgr0, umask);
const float4_t abgr1m = float4_and(abgr1, umask);
@@ -458,13 +456,56 @@ namespace bgfx
}
}
- void imageSwizzleBgra8Ref(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst)
+ void imageRgba32fDownsample2x2NormalMapRef(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
+ {
+ const uint32_t dstwidth = _width/2;
+ const uint32_t dstheight = _height/2;
+
+ if (0 == dstwidth
+ || 0 == dstheight)
+ {
+ return;
+ }
+
+ const uint8_t* src = (const uint8_t*)_src;
+ uint8_t* dst = (uint8_t*)_dst;
+
+ for (uint32_t yy = 0, ystep = _pitch*2; yy < dstheight; ++yy, src += ystep)
+ {
+ const float* rgba0 = (const float*)&src[0];
+ const float* rgba1 = (const float*)&src[_pitch];
+ for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba0 += 8, rgba1 += 8, dst += 16)
+ {
+ float xyz[3];
+ xyz[0] = rgba0[0];
+ xyz[1] = rgba0[1];
+ xyz[2] = rgba0[2];
+ xyz[0] += rgba0[4];
+ xyz[1] += rgba0[5];
+ xyz[2] += rgba0[6];
+ xyz[0] += rgba1[0];
+ xyz[1] += rgba1[1];
+ xyz[2] += rgba1[2];
+ xyz[0] += rgba1[4];
+ xyz[1] += rgba1[5];
+ xyz[2] += rgba1[6];
+ bx::vec3Norm( (float*)dst, xyz);
+ }
+ }
+ }
+
+ void imageRgba32fDownsample2x2NormalMap(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
+ {
+ imageRgba32fDownsample2x2NormalMapRef(_width, _height, _pitch, _src, _dst);
+ }
+
+ void imageSwizzleBgra8Ref(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
{
const uint8_t* src = (uint8_t*) _src;
- const uint8_t* next = src + _srcPitch;
+ const uint8_t* next = src + _pitch;
uint8_t* dst = (uint8_t*)_dst;
- for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _srcPitch)
+ for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _pitch)
{
for (uint32_t xx = 0; xx < _width; ++xx, src += 4, dst += 4)
{
@@ -480,7 +521,7 @@ namespace bgfx
}
}
- void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst)
+ void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
{
// Test can we do four 4-byte pixels at the time.
if (0 != (_width&0x3)
@@ -492,7 +533,7 @@ namespace bgfx
BX_WARN(bx::isPtrAligned(_src, 16), "Source %p is not 16-byte aligned.", _src);
BX_WARN(bx::isPtrAligned(_dst, 16), "Destination %p is not 16-byte aligned.", _dst);
BX_WARN(_width < 4, "Image width must be multiple of 4 (width %d).", _width);
- imageSwizzleBgra8Ref(_width, _height, _srcPitch, _src, _dst);
+ imageSwizzleBgra8Ref(_width, _height, _pitch, _src, _dst);
return;
}
@@ -501,12 +542,12 @@ namespace bgfx
const float4_t mf0f0 = float4_isplat(0xff00ff00);
const float4_t m0f0f = float4_isplat(0x00ff00ff);
const uint8_t* src = (uint8_t*) _src;
- const uint8_t* next = src + _srcPitch;
+ const uint8_t* next = src + _pitch;
uint8_t* dst = (uint8_t*)_dst;
const uint32_t width = _width/4;
- for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _srcPitch)
+ for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _pitch)
{
for (uint32_t xx = 0; xx < width; ++xx, src += 16, dst += 16)
{
@@ -534,10 +575,856 @@ namespace bgfx
}
}
- void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst)
+ void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src, void* _dst)
{
const uint32_t dstPitch = _width*_bpp/8;
- imageCopy(_height, _srcPitch, _src, dstPitch, _dst);
+ imageCopy(_height, _pitch, _src, dstPitch, _dst);
+ }
+
+ uint32_t toUnorm(float _value, float _scale)
+ {
+ return uint32_t(bx::fround(
+ bx::fsaturate(_value) * _scale)
+ );
+ }
+
+ float fromUnorm(uint32_t _value, float _scale)
+ {
+ return float(_value) / _scale;
+ }
+
+ int32_t toSnorm(float _value, float _scale)
+ {
+ return int32_t(bx::fround(
+ bx::fclamp(_value, -1.0f, 1.0f) * _scale)
+ );
+ }
+
+ float fromSnorm(int32_t _value, float _scale)
+ {
+ return bx::fmax(-1.0f, float(_value) / _scale);
+ }
+
+ // R8
+ void packR8(void* _dst, const float* _src)
+ {
+ uint8_t* dst = (uint8_t*)_dst;
+ dst[0] = uint8_t(toUnorm(_src[0], 255.0f) );
+ }
+
+ void unpackR8(float* _dst, const void* _src)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ _dst[0] = fromUnorm(src[0], 255.0f);
+ }
+
+ // R8S
+ void packR8S(void* _dst, const float* _src)
+ {
+ int8_t* dst = (int8_t*)_dst;
+ dst[0] = int8_t(toSnorm(_src[0], 127.0f) );
+ }
+
+ void unpackR8S(float* _dst, const void* _src)
+ {
+ const int8_t* src = (const int8_t*)_src;
+ _dst[0] = fromSnorm(src[0], 127.0f);
+ }
+
+ // R8I
+ void packR8I(void* _dst, const float* _src)
+ {
+ int8_t* dst = (int8_t*)_dst;
+ dst[0] = int8_t(_src[0]);
+ }
+
+ void unpackR8I(float* _dst, const void* _src)
+ {
+ const int8_t* src = (const int8_t*)_src;
+ _dst[0] = float(src[0]);
+ }
+
+ // R8U
+ void packR8U(void* _dst, const float* _src)
+ {
+ uint8_t* dst = (uint8_t*)_dst;
+ dst[0] = uint8_t(_src[0]);
+ }
+
+ void unpackR8U(float* _dst, const void* _src)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ _dst[0] = float(src[0]);
+ }
+
+ // RG8
+ void packRg8(void* _dst, const float* _src)
+ {
+ uint8_t* dst = (uint8_t*)_dst;
+ dst[0] = uint8_t(toUnorm(_src[0], 255.0f) );
+ dst[1] = uint8_t(toUnorm(_src[1], 255.0f) );
+ }
+
+ void unpackRg8(float* _dst, const void* _src)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ _dst[0] = fromUnorm(src[0], 255.0f);
+ _dst[1] = fromUnorm(src[1], 255.0f);
+ }
+
+ // RG8S
+ void packRg8S(void* _dst, const float* _src)
+ {
+ int8_t* dst = (int8_t*)_dst;
+ dst[0] = int8_t(toSnorm(_src[0], 127.0f) );
+ dst[1] = int8_t(toSnorm(_src[1], 127.0f) );
+ }
+
+ void unpackRg8S(float* _dst, const void* _src)
+ {
+ const int8_t* src = (const int8_t*)_src;
+ _dst[0] = fromSnorm(src[0], 127.0f);
+ _dst[1] = fromSnorm(src[1], 127.0f);
+ }
+
+ // RG8I
+ void packRg8I(void* _dst, const float* _src)
+ {
+ int8_t* dst = (int8_t*)_dst;
+ dst[0] = int8_t(_src[0]);
+ dst[1] = int8_t(_src[1]);
+ }
+
+ void unpackRg8I(float* _dst, const void* _src)
+ {
+ const int8_t* src = (const int8_t*)_src;
+ _dst[0] = float(src[0]);
+ _dst[1] = float(src[1]);
+ }
+
+ // RG8U
+ void packRg8U(void* _dst, const float* _src)
+ {
+ uint8_t* dst = (uint8_t*)_dst;
+ dst[0] = uint8_t(_src[0]);
+ dst[1] = uint8_t(_src[1]);
+ }
+
+ void unpackRg8U(float* _dst, const void* _src)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ _dst[0] = float(src[0]);
+ _dst[1] = float(src[1]);
+ }
+
+ // RGBA8
+ void packRgba8(void* _dst, const float* _src)
+ {
+ uint8_t* dst = (uint8_t*)_dst;
+ dst[0] = uint8_t(toUnorm(_src[0], 255.0f) );
+ dst[1] = uint8_t(toUnorm(_src[1], 255.0f) );
+ dst[2] = uint8_t(toUnorm(_src[2], 255.0f) );
+ dst[3] = uint8_t(toUnorm(_src[3], 255.0f) );
+ }
+
+ void unpackRgba8(float* _dst, const void* _src)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ _dst[0] = fromUnorm(src[0], 255.0f);
+ _dst[1] = fromUnorm(src[1], 255.0f);
+ _dst[2] = fromUnorm(src[2], 255.0f);
+ _dst[3] = fromUnorm(src[3], 255.0f);
+ }
+
+ // BGRA8
+ void packBgra8(void* _dst, const float* _src)
+ {
+ uint8_t* dst = (uint8_t*)_dst;
+ dst[2] = uint8_t(toUnorm(_src[0], 255.0f) );
+ dst[1] = uint8_t(toUnorm(_src[1], 255.0f) );
+ dst[0] = uint8_t(toUnorm(_src[2], 255.0f) );
+ dst[3] = uint8_t(toUnorm(_src[3], 255.0f) );
+ }
+
+ void unpackBgra8(float* _dst, const void* _src)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ _dst[0] = fromUnorm(src[2], 255.0f);
+ _dst[1] = fromUnorm(src[1], 255.0f);
+ _dst[2] = fromUnorm(src[0], 255.0f);
+ _dst[3] = fromUnorm(src[3], 255.0f);
+ }
+
+ // RGBA8S
+ void packRgba8S(void* _dst, const float* _src)
+ {
+ int8_t* dst = (int8_t*)_dst;
+ dst[0] = int8_t(toSnorm(_src[0], 127.0f) );
+ dst[1] = int8_t(toSnorm(_src[1], 127.0f) );
+ dst[2] = int8_t(toSnorm(_src[2], 127.0f) );
+ dst[3] = int8_t(toSnorm(_src[3], 127.0f) );
+ }
+
+ void unpackRgba8S(float* _dst, const void* _src)
+ {
+ const int8_t* src = (const int8_t*)_src;
+ _dst[0] = fromSnorm(src[0], 127.0f);
+ _dst[1] = fromSnorm(src[1], 127.0f);
+ _dst[2] = fromSnorm(src[2], 127.0f);
+ _dst[3] = fromSnorm(src[3], 127.0f);
+ }
+
+ // RGBA8I
+ void packRgba8I(void* _dst, const float* _src)
+ {
+ int8_t* dst = (int8_t*)_dst;
+ dst[0] = int8_t(_src[0]);
+ dst[1] = int8_t(_src[1]);
+ dst[2] = int8_t(_src[2]);
+ dst[3] = int8_t(_src[3]);
+ }
+
+ void unpackRgba8I(float* _dst, const void* _src)
+ {
+ const int8_t* src = (const int8_t*)_src;
+ _dst[0] = float(src[0]);
+ _dst[1] = float(src[1]);
+ _dst[2] = float(src[2]);
+ _dst[3] = float(src[3]);
+ }
+
+ // RGBA8U
+ void packRgba8U(void* _dst, const float* _src)
+ {
+ uint8_t* dst = (uint8_t*)_dst;
+ dst[0] = uint8_t(_src[0]);
+ dst[1] = uint8_t(_src[1]);
+ dst[2] = uint8_t(_src[2]);
+ dst[3] = uint8_t(_src[3]);
+ }
+
+ void unpackRgba8U(float* _dst, const void* _src)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ _dst[0] = float(src[0]);
+ _dst[1] = float(src[1]);
+ _dst[2] = float(src[2]);
+ _dst[3] = float(src[3]);
+ }
+
+ // R16
+ void packR16(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = uint16_t(toUnorm(_src[0], 65535.0f) );
+ }
+
+ void unpackR16(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = fromUnorm(src[0], 65535.0f);
+ }
+
+ // R16S
+ void packR16S(void* _dst, const float* _src)
+ {
+ int16_t* dst = (int16_t*)_dst;
+ dst[0] = int16_t(toSnorm(_src[0], 32767.0f) );
+ }
+
+ void unpackR16S(float* _dst, const void* _src)
+ {
+ const int16_t* src = (const int16_t*)_src;
+ _dst[0] = fromSnorm(src[0], 32767.0f);
+ }
+
+ // R16I
+ void packR16I(void* _dst, const float* _src)
+ {
+ int16_t* dst = (int16_t*)_dst;
+ dst[0] = int16_t(_src[0]);
+ }
+
+ void unpackR16I(float* _dst, const void* _src)
+ {
+ const int16_t* src = (const int16_t*)_src;
+ _dst[0] = float(src[0]);
+ }
+
+ // R16U
+ void packR16U(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = uint16_t(_src[0]);
+ }
+
+ void unpackR16U(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = float(src[0]);
+ }
+
+ // R16F
+ void packR16F(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = bx::halfFromFloat(_src[0]);
+ }
+
+ void unpackR16F(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = bx::halfToFloat(src[0]);
+ }
+
+ // RG16
+ void packRg16(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = uint16_t(toUnorm(_src[0], 65535.0f) );
+ dst[1] = uint16_t(toUnorm(_src[1], 65535.0f) );
+ }
+
+ void unpackRg16(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = fromUnorm(src[0], 65535.0f);
+ _dst[1] = fromUnorm(src[1], 65535.0f);
+ }
+
+ // RG16S
+ void packRg16S(void* _dst, const float* _src)
+ {
+ int16_t* dst = (int16_t*)_dst;
+ dst[0] = int16_t(toSnorm(_src[0], 32767.0f) );
+ dst[1] = int16_t(toSnorm(_src[1], 32767.0f) );
+ }
+
+ void unpackRg16S(float* _dst, const void* _src)
+ {
+ const int16_t* src = (const int16_t*)_src;
+ _dst[0] = fromSnorm(src[0], 32767.0f);
+ _dst[1] = fromSnorm(src[1], 32767.0f);
+ }
+
+ // RG16I
+ void packRg16I(void* _dst, const float* _src)
+ {
+ int16_t* dst = (int16_t*)_dst;
+ dst[0] = int16_t(_src[0]);
+ dst[1] = int16_t(_src[1]);
+ }
+
+ void unpackRg16I(float* _dst, const void* _src)
+ {
+ const int16_t* src = (const int16_t*)_src;
+ _dst[0] = float(src[0]);
+ _dst[1] = float(src[1]);
+ }
+
+ // RG16U
+ void packRg16U(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = uint16_t(_src[0]);
+ dst[1] = uint16_t(_src[1]);
+ }
+
+ void unpackRg16U(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = float(src[0]);
+ _dst[1] = float(src[1]);
+ }
+
+ // RG16F
+ void packRg16F(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = bx::halfFromFloat(_src[0]);
+ dst[1] = bx::halfFromFloat(_src[1]);
+ }
+
+ void unpackRg16F(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = bx::halfToFloat(src[0]);
+ _dst[1] = bx::halfToFloat(src[1]);
+ }
+
+ // RGBA16
+ void packRgba16(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = uint16_t(toUnorm(_src[0], 65535.0f) );
+ dst[1] = uint16_t(toUnorm(_src[1], 65535.0f) );
+ dst[2] = uint16_t(toUnorm(_src[2], 65535.0f) );
+ dst[3] = uint16_t(toUnorm(_src[3], 65535.0f) );
+ }
+
+ void unpackRgba16(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = fromUnorm(src[0], 65535.0f);
+ _dst[1] = fromUnorm(src[1], 65535.0f);
+ _dst[2] = fromUnorm(src[2], 65535.0f);
+ _dst[3] = fromUnorm(src[3], 65535.0f);
+ }
+
+ // RGBA16S
+ void packRgba16S(void* _dst, const float* _src)
+ {
+ int16_t* dst = (int16_t*)_dst;
+ dst[0] = int16_t(toSnorm(_src[0], 32767.0f) );
+ dst[1] = int16_t(toSnorm(_src[1], 32767.0f) );
+ dst[2] = int16_t(toSnorm(_src[2], 32767.0f) );
+ dst[3] = int16_t(toSnorm(_src[3], 32767.0f) );
+ }
+
+ void unpackRgba16S(float* _dst, const void* _src)
+ {
+ const int16_t* src = (const int16_t*)_src;
+ _dst[0] = fromSnorm(src[0], 32767.0f);
+ _dst[1] = fromSnorm(src[1], 32767.0f);
+ _dst[2] = fromSnorm(src[2], 32767.0f);
+ _dst[3] = fromSnorm(src[3], 32767.0f);
+ }
+
+ // RGBA16I
+ void packRgba16I(void* _dst, const float* _src)
+ {
+ int16_t* dst = (int16_t*)_dst;
+ dst[0] = int16_t(_src[0]);
+ dst[1] = int16_t(_src[1]);
+ dst[2] = int16_t(_src[2]);
+ dst[3] = int16_t(_src[3]);
+ }
+
+ void unpackRgba16I(float* _dst, const void* _src)
+ {
+ const int16_t* src = (const int16_t*)_src;
+ _dst[0] = float(src[0]);
+ _dst[1] = float(src[1]);
+ _dst[2] = float(src[2]);
+ _dst[3] = float(src[3]);
+ }
+
+ // RGBA16U
+ void packRgba16U(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = uint16_t(_src[0]);
+ dst[1] = uint16_t(_src[1]);
+ dst[2] = uint16_t(_src[2]);
+ dst[3] = uint16_t(_src[3]);
+ }
+
+ void unpackRgba16U(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = float(src[0]);
+ _dst[1] = float(src[1]);
+ _dst[2] = float(src[2]);
+ _dst[3] = float(src[3]);
+ }
+
+ // RGBA16F
+ void packRgba16F(void* _dst, const float* _src)
+ {
+ uint16_t* dst = (uint16_t*)_dst;
+ dst[0] = bx::halfFromFloat(_src[0]);
+ dst[1] = bx::halfFromFloat(_src[1]);
+ dst[2] = bx::halfFromFloat(_src[2]);
+ dst[3] = bx::halfFromFloat(_src[3]);
+ }
+
+ void unpackRgba16F(float* _dst, const void* _src)
+ {
+ const uint16_t* src = (const uint16_t*)_src;
+ _dst[0] = bx::halfToFloat(src[0]);
+ _dst[1] = bx::halfToFloat(src[1]);
+ _dst[2] = bx::halfToFloat(src[2]);
+ _dst[3] = bx::halfToFloat(src[3]);
+ }
+
+ // R32I
+ void packR32I(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 4);
+ }
+
+ void unpackR32I(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 4);
+ }
+
+ // R32U
+ void packR32U(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 4);
+ }
+
+ void unpackR32U(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 4);
+ }
+
+ // R32F
+ void packR32F(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 4);
+ }
+
+ void unpackR32F(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 4);
+ }
+
+ // RG32I
+ void packRg32I(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 8);
+ }
+
+ void unpackRg32I(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 8);
+ }
+
+ // RG32U
+ void packRg32U(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 8);
+ }
+
+ void unpackRg32U(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 8);
+ }
+
+ // RG32F
+ void packRg32F(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 8);
+ }
+
+ void unpackRg32F(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 8);
+ }
+
+ template<int32_t MantissaBits, int32_t ExpBits>
+ void encodeRgbE(float* _dst, const float* _src)
+ {
+ // Reference:
+ // https://www.opengl.org/registry/specs/EXT/texture_shared_exponent.txt
+ const int32_t expMax = (1<<ExpBits) - 1;
+ const int32_t expBias = (1<<(ExpBits - 1) ) - 1;
+ const float sharedExpMax = float(expMax) / float(expMax + 1) * float(1 << (expMax - expBias) );
+
+ const float rr = bx::fclamp(_src[0], 0.0f, sharedExpMax);
+ const float gg = bx::fclamp(_src[1], 0.0f, sharedExpMax);
+ const float bb = bx::fclamp(_src[2], 0.0f, sharedExpMax);
+ const float max = bx::fmax3(rr, gg, bb);
+ union { float ff; uint32_t ui; } cast = { max };
+ int32_t expShared = int32_t(bx::uint32_imax(uint32_t(-expBias-1), ( ( (cast.ui>>23) & 0xff) - 127) ) ) + 1 + expBias;
+ float denom = bx::fpow(2.0f, float(expShared - expBias - MantissaBits) );
+
+ if ( (1<<MantissaBits) == int32_t(bx::fround(max/denom) ) )
+ {
+ denom *= 2.0f;
+ ++expShared;
+ }
+
+ const float invDenom = 1.0f/denom;
+ _dst[0] = bx::fround(rr * invDenom);
+ _dst[1] = bx::fround(gg * invDenom);
+ _dst[2] = bx::fround(bb * invDenom);
+ _dst[3] = float(expShared);
+ }
+
+ template<int32_t MantissaBits, int32_t ExpBits>
+ void decodeRgbE(float* _dst, const float* _src)
+ {
+ const int32_t expBias = (1<<(ExpBits - 1) ) - 1;
+ const float exponent = _src[3]-float(expBias-MantissaBits);
+ const float scale = bx::fpow(2.0f, exponent);
+ _dst[0] = _src[0] * scale;
+ _dst[1] = _src[1] * scale;
+ _dst[2] = _src[2] * scale;
+ }
+
+ // RGB9E5F
+ void packRgb9E5F(void* _dst, const float* _src)
+ {
+ float tmp[4];
+ encodeRgbE<9, 5>(tmp, _src);
+
+ *( (uint32_t*)_dst) = 0
+ | (uint32_t(tmp[0]) )
+ | (uint32_t(tmp[1]) << 9)
+ | (uint32_t(tmp[2]) <<18)
+ | (uint32_t(tmp[3]) <<27)
+ ;
+ }
+
+ void unpackRgb9E5F(float* _dst, const void* _src)
+ {
+ uint32_t packed = *( (const uint32_t*)_src);
+
+ float tmp[4];
+ tmp[0] = float( ( (packed ) & 0x1ff) ) / 511.0f;
+ tmp[1] = float( ( (packed>> 9) & 0x1ff) ) / 511.0f;
+ tmp[2] = float( ( (packed>>18) & 0x1ff) ) / 511.0f;
+ tmp[3] = float( ( (packed>>27) & 0x1f) );
+
+ decodeRgbE<9, 5>(_dst, tmp);
+ }
+
+ // RGBA32I
+ void packRgba32I(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 16);
+ }
+
+ void unpackRgba32I(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 16);
+ }
+
+ // RGBA32U
+ void packRgba32U(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 16);
+ }
+
+ void unpackRgba32U(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 16);
+ }
+
+ // RGBA32F
+ void packRgba32F(void* _dst, const float* _src)
+ {
+ memcpy(_dst, _src, 16);
+ }
+
+ void unpackRgba32F(float* _dst, const void* _src)
+ {
+ memcpy(_dst, _src, 16);
+ }
+
+ // R5G6B5
+ void packR5G6B5(void* _dst, const float* _src)
+ {
+ *( (uint16_t*)_dst) = 0
+ | uint16_t(toUnorm(_src[0], 31.0f) )
+ | uint16_t(toUnorm(_src[1], 63.0f)<< 5)
+ | uint16_t(toUnorm(_src[2], 31.0f)<<11)
+ ;
+ }
+
+ void unpackR5G6B5(float* _dst, const void* _src)
+ {
+ uint16_t packed = *( (const uint16_t*)_src);
+ _dst[0] = float( ( (packed ) & 0x1f) ) / 31.0f;
+ _dst[1] = float( ( (packed>> 5) & 0x3f) ) / 63.0f;
+ _dst[2] = float( ( (packed>>11) & 0x1f) ) / 31.0f;
+ }
+
+ // RGBA4
+ void packRgba4(void* _dst, const float* _src)
+ {
+ *( (uint16_t*)_dst) = 0
+ | uint16_t(toUnorm(_src[0], 15.0f) )
+ | uint16_t(toUnorm(_src[1], 15.0f)<< 4)
+ | uint16_t(toUnorm(_src[2], 15.0f)<< 8)
+ | uint16_t(toUnorm(_src[3], 15.0f)<<12)
+ ;
+ }
+
+ void unpackRgba4(float* _dst, const void* _src)
+ {
+ uint16_t packed = *( (const uint16_t*)_src);
+ _dst[0] = float( ( (packed ) & 0xf) ) / 15.0f;
+ _dst[1] = float( ( (packed>> 4) & 0xf) ) / 15.0f;
+ _dst[2] = float( ( (packed>> 8) & 0xf) ) / 15.0f;
+ _dst[3] = float( ( (packed>>12) & 0xf) ) / 15.0f;
+ }
+
+ // RGB5A1
+ void packRgb5a1(void* _dst, const float* _src)
+ {
+ *( (uint16_t*)_dst) = 0
+ | uint16_t(toUnorm(_src[0], 31.0f) )
+ | uint16_t(toUnorm(_src[1], 31.0f)<< 5)
+ | uint16_t(toUnorm(_src[2], 31.0f)<<10)
+ | uint16_t(toUnorm(_src[3], 1.0f)<<15)
+ ;
+ }
+
+ void unpackRgb5a1(float* _dst, const void* _src)
+ {
+ uint16_t packed = *( (const uint16_t*)_src);
+ _dst[0] = float( ( (packed ) & 0x1f) ) / 31.0f;
+ _dst[1] = float( ( (packed>> 5) & 0x1f) ) / 31.0f;
+ _dst[2] = float( ( (packed>>10) & 0x1f) ) / 31.0f;
+ _dst[3] = float( ( (packed>>14) & 0x1) );
+ }
+
+ // RGB10A2
+ void packRgb10A2(void* _dst, const float* _src)
+ {
+ *( (uint32_t*)_dst) = 0
+ | (toUnorm(_src[0], 1023.0f) )
+ | (toUnorm(_src[1], 1023.0f)<<10)
+ | (toUnorm(_src[2], 1023.0f)<<20)
+ | (toUnorm(_src[3], 3.0f)<<30)
+ ;
+ }
+
+ void unpackRgb10A2(float* _dst, const void* _src)
+ {
+ uint32_t packed = *( (const uint32_t*)_src);
+ _dst[0] = float( ( (packed ) & 0x3ff) ) / 1023.0f;
+ _dst[1] = float( ( (packed>>10) & 0x3ff) ) / 1023.0f;
+ _dst[2] = float( ( (packed>>20) & 0x3ff) ) / 1023.0f;
+ _dst[3] = float( ( (packed>>30) & 0x3) ) / 3.0f;
+ }
+
+ // R11G11B10F
+ void packR11G11B10F(void* _dst, const float* _src)
+ {
+ *( (uint32_t*)_dst) = 0
+ | ( (bx::halfFromFloat(_src[0])>> 4) & 0x7ff)
+ | ( (bx::halfFromFloat(_src[0])<< 7) & 0x3ff800)
+ | ( (bx::halfFromFloat(_src[0])<<17) & 0xffc00000)
+ ;
+ }
+
+ void unpackR11G11B10F(float* _dst, const void* _src)
+ {
+ uint32_t packed = *( (const uint32_t*)_src);
+ _dst[0] = bx::halfToFloat( (packed<< 4) & 0x7ff0);
+ _dst[1] = bx::halfToFloat( (packed>> 7) & 0x7ff0);
+ _dst[2] = bx::halfToFloat( (packed>>17) & 0x7fe0);
+ }
+
+ typedef void (*PackFn)(void*, const float*);
+ typedef void (*UnpackFn)(float*, const void*);
+
+ struct PackUnpack
+ {
+ PackFn pack;
+ UnpackFn unpack;
+ };
+
+ static PackUnpack s_packUnpack[] =
+ {
+ { NULL, NULL }, // BC1
+ { NULL, NULL }, // BC2
+ { NULL, NULL }, // BC3
+ { NULL, NULL }, // BC4
+ { NULL, NULL }, // BC5
+ { NULL, NULL }, // BC6H
+ { NULL, NULL }, // BC7
+ { NULL, NULL }, // ETC1
+ { NULL, NULL }, // ETC2
+ { NULL, NULL }, // ETC2A
+ { NULL, NULL }, // ETC2A1
+ { NULL, NULL }, // PTC12
+ { NULL, NULL }, // PTC14
+ { NULL, NULL }, // PTC12A
+ { NULL, NULL }, // PTC14A
+ { NULL, NULL }, // PTC22
+ { NULL, NULL }, // PTC24
+ { NULL, NULL }, // Unknown
+ { NULL, NULL }, // R1
+ { packR8, unpackR8 }, // A8
+ { packR8, unpackR8 }, // R8
+ { packR8I, unpackR8I }, // R8I
+ { packR8U, unpackR8U }, // R8U
+ { packR8S, unpackR8S }, // R8S
+ { packR16, unpackR16 }, // R16
+ { packR16I, unpackR16I }, // R16I
+ { packR16U, unpackR16U }, // R16U
+ { packR16F, unpackR16F }, // R16F
+ { packR16S, unpackR16S }, // R16S
+ { packR32I, unpackR32I }, // R32I
+ { packR32U, unpackR32U }, // R32U
+ { packR32F, unpackR32F }, // R32F
+ { packRg8, unpackRg8 }, // RG8
+ { packRg8I, unpackRg8I }, // RG8I
+ { packRg8U, unpackRg8U }, // RG8U
+ { packRg8S, unpackRg8S }, // RG8S
+ { packRg16, unpackRg16 }, // RG16
+ { packRg16I, unpackRg16I }, // RG16I
+ { packRg16U, unpackRg16U }, // RG16U
+ { packRg16F, unpackRg16F }, // RG16F
+ { packRg16S, unpackRg16S }, // RG16S
+ { packRg32I, unpackRg32I }, // RG32I
+ { packRg32U, unpackRg32U }, // RG32U
+ { packRg32F, unpackRg32F }, // RG32F
+ { packRgb9E5F, unpackRgb9E5F }, // RGB9E5F
+ { packBgra8, unpackBgra8 }, // BGRA8
+ { packRgba8, unpackRgba8 }, // RGBA8
+ { packRgba8I, unpackRgba8I }, // RGBA8I
+ { packRgba8U, unpackRgba8U }, // RGBA8U
+ { packRgba8S, unpackRgba8S }, // RGBA8S
+ { packRgba16, unpackRgba16 }, // RGBA16
+ { packRgba16I, unpackRgba16I }, // RGBA16I
+ { packRgba16U, unpackRgba16U }, // RGBA16U
+ { packRgba16F, unpackRgba16F }, // RGBA16F
+ { packRgba16S, unpackRgba16S }, // RGBA16S
+ { packRgba32I, unpackRgba32I }, // RGBA32I
+ { packRgba32U, unpackRgba32U }, // RGBA32U
+ { packRgba32F, unpackRgba32F }, // RGBA32F
+ { packR5G6B5, unpackR5G6B5 }, // R5G6B5
+ { packRgba4, unpackRgba4 }, // RGBA4
+ { packRgb5a1, unpackRgb5a1 }, // RGB5A1
+ { packRgb10A2, unpackRgb10A2 }, // RGB10A2
+ { packR11G11B10F, unpackR11G11B10F }, // R11G11B10F
+ { NULL, NULL }, // UnknownDepth
+ { NULL, NULL }, // D16
+ { NULL, NULL }, // D24
+ { NULL, NULL }, // D24S8
+ { NULL, NULL }, // D32
+ { NULL, NULL }, // D16F
+ { NULL, NULL }, // D24F
+ { NULL, NULL }, // D32F
+ { NULL, NULL }, // D0S8
+ };
+ BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_packUnpack) );
+
+ bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height)
+ {
+ UnpackFn unpack = s_packUnpack[_srcFormat].unpack;
+ PackFn pack = s_packUnpack[_dstFormat].pack;
+ if (NULL == pack
+ || NULL == unpack)
+ {
+ return false;
+ }
+
+ const uint8_t* src = (uint8_t*)_src;
+ uint8_t* dst = (uint8_t*)_dst;
+
+ const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel;
+ const uint32_t dstBpp = s_imageBlockInfo[_dstFormat].bitsPerPixel;
+ const uint32_t srcPitch = _width * srcBpp / 8;
+ const uint32_t dstPitch = _width * dstBpp / 8;
+
+ for (uint32_t yy = 0; yy < _height; ++yy, src += srcPitch, dst += dstPitch)
+ {
+ for (uint32_t xx = 0; xx < _width; ++xx)
+ {
+ float rgba[4];
+ unpack(rgba, &src[xx*srcBpp/8]);
+ pack(&dst[xx*dstBpp/8], rgba);
+ }
+ }
+
+ return true;
}
uint8_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to)
@@ -1324,6 +2211,34 @@ namespace bgfx
}
}
+ const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _mips)
+ {
+ const uint8_t numMips = _mips ? imageGetNumMips(_format, _width, _height) : 1;
+ uint32_t size = imageGetSize(_format, _width, _height, 0, false, numMips);
+ const Memory* image = alloc(size);
+
+ _imageContainer.m_data = image->data;
+ _imageContainer.m_format = _format;
+ _imageContainer.m_size = image->size;
+ _imageContainer.m_offset = 0;
+ _imageContainer.m_width = _width;
+ _imageContainer.m_height = _height;
+ _imageContainer.m_depth = _depth;
+ _imageContainer.m_numMips = numMips;
+ _imageContainer.m_hasAlpha = false;
+ _imageContainer.m_cubeMap = _cubeMap;
+ _imageContainer.m_ktx = false;
+ _imageContainer.m_ktxLE = false;
+ _imageContainer.m_srgb = false;
+
+ return image;
+ }
+
+ void imageFree(const Memory* _memory)
+ {
+ release(_memory);
+ }
+
// DDS
#define DDS_MAGIC BX_MAKEFOURCC('D', 'D', 'S', ' ')
#define DDS_HEADER_SIZE 124
@@ -1670,7 +2585,7 @@ namespace bgfx
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
- _imageContainer.m_format = uint8_t(format);
+ _imageContainer.m_format = format;
_imageContainer.m_numMips = uint8_t( (caps[0] & DDSCAPS_MIPMAP) ? mips : 1);
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = cubeMap;
@@ -1852,7 +2767,7 @@ namespace bgfx
{ KTX_RG32UI, KTX_ZERO, KTX_RG, KTX_UNSIGNED_INT, }, // RG32U
{ KTX_RG32F, KTX_ZERO, KTX_RG, KTX_FLOAT, }, // RG32F
{ KTX_RGB9_E5, KTX_ZERO, KTX_RGB, KTX_UNSIGNED_INT_5_9_9_9_REV, }, // RGB9E5F
- { KTX_RGBA8, KTX_SRGB8_ALPHA8, KTX_BGRA, KTX_UNSIGNED_BYTE, }, // BGRA8
+ { KTX_BGRA, KTX_SRGB8_ALPHA8, KTX_BGRA, KTX_UNSIGNED_BYTE, }, // BGRA8
{ KTX_RGBA8, KTX_SRGB8_ALPHA8, KTX_RGBA, KTX_UNSIGNED_BYTE, }, // RGBA8
{ KTX_RGBA8I, KTX_ZERO, KTX_RGBA, KTX_BYTE, }, // RGBA8I
{ KTX_RGBA8UI, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_BYTE, }, // RGBA8U
@@ -1946,7 +2861,7 @@ namespace bgfx
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
- _imageContainer.m_format = uint8_t(format);
+ _imageContainer.m_format = format;
_imageContainer.m_numMips = uint8_t(numMips);
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = numFaces > 1;
@@ -2094,7 +3009,7 @@ namespace bgfx
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
- _imageContainer.m_format = uint8_t(format);
+ _imageContainer.m_format = format;
_imageContainer.m_numMips = uint8_t(numMips);
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = numFaces > 1;
@@ -2161,16 +3076,17 @@ namespace bgfx
return imageParse(_imageContainer, &reader);
}
- void imageDecodeToBgra8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type)
+ void imageDecodeToBgra8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format)
{
- const uint8_t* src = _src;
+ const uint8_t* src = (const uint8_t*)_src;
+ uint8_t* dst = (uint8_t*)_dst;
uint32_t width = _width/4;
uint32_t height = _height/4;
uint8_t temp[16*4];
- switch (_type)
+ switch (_format)
{
case TextureFormat::BC1:
for (uint32_t yy = 0; yy < height; ++yy)
@@ -2180,11 +3096,11 @@ namespace bgfx
decodeBlockDxt1(temp, src);
src += 8;
- uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
- memcpy(&dst[0*_pitch], &temp[ 0], 16);
- memcpy(&dst[1*_pitch], &temp[16], 16);
- memcpy(&dst[2*_pitch], &temp[32], 16);
- memcpy(&dst[3*_pitch], &temp[48], 16);
+ uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
+ memcpy(&block[0*_pitch], &temp[ 0], 16);
+ memcpy(&block[1*_pitch], &temp[16], 16);
+ memcpy(&block[2*_pitch], &temp[32], 16);
+ memcpy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2199,11 +3115,11 @@ namespace bgfx
decodeBlockDxt(temp, src);
src += 8;
- uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
- memcpy(&dst[0*_pitch], &temp[ 0], 16);
- memcpy(&dst[1*_pitch], &temp[16], 16);
- memcpy(&dst[2*_pitch], &temp[32], 16);
- memcpy(&dst[3*_pitch], &temp[48], 16);
+ uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
+ memcpy(&block[0*_pitch], &temp[ 0], 16);
+ memcpy(&block[1*_pitch], &temp[16], 16);
+ memcpy(&block[2*_pitch], &temp[32], 16);
+ memcpy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2218,11 +3134,11 @@ namespace bgfx
decodeBlockDxt(temp, src);
src += 8;
- uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
- memcpy(&dst[0*_pitch], &temp[ 0], 16);
- memcpy(&dst[1*_pitch], &temp[16], 16);
- memcpy(&dst[2*_pitch], &temp[32], 16);
- memcpy(&dst[3*_pitch], &temp[48], 16);
+ uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
+ memcpy(&block[0*_pitch], &temp[ 0], 16);
+ memcpy(&block[1*_pitch], &temp[16], 16);
+ memcpy(&block[2*_pitch], &temp[32], 16);
+ memcpy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2235,11 +3151,11 @@ namespace bgfx
decodeBlockDxt45A(temp, src);
src += 8;
- uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
- memcpy(&dst[0*_pitch], &temp[ 0], 16);
- memcpy(&dst[1*_pitch], &temp[16], 16);
- memcpy(&dst[2*_pitch], &temp[32], 16);
- memcpy(&dst[3*_pitch], &temp[48], 16);
+ uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
+ memcpy(&block[0*_pitch], &temp[ 0], 16);
+ memcpy(&block[1*_pitch], &temp[16], 16);
+ memcpy(&block[2*_pitch], &temp[32], 16);
+ memcpy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2249,25 +3165,25 @@ namespace bgfx
{
for (uint32_t xx = 0; xx < width; ++xx)
{
- decodeBlockDxt45A(temp+1, src);
- src += 8;
decodeBlockDxt45A(temp+2, src);
src += 8;
+ decodeBlockDxt45A(temp+1, src);
+ src += 8;
for (uint32_t ii = 0; ii < 16; ++ii)
{
float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f;
float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f;
- float nz = sqrtf(1.0f - nx*nx - ny*ny);
+ float nz = bx::fsqrt(1.0f - nx*nx - ny*ny);
temp[ii*4+0] = uint8_t( (nz + 1.0f)*255.0f/2.0f);
temp[ii*4+3] = 0;
}
- uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
- memcpy(&dst[0*_pitch], &temp[ 0], 16);
- memcpy(&dst[1*_pitch], &temp[16], 16);
- memcpy(&dst[2*_pitch], &temp[32], 16);
- memcpy(&dst[3*_pitch], &temp[48], 16);
+ uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
+ memcpy(&block[0*_pitch], &temp[ 0], 16);
+ memcpy(&block[1*_pitch], &temp[16], 16);
+ memcpy(&block[2*_pitch], &temp[32], 16);
+ memcpy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2281,11 +3197,11 @@ namespace bgfx
decodeBlockEtc12(temp, src);
src += 8;
- uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
- memcpy(&dst[0*_pitch], &temp[ 0], 16);
- memcpy(&dst[1*_pitch], &temp[16], 16);
- memcpy(&dst[2*_pitch], &temp[32], 16);
- memcpy(&dst[3*_pitch], &temp[48], 16);
+ uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
+ memcpy(&block[0*_pitch], &temp[ 0], 16);
+ memcpy(&block[1*_pitch], &temp[16], 16);
+ memcpy(&block[2*_pitch], &temp[32], 16);
+ memcpy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2317,11 +3233,11 @@ namespace bgfx
{
decodeBlockPtc14(temp, src, xx, yy, width, height);
- uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
- memcpy(&dst[0*_pitch], &temp[ 0], 16);
- memcpy(&dst[1*_pitch], &temp[16], 16);
- memcpy(&dst[2*_pitch], &temp[32], 16);
- memcpy(&dst[3*_pitch], &temp[48], 16);
+ uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
+ memcpy(&block[0*_pitch], &temp[ 0], 16);
+ memcpy(&block[1*_pitch], &temp[16], 16);
+ memcpy(&block[2*_pitch], &temp[32], 16);
+ memcpy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2333,11 +3249,11 @@ namespace bgfx
{
decodeBlockPtc14A(temp, src, xx, yy, width, height);
- uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
- memcpy(&dst[0*_pitch], &temp[ 0], 16);
- memcpy(&dst[1*_pitch], &temp[16], 16);
- memcpy(&dst[2*_pitch], &temp[32], 16);
- memcpy(&dst[3*_pitch], &temp[48], 16);
+ uint8_t* block = &dst[(yy*_pitch+xx*4)*4];
+ memcpy(&block[0*_pitch], &temp[ 0], 16);
+ memcpy(&block[1*_pitch], &temp[16], 16);
+ memcpy(&block[2*_pitch], &temp[32], 16);
+ memcpy(&block[3*_pitch], &temp[48], 16);
}
}
break;
@@ -2367,9 +3283,9 @@ namespace bgfx
}
}
- void imageDecodeToRgba8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type)
+ void imageDecodeToRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format)
{
- switch (_type)
+ switch (_format)
{
case TextureFormat::RGBA8:
memcpy(_dst, _src, _pitch*_height);
@@ -2380,12 +3296,136 @@ namespace bgfx
break;
default:
- imageDecodeToBgra8(_dst, _src, _width, _height, _pitch, _type);
+ imageDecodeToBgra8(_dst, _src, _width, _height, _pitch, _format);
imageSwizzleBgra8(_width, _height, _pitch, _dst, _dst);
break;
}
}
+ void imageRgba8ToRgba32fRef(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
+ {
+ const uint32_t dstwidth = _width;
+ const uint32_t dstheight = _height;
+
+ if (0 == dstwidth
+ || 0 == dstheight)
+ {
+ return;
+ }
+
+ float* dst = (float*)_dst;
+ const uint8_t* src = (const uint8_t*)_src;
+
+ for (uint32_t yy = 0, ystep = _pitch; yy < dstheight; ++yy, src += ystep)
+ {
+ const uint8_t* rgba = src;
+ for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 4, dst += 4)
+ {
+ dst[0] = bx::fpow(rgba[0], 2.2f);
+ dst[1] = bx::fpow(rgba[1], 2.2f);
+ dst[2] = bx::fpow(rgba[2], 2.2f);
+ dst[3] = rgba[3];
+ }
+ }
+ }
+
+ void imageRgba8ToRgba32f(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
+ {
+ const uint32_t dstwidth = _width;
+ const uint32_t dstheight = _height;
+
+ if (0 == dstwidth
+ || 0 == dstheight)
+ {
+ return;
+ }
+
+ float* dst = (float*)_dst;
+ const uint8_t* src = (const uint8_t*)_src;
+
+ using namespace bx;
+ const float4_t unpack = float4_ld(1.0f, 1.0f/256.0f, 1.0f/65536.0f, 1.0f/16777216.0f);
+ const float4_t umask = float4_ild(0xff, 0xff00, 0xff0000, 0xff000000);
+ const float4_t wflip = float4_ild(0, 0, 0, 0x80000000);
+ const float4_t wadd = float4_ld(0.0f, 0.0f, 0.0f, 32768.0f*65536.0f);
+
+ for (uint32_t yy = 0, ystep = _pitch; yy < dstheight; ++yy, src += ystep)
+ {
+ const uint8_t* rgba = src;
+ for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 4, dst += 4)
+ {
+ const float4_t abgr0 = float4_splat(rgba);
+ const float4_t abgr0m = float4_and(abgr0, umask);
+ const float4_t abgr0x = float4_xor(abgr0m, wflip);
+ const float4_t abgr0f = float4_itof(abgr0x);
+ const float4_t abgr0c = float4_add(abgr0f, wadd);
+ const float4_t abgr0n = float4_mul(abgr0c, unpack);
+
+ float4_st(dst, abgr0n);
+ }
+ }
+ }
+
+ void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ uint8_t* dst = (uint8_t*)_dst;
+
+ switch (_format)
+ {
+ case TextureFormat::BC5:
+ {
+ uint32_t width = _width/4;
+ uint32_t height = _height/4;
+
+ for (uint32_t yy = 0; yy < height; ++yy)
+ {
+ for (uint32_t xx = 0; xx < width; ++xx)
+ {
+ uint8_t temp[16*4];
+
+ decodeBlockDxt45A(temp+2, src);
+ src += 8;
+ decodeBlockDxt45A(temp+1, src);
+ src += 8;
+
+ for (uint32_t ii = 0; ii < 16; ++ii)
+ {
+ float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f;
+ float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f;
+ float nz = bx::fsqrt(1.0f - nx*nx - ny*ny);
+
+ const uint32_t offset = (yy*4 + ii/4)*_width*16 + (xx*4 + ii%4)*16;
+ float* block = (float*)&dst[offset];
+ block[0] = nx;
+ block[1] = ny;
+ block[2] = nz;
+ block[3] = 0.0f;
+ }
+ }
+ }
+ }
+ break;
+
+ case TextureFormat::RGBA32F:
+ memcpy(_dst, _src, _pitch*_height);
+ break;
+
+ case TextureFormat::RGBA8:
+ imageRgba8ToRgba32f(_dst, _width, _height, _pitch, _src);
+ break;
+
+ default:
+ {
+ void* temp = BX_ALLOC(_allocator, imageGetSize(_format, uint16_t(_pitch/4), uint16_t(_height) ) );
+ imageDecodeToRgba8(temp, _src, _width, _height, _pitch, _format);
+ imageRgba8ToRgba32f(_dst, _width, _height, _pitch, temp);
+ BX_FREE(_allocator, temp);
+ }
+ break;
+ }
+ }
+
bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip)
{
uint32_t offset = _imageContainer.m_offset;
@@ -2443,7 +3483,7 @@ namespace bgfx
_mip.m_size = size;
_mip.m_data = &data[offset];
_mip.m_bpp = bpp;
- _mip.m_format = uint8_t(format);
+ _mip.m_format = format;
_mip.m_hasAlpha = hasAlpha;
return true;
}
@@ -2484,7 +3524,7 @@ namespace bgfx
_mip.m_size = size;
_mip.m_data = &data[offset];
_mip.m_bpp = bpp;
- _mip.m_format = uint8_t(format);
+ _mip.m_format = format;
_mip.m_hasAlpha = hasAlpha;
return true;
}
@@ -2504,7 +3544,7 @@ namespace bgfx
return false;
}
- void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip)
+ void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip)
{
uint8_t type = _grayscale ? 3 : 2;
uint8_t bpp = _grayscale ? 8 : 32;
@@ -2523,16 +3563,16 @@ namespace bgfx
uint32_t dstPitch = _width*bpp/8;
if (_yflip)
{
- uint8_t* data = (uint8_t*)_src + _srcPitch*_height - _srcPitch;
+ uint8_t* data = (uint8_t*)_src + _pitch*_height - _pitch;
for (uint32_t yy = 0; yy < _height; ++yy)
{
bx::write(_writer, data, dstPitch);
- data -= _srcPitch;
+ data -= _pitch;
}
}
- else if (_srcPitch == dstPitch)
+ else if (_pitch == dstPitch)
{
- bx::write(_writer, _src, _height*_srcPitch);
+ bx::write(_writer, _src, _height*_pitch);
}
else
{
@@ -2540,7 +3580,7 @@ namespace bgfx
for (uint32_t yy = 0; yy < _height; ++yy)
{
bx::write(_writer, data, dstPitch);
- data += _srcPitch;
+ data += _pitch;
}
}
}
diff --git a/3rdparty/bgfx/src/image.h b/3rdparty/bgfx/src/image.h
index 50824e5fd9e..458d7e51c46 100644
--- a/3rdparty/bgfx/src/image.h
+++ b/3rdparty/bgfx/src/image.h
@@ -13,12 +13,12 @@ namespace bgfx
struct ImageContainer
{
void* m_data;
+ TextureFormat::Enum m_format;
uint32_t m_size;
uint32_t m_offset;
uint32_t m_width;
uint32_t m_height;
uint32_t m_depth;
- uint8_t m_format;
uint8_t m_numMips;
bool m_hasAlpha;
bool m_cubeMap;
@@ -29,12 +29,12 @@ namespace bgfx
struct ImageMip
{
+ TextureFormat::Enum m_format;
uint32_t m_width;
uint32_t m_height;
uint32_t m_blockSize;
uint32_t m_size;
uint8_t m_bpp;
- uint8_t m_format;
bool m_hasAlpha;
const uint8_t* m_data;
};
@@ -103,19 +103,31 @@ namespace bgfx
void imageCheckerboard(uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1, void* _dst);
///
- void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst);
+ void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
///
- void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst);
+ void imageRgba32fDownsample2x2NormalMap(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
+
+ ///
+ void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
///
void imageCopy(uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch, void* _dst);
///
- void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst);
+ void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src, void* _dst);
+
+ ///
+ bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height);
+
+ ///
+ const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, bool _mips = false);
+
+ ///
+ void imageFree(const Memory* _memory);
///
- void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip);
+ void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip);
///
void imageWriteKtx(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, const void* _src);
@@ -130,10 +142,13 @@ namespace bgfx
bool imageParse(ImageContainer& _imageContainer, const void* _data, uint32_t _size);
///
- void imageDecodeToBgra8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type);
+ void imageDecodeToBgra8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format);
+
+ ///
+ void imageDecodeToRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format);
///
- void imageDecodeToRgba8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type);
+ void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format);
///
bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _index, const void* _data, uint32_t _size, ImageMip& _mip);
diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp
index 9fc75a8c452..4446d6b0324 100644
--- a/3rdparty/bgfx/src/renderer_d3d11.cpp
+++ b/3rdparty/bgfx/src/renderer_d3d11.cpp
@@ -487,6 +487,8 @@ namespace bgfx { namespace d3d11
return false;
};
+ // Reference:
+ // https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK
enum AGS_RETURN_CODE
{
AGS_SUCCESS,
@@ -1465,6 +1467,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
BGFX_GPU_PROFILER_BIND(m_device, m_deviceCtx);
+
+ g_internalData.context = m_device;
return true;
error:
@@ -1742,7 +1746,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = 1;
- tc.m_format = texture.m_requestedFormat;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
@@ -1753,14 +1757,30 @@ BX_PRAGMA_DIAGNOSTIC_POP();
release(mem);
}
+ void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE
+ {
+ // Resource ref. counts might be messed up outside of bgfx.
+ // Disabling ref. count check once texture is overridden.
+ setGraphicsDebuggerPresent(true);
+ m_textures[_handle.idx].overrideInternal(_ptr);
+ }
+
+ uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE
+ {
+ // Resource ref. counts might be messed up outside of bgfx.
+ // Disabling ref. count check once texture is overridden.
+ setGraphicsDebuggerPresent(true);
+ return uintptr_t(m_textures[_handle.idx].m_ptr);
+ }
+
void destroyTexture(TextureHandle _handle) BX_OVERRIDE
{
m_textures[_handle.idx].destroy();
}
- void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
+ void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE
{
- m_frameBuffers[_handle.idx].create(_num, _textureHandles);
+ m_frameBuffers[_handle.idx].create(_num, _attachment);
}
void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE
@@ -2224,6 +2244,9 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
else
{
+ m_deviceCtx->ClearState();
+ m_deviceCtx->Flush();
+
if (resize)
{
m_deviceCtx->OMSetRenderTargets(1, s_zero.m_rtv, NULL);
@@ -3078,6 +3101,13 @@ BX_PRAGMA_DIAGNOSTIC_POP();
D3D11_MAPPED_SUBRESOURCE mapped;
DX_CHECK(m_deviceCtx->Map(m_captureTexture, 0, D3D11_MAP_READ, 0, &mapped) );
+ imageSwizzleBgra8(getBufferWidth()
+ , getBufferHeight()
+ , mapped.RowPitch
+ , mapped.pData
+ , mapped.pData
+ );
+
g_callback->captureFrame(mapped.pData, getBufferHeight()*mapped.RowPitch);
m_deviceCtx->Unmap(m_captureTexture, 0);
@@ -3367,7 +3397,6 @@ BX_PRAGMA_DIAGNOSTIC_POP();
void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS];
Matrix4 m_predefinedUniforms[PredefinedUniform::Count];
UniformRegistry m_uniformReg;
- ViewState m_viewState;
StateCacheT<ID3D11BlendState> m_blendStateCache;
StateCacheT<ID3D11DepthStencilState> m_depthStencilStateCache;
@@ -3999,7 +4028,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
}
- const bool bufferOnly = 0 != (m_flags&(BGFX_TEXTURE_RT_BUFFER_ONLY|BGFX_TEXTURE_READ_BACK) );
+ const bool writeOnly = 0 != (m_flags&(BGFX_TEXTURE_RT_WRITE_ONLY|BGFX_TEXTURE_READ_BACK) );
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
const bool srgb = 0 != (m_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
@@ -4043,7 +4072,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
desc.Format = format;
desc.SampleDesc = msaa;
desc.Usage = kk == 0 || blit ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
- desc.BindFlags = bufferOnly ? 0 : D3D11_BIND_SHADER_RESOURCE;
+ desc.BindFlags = writeOnly ? 0 : D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0;
if (isDepth( (TextureFormat::Enum)m_textureFormat) )
@@ -4116,7 +4145,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
break;
}
- if (!bufferOnly)
+ if (!writeOnly)
{
DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, &srvd, &m_srv) );
}
@@ -4147,7 +4176,19 @@ BX_PRAGMA_DIAGNOSTIC_POP();
s_renderD3D11->m_srvUavLru.invalidateWithParent(getHandle().idx);
DX_RELEASE(m_srv, 0);
DX_RELEASE(m_uav, 0);
- DX_RELEASE(m_ptr, 0);
+ if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) )
+ {
+ DX_RELEASE(m_ptr, 0);
+ }
+ }
+
+ void TextureD3D11::overrideInternal(uintptr_t _ptr)
+ {
+ destroy();
+ m_flags |= BGFX_TEXTURE_INTERNAL_SHARED;
+ m_ptr = (ID3D11Resource*)_ptr;
+
+ s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, NULL, &m_srv);
}
void TextureD3D11::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
@@ -4175,7 +4216,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
- imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat);
+ imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, TextureFormat::Enum(m_requestedFormat) );
data = temp;
}
@@ -4211,7 +4252,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
return handle;
}
- void FrameBufferD3D11::create(uint8_t _num, const TextureHandle* _handles)
+ void FrameBufferD3D11::create(uint8_t _num, const Attachment* _attachment)
{
for (uint32_t ii = 0; ii < BX_COUNTOF(m_rtv); ++ii)
{
@@ -4221,7 +4262,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
m_swapChain = NULL;
m_numTh = _num;
- memcpy(m_th, _handles, _num*sizeof(TextureHandle) );
+ memcpy(m_attachment, _attachment, _num*sizeof(Attachment) );
postReset();
}
@@ -4314,7 +4355,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
m_num = 0;
for (uint32_t ii = 0; ii < m_numTh; ++ii)
{
- TextureHandle handle = m_th[ii];
+ TextureHandle handle = m_attachment[ii].handle;
if (isValid(handle) )
{
const TextureD3D11& texture = s_renderD3D11->m_textures[handle.idx];
@@ -4363,7 +4404,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
: D3D11_DSV_DIMENSION_TEXTURE2D
;
dsvDesc.Flags = 0;
- dsvDesc.Texture2D.MipSlice = 0;
+ dsvDesc.Texture2D.MipSlice = m_attachment[ii].mip;
DX_CHECK(s_renderD3D11->m_device->CreateDepthStencilView(texture.m_ptr, &dsvDesc, &m_dsv) );
}
break;
@@ -4376,14 +4417,14 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY;
dsvDesc.Texture2DMSArray.ArraySize = 1;
- dsvDesc.Texture2DMSArray.FirstArraySlice = 0;
+ dsvDesc.Texture2DMSArray.FirstArraySlice = m_attachment[ii].layer;
}
else
{
dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
dsvDesc.Texture2DArray.ArraySize = 1;
- dsvDesc.Texture2DArray.FirstArraySlice = 0;
- dsvDesc.Texture2DArray.MipSlice = 0;
+ dsvDesc.Texture2DArray.FirstArraySlice = m_attachment[ii].layer;
+ dsvDesc.Texture2DArray.MipSlice = m_attachment[ii].mip;
}
dsvDesc.Flags = 0;
DX_CHECK(s_renderD3D11->m_device->CreateDepthStencilView(texture.m_ptr, &dsvDesc, &m_dsv) );
@@ -4397,7 +4438,20 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
default:
case TextureD3D11::Texture2D:
- DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, NULL, &m_rtv[m_num]) );
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC desc;
+ desc.Format = s_textureFormat[texture.m_textureFormat].m_fmt;
+ if (1 < msaa.Count)
+ {
+ desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
+ }
+ else
+ {
+ desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ desc.Texture2D.MipSlice = m_attachment[ii].mip;
+ }
+ DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) );
+ }
break;
case TextureD3D11::TextureCube:
@@ -4408,14 +4462,14 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY;
desc.Texture2DMSArray.ArraySize = 1;
- desc.Texture2DMSArray.FirstArraySlice = 0;
+ desc.Texture2DMSArray.FirstArraySlice = m_attachment[ii].layer;
}
else
{
desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
desc.Texture2DArray.ArraySize = 1;
- desc.Texture2DArray.FirstArraySlice = 0;
- desc.Texture2DArray.MipSlice = 0;
+ desc.Texture2DArray.FirstArraySlice = m_attachment[ii].layer;
+ desc.Texture2DArray.MipSlice = m_attachment[ii].mip;
}
DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) );
}
@@ -4426,9 +4480,9 @@ BX_PRAGMA_DIAGNOSTIC_POP();
D3D11_RENDER_TARGET_VIEW_DESC desc;
desc.Format = s_textureFormat[texture.m_textureFormat].m_fmt;
desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
- desc.Texture3D.MipSlice = 0;
+ desc.Texture3D.MipSlice = m_attachment[ii].mip;
desc.Texture3D.WSize = 1;
- desc.Texture3D.FirstWSlice = 0;
+ desc.Texture3D.FirstWSlice = m_attachment[ii].layer;
DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) );
}
break;
@@ -4687,8 +4741,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
_render->m_hmdInitialized = m_ovr.isInitialized();
const bool hmdEnabled = m_ovr.isEnabled() || m_ovr.isDebug();
- ViewState& viewState = m_viewState;
- viewState.reset(_render, hmdEnabled);
+ ViewState viewState(_render, hmdEnabled);
bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME);
bool scissorEnabled = false;
@@ -4727,7 +4780,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
// reset the framebuffer to be the backbuffer; depending on the swap effect,
// if we don't do this we'll only see one frame of output and then nothing
- setFrameBuffer(fbh);
+ FrameBufferHandle invalid = BGFX_INVALID_HANDLE;
+ setFrameBuffer(invalid);
bool viewRestart = false;
uint8_t eye = 0;
@@ -4887,12 +4941,18 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
else
{
+ bool depthStencil = isDepth(TextureFormat::Enum(src.m_textureFormat) );
+ BX_CHECK(!depthStencil
+ || (width == src.m_width && height == src.m_height)
+ , "When blitting depthstencil surface, source resolution must match destination."
+ );
+
D3D11_BOX box;
box.left = blit.m_srcX;
box.top = blit.m_srcY;
box.front = 0;
box.right = blit.m_srcX + width;
- box.bottom = blit.m_srcY + height;;
+ box.bottom = blit.m_srcY + height;
box.back = 1;
const uint32_t srcZ = TextureD3D11::TextureCube == src.m_type
@@ -4904,7 +4964,6 @@ BX_PRAGMA_DIAGNOSTIC_POP();
: 0
;
- bool depthStencil = isDepth(TextureFormat::Enum(src.m_textureFormat) );
deviceCtx->CopySubresourceRegion(dst.m_ptr
, dstZ*dst.m_numMips+blit.m_dstMip
, blit.m_dstX
diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h
index 67c05eb8161..833eda40e1a 100644
--- a/3rdparty/bgfx/src/renderer_d3d11.h
+++ b/3rdparty/bgfx/src/renderer_d3d11.h
@@ -223,6 +223,7 @@ namespace bgfx { namespace d3d11
void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
void destroy();
+ void overrideInternal(uintptr_t _ptr);
void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
void commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]);
void resolve();
@@ -260,7 +261,7 @@ namespace bgfx { namespace d3d11
{
}
- void create(uint8_t _num, const TextureHandle* _handles);
+ void create(uint8_t _num, const Attachment* _attachment);
void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat);
uint16_t destroy();
void preReset(bool _force = false);
@@ -277,7 +278,7 @@ namespace bgfx { namespace d3d11
uint16_t m_denseIdx;
uint8_t m_num;
uint8_t m_numTh;
- TextureHandle m_th[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
+ Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
};
struct TimerQueryD3D11
diff --git a/3rdparty/bgfx/src/renderer_d3d12.cpp b/3rdparty/bgfx/src/renderer_d3d12.cpp
index 22251bebf9d..409d33bce10 100644
--- a/3rdparty/bgfx/src/renderer_d3d12.cpp
+++ b/3rdparty/bgfx/src/renderer_d3d12.cpp
@@ -1042,6 +1042,8 @@ namespace bgfx { namespace d3d12
m_gpuTimer.init();
m_occlusionQuery.init();
}
+
+ g_internalData.context = m_device;
return true;
error:
@@ -1359,7 +1361,7 @@ namespace bgfx { namespace d3d12
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = 1;
- tc.m_format = texture.m_requestedFormat;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
@@ -1370,14 +1372,25 @@ namespace bgfx { namespace d3d12
release(mem);
}
+ void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE
+ {
+ BX_UNUSED(_handle, _ptr);
+ }
+
+ uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE
+ {
+ BX_UNUSED(_handle);
+ return 0;
+ }
+
void destroyTexture(TextureHandle _handle) BX_OVERRIDE
{
m_textures[_handle.idx].destroy();
}
- void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
+ void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE
{
- m_frameBuffers[_handle.idx].create(_num, _textureHandles);
+ m_frameBuffers[_handle.idx].create(_num, _attachment);
}
void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE
@@ -1860,8 +1873,8 @@ data.NumQualityLevels = 0;
if (isValid(frameBuffer.m_depth) )
{
TextureD3D12& texture = m_textures[frameBuffer.m_depth.idx];
- const bool bufferOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
- if (!bufferOnly)
+ const bool writeOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
+ if (!writeOnly)
{
texture.setState(m_commandList, D3D12_RESOURCE_STATE_DEPTH_READ);
}
@@ -3801,7 +3814,7 @@ data.NumQualityLevels = 0;
blockHeight = blockInfo.blockHeight;
}
- const bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
+ const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
@@ -3813,7 +3826,7 @@ data.NumQualityLevels = 0;
, textureHeight
, imageContainer.m_cubeMap ? "x6" : ""
, renderTarget ? 'x' : ' '
- , bufferOnly ? 'x' : ' '
+ , writeOnly ? 'x' : ' '
, computeWrite ? 'x' : ' '
, swizzle ? " (swizzle BGRA8 -> RGBA8)" : ""
);
@@ -3969,7 +3982,7 @@ data.NumQualityLevels = 0;
resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
}
- if (bufferOnly)
+ if (writeOnly)
{
resourceDesc.Flags |= D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
state &= ~D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
@@ -4171,10 +4184,10 @@ data.NumQualityLevels = 0;
return _state;
}
- void FrameBufferD3D12::create(uint8_t _num, const TextureHandle* _handles)
+ void FrameBufferD3D12::create(uint8_t _num, const Attachment* _attachment)
{
m_numTh = _num;
- memcpy(m_th, _handles, _num*sizeof(TextureHandle) );
+ memcpy(m_attachment, _attachment, _num*sizeof(Attachment) );
postReset();
}
@@ -4204,7 +4217,7 @@ data.NumQualityLevels = 0;
m_num = 0;
for (uint32_t ii = 0; ii < m_numTh; ++ii)
{
- TextureHandle handle = m_th[ii];
+ TextureHandle handle = m_attachment[ii].handle;
if (isValid(handle) )
{
const TextureD3D12& texture = s_renderD3D12->m_textures[handle.idx];
diff --git a/3rdparty/bgfx/src/renderer_d3d12.h b/3rdparty/bgfx/src/renderer_d3d12.h
index d046b275142..39f165a03da 100644
--- a/3rdparty/bgfx/src/renderer_d3d12.h
+++ b/3rdparty/bgfx/src/renderer_d3d12.h
@@ -295,7 +295,7 @@ namespace bgfx { namespace d3d12
m_depth.idx = bgfx::invalidHandle;
}
- void create(uint8_t _num, const TextureHandle* _handles);
+ void create(uint8_t _num, const Attachment* _attachment);
void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat);
uint16_t destroy();
void preReset();
@@ -311,7 +311,7 @@ namespace bgfx { namespace d3d12
uint16_t m_denseIdx;
uint8_t m_num;
uint8_t m_numTh;
- TextureHandle m_th[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
+ Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
};
struct CommandQueueD3D12
diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp
index dc51a9eef3f..919a952260b 100644
--- a/3rdparty/bgfx/src/renderer_d3d9.cpp
+++ b/3rdparty/bgfx/src/renderer_d3d9.cpp
@@ -603,85 +603,85 @@ namespace bgfx { namespace d3d9
s_textureFormat[TextureFormat::BC5].m_fmt = s_extendedFormats[ExtendedFormat::Ati2].m_supported ? D3DFMT_ATI2 : D3DFMT_UNKNOWN;
g_caps.supported |= m_instancingSupport ? BGFX_CAPS_INSTANCING : 0;
+ }
- for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
- {
- uint8_t support = 0;
+ for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
+ {
+ uint8_t support = 0;
- support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
- , m_deviceType
- , adapterFormat
- , 0
- , D3DRTYPE_TEXTURE
- , s_textureFormat[ii].m_fmt
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D : BGFX_CAPS_FORMAT_TEXTURE_NONE;
-
- support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
- , m_deviceType
- , adapterFormat
- , D3DUSAGE_QUERY_SRGBREAD
- , D3DRTYPE_TEXTURE
- , s_textureFormat[ii].m_fmt
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE;
-
- support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
- , m_deviceType
- , adapterFormat
- , 0
- , D3DRTYPE_VOLUMETEXTURE
- , s_textureFormat[ii].m_fmt
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D : BGFX_CAPS_FORMAT_TEXTURE_NONE;
-
- support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
- , m_deviceType
- , adapterFormat
- , D3DUSAGE_QUERY_SRGBREAD
- , D3DRTYPE_VOLUMETEXTURE
- , s_textureFormat[ii].m_fmt
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE;
-
- support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
- , m_deviceType
- , adapterFormat
- , 0
- , D3DRTYPE_CUBETEXTURE
- , s_textureFormat[ii].m_fmt
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE : BGFX_CAPS_FORMAT_TEXTURE_NONE;
-
- support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
- , m_deviceType
- , adapterFormat
- , D3DUSAGE_QUERY_SRGBREAD
- , D3DRTYPE_CUBETEXTURE
- , s_textureFormat[ii].m_fmt
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE;
-
- support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
- , m_deviceType
- , adapterFormat
- , D3DUSAGE_QUERY_VERTEXTEXTURE
- , D3DRTYPE_TEXTURE
- , s_textureFormat[ii].m_fmt
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_VERTEX : BGFX_CAPS_FORMAT_TEXTURE_NONE;
-
- support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
- , m_deviceType
- , adapterFormat
- , isDepth(TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET
- , D3DRTYPE_TEXTURE
- , s_textureFormat[ii].m_fmt
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER : BGFX_CAPS_FORMAT_TEXTURE_NONE;
-
- support |= SUCCEEDED(m_d3d9->CheckDeviceMultiSampleType(m_adapter
- , m_deviceType
- , s_textureFormat[ii].m_fmt
- , true
- , D3DMULTISAMPLE_2_SAMPLES
- , NULL
- ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+ support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
+ , m_deviceType
+ , adapterFormat
+ , 0
+ , D3DRTYPE_TEXTURE
+ , s_textureFormat[ii].m_fmt
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D : BGFX_CAPS_FORMAT_TEXTURE_NONE;
- g_caps.formats[ii] = support;
- }
+ support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
+ , m_deviceType
+ , adapterFormat
+ , D3DUSAGE_QUERY_SRGBREAD
+ , D3DRTYPE_TEXTURE
+ , s_textureFormat[ii].m_fmt
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+
+ support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
+ , m_deviceType
+ , adapterFormat
+ , 0
+ , D3DRTYPE_VOLUMETEXTURE
+ , s_textureFormat[ii].m_fmt
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+
+ support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
+ , m_deviceType
+ , adapterFormat
+ , D3DUSAGE_QUERY_SRGBREAD
+ , D3DRTYPE_VOLUMETEXTURE
+ , s_textureFormat[ii].m_fmt
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+
+ support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
+ , m_deviceType
+ , adapterFormat
+ , 0
+ , D3DRTYPE_CUBETEXTURE
+ , s_textureFormat[ii].m_fmt
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+
+ support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
+ , m_deviceType
+ , adapterFormat
+ , D3DUSAGE_QUERY_SRGBREAD
+ , D3DRTYPE_CUBETEXTURE
+ , s_textureFormat[ii].m_fmt
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+
+ support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
+ , m_deviceType
+ , adapterFormat
+ , D3DUSAGE_QUERY_VERTEXTEXTURE
+ , D3DRTYPE_TEXTURE
+ , s_textureFormat[ii].m_fmt
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_VERTEX : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+
+ support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
+ , m_deviceType
+ , adapterFormat
+ , isDepth(TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET
+ , D3DRTYPE_TEXTURE
+ , s_textureFormat[ii].m_fmt
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+
+ support |= SUCCEEDED(m_d3d9->CheckDeviceMultiSampleType(m_adapter
+ , m_deviceType
+ , s_textureFormat[ii].m_fmt
+ , true
+ , D3DMULTISAMPLE_2_SAMPLES
+ , NULL
+ ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA : BGFX_CAPS_FORMAT_TEXTURE_NONE;
+
+ g_caps.formats[ii] = support;
}
m_fmtDepth = D3DFMT_D24S8;
@@ -752,6 +752,7 @@ namespace bgfx { namespace d3d9
m_initialized = true;
+ g_internalData.context = m_device;
return true;
error:
@@ -996,14 +997,30 @@ namespace bgfx { namespace d3d9
texture.m_height = _height;
}
+ void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE
+ {
+ // Resource ref. counts might be messed up outside of bgfx.
+ // Disabling ref. count check once texture is overridden.
+ setGraphicsDebuggerPresent(true);
+ m_textures[_handle.idx].overrideInternal(_ptr);
+ }
+
+ uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE
+ {
+ // Resource ref. counts might be messed up outside of bgfx.
+ // Disabling ref. count check once texture is overridden.
+ setGraphicsDebuggerPresent(true);
+ return uintptr_t(m_textures[_handle.idx].m_ptr);
+ }
+
void destroyTexture(TextureHandle _handle) BX_OVERRIDE
{
m_textures[_handle.idx].destroy();
}
- void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
+ void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE
{
- m_frameBuffers[_handle.idx].create(_num, _textureHandles);
+ m_frameBuffers[_handle.idx].create(_num, _attachment);
}
void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE
@@ -1925,30 +1942,34 @@ namespace bgfx { namespace d3d9
device->SetVertexShader(program.m_vsh->m_vertexShader);
device->SetPixelShader(program.m_fsh->m_pixelShader);
+ float mrtClear[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4];
+
if (BGFX_CLEAR_COLOR_USE_PALETTE & _clear.m_flags)
{
- float mrtClear[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4];
for (uint32_t ii = 0; ii < numMrt; ++ii)
{
- uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]);
+ uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE - 1, _clear.m_index[ii]);
memcpy(mrtClear[ii], _palette[index], 16);
}
-
- DX_CHECK(m_device->SetPixelShaderConstantF(0, mrtClear[0], numMrt) );
}
else
{
float rgba[4] =
{
- _clear.m_index[0]*1.0f/255.0f,
- _clear.m_index[1]*1.0f/255.0f,
- _clear.m_index[2]*1.0f/255.0f,
- _clear.m_index[3]*1.0f/255.0f,
+ _clear.m_index[0] * 1.0f / 255.0f,
+ _clear.m_index[1] * 1.0f / 255.0f,
+ _clear.m_index[2] * 1.0f / 255.0f,
+ _clear.m_index[3] * 1.0f / 255.0f,
};
- DX_CHECK(m_device->SetPixelShaderConstantF(0, rgba, 1) );
+ for (uint32_t ii = 0; ii < numMrt; ++ii)
+ {
+ memcpy(mrtClear[ii], rgba, 16);
+ }
}
+ DX_CHECK(device->SetPixelShaderConstantF(0, mrtClear[0], numMrt));
+
DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, stride) );
DX_CHECK(device->SetStreamSourceFreq(0, 1) );
DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) );
@@ -2427,10 +2448,10 @@ namespace bgfx { namespace d3d9
uint32_t msaaQuality = ( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT);
msaaQuality = bx::uint32_satsub(msaaQuality, 1);
- bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
+ bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
if (0 != msaaQuality
- || bufferOnly)
+ || writeOnly)
{
const Msaa& msaa = s_msaa[msaaQuality];
@@ -2461,7 +2482,7 @@ namespace bgfx { namespace d3d9
) );
}
- if (bufferOnly)
+ if (writeOnly)
{
// This is render buffer, there is no sampling, no need
// to create texture.
@@ -2798,8 +2819,8 @@ namespace bgfx { namespace d3d9
m_height = textureHeight;
m_depth = imageContainer.m_depth;
m_numMips = numMips;
- m_requestedFormat = imageContainer.m_format;
- m_textureFormat = imageContainer.m_format;
+ m_requestedFormat =
+ m_textureFormat = uint8_t(imageContainer.m_format);
const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat];
uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
@@ -2837,7 +2858,7 @@ namespace bgfx { namespace d3d9
, 0 != (m_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
);
- if (0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY) )
+ if (0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY) )
{
return;
}
@@ -2892,13 +2913,7 @@ namespace bgfx { namespace d3d9
, mip.m_format
);
- uint32_t dstpitch = pitch;
- for (uint32_t yy = 0; yy < height; ++yy)
- {
- uint8_t* src = &temp[yy*srcpitch];
- uint8_t* dst = &bits[yy*dstpitch];
- memcpy(dst, src, dstpitch);
- }
+ bx::memCopy(bits, temp, pitch, height, srcpitch, pitch);
BX_FREE(g_allocator, temp);
}
@@ -2950,7 +2965,7 @@ namespace bgfx { namespace d3d9
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
- imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat);
+ imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, TextureFormat::Enum(m_requestedFormat) );
data = temp;
}
@@ -3047,7 +3062,7 @@ namespace bgfx { namespace d3d9
}
}
- void FrameBufferD3D9::create(uint8_t _num, const TextureHandle* _handles)
+ void FrameBufferD3D9::create(uint8_t _num, const Attachment* _attachment)
{
for (uint32_t ii = 0; ii < BX_COUNTOF(m_color); ++ii)
{
@@ -3059,7 +3074,7 @@ namespace bgfx { namespace d3d9
m_needResolve = false;
for (uint32_t ii = 0; ii < _num; ++ii)
{
- TextureHandle handle = _handles[ii];
+ TextureHandle handle = _attachment[ii].handle;
if (isValid(handle) )
{
const TextureD3D9& texture = s_renderD3D9->m_textures[handle.idx];
@@ -3087,7 +3102,7 @@ namespace bgfx { namespace d3d9
}
else
{
- m_color[m_num] = texture.getSurface();
+ m_color[m_num] = texture.getSurface(uint8_t(_attachment[ii].layer) );
}
m_num++;
}
diff --git a/3rdparty/bgfx/src/renderer_d3d9.h b/3rdparty/bgfx/src/renderer_d3d9.h
index 0bef1737058..0b0e030dc5c 100644
--- a/3rdparty/bgfx/src/renderer_d3d9.h
+++ b/3rdparty/bgfx/src/renderer_d3d9.h
@@ -325,12 +325,22 @@ namespace bgfx { namespace d3d9
void destroy()
{
- DX_RELEASE(m_ptr, 0);
+ if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) )
+ {
+ DX_RELEASE(m_ptr, 0);
+ }
DX_RELEASE(m_surface, 0);
DX_RELEASE(m_staging, 0);
m_textureFormat = TextureFormat::Unknown;
}
+ void overrideInternal(uintptr_t _ptr)
+ {
+ destroy();
+ m_flags |= BGFX_TEXTURE_INTERNAL_SHARED;
+ m_ptr = (IDirect3DBaseTexture9*)_ptr;
+ }
+
void updateBegin(uint8_t _side, uint8_t _mip);
void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
void updateEnd();
@@ -379,7 +389,7 @@ namespace bgfx { namespace d3d9
m_depthHandle.idx = invalidHandle;
}
- void create(uint8_t _num, const TextureHandle* _handles);
+ void create(uint8_t _num, const Attachment* _attachment);
void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat);
uint16_t destroy();
HRESULT present();
diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp
index 35fbdc427cf..0feccaf9680 100644
--- a/3rdparty/bgfx/src/renderer_gl.cpp
+++ b/3rdparty/bgfx/src/renderer_gl.cpp
@@ -260,9 +260,9 @@ namespace bgfx { namespace gl
{ GL_RGBA32I, GL_ZERO, GL_RGBA, GL_INT, false }, // RGBA32I
{ GL_RGBA32UI, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT, false }, // RGBA32U
{ GL_RGBA32F, GL_ZERO, GL_RGBA, GL_FLOAT, false }, // RGBA32F
- { GL_RGB565, GL_ZERO, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, false }, // R5G6B5
- { GL_RGBA4, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, false }, // RGBA4
- { GL_RGB5_A1, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, false }, // RGB5A1
+ { GL_RGB565, GL_ZERO, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false }, // R5G6B5
+ { GL_RGBA4, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, false }, // RGBA4
+ { GL_RGB5_A1, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false }, // RGB5A1
{ GL_RGB10_A2, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false }, // RGB10A2
{ GL_R11F_G11F_B10F, GL_ZERO, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, false }, // R11G11B10F
{ GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO, false }, // UnknownDepth
@@ -1209,6 +1209,34 @@ namespace bgfx { namespace gl
_minFilter = s_textureFilterMin[min][_hasMips ? mip+1 : 0];
}
+ void updateExtension(const char* _name)
+ {
+ bool supported = false;
+ for (uint32_t ii = 0; ii < Extension::Count; ++ii)
+ {
+ Extension& extension = s_extension[ii];
+ if (!extension.m_supported
+ && extension.m_initialize)
+ {
+ const char* ext = _name;
+ if (0 == strncmp(ext, "GL_", 3) ) // skip GL_
+ {
+ ext += 3;
+ }
+
+ if (0 == strcmp(ext, extension.m_name) )
+ {
+ extension.m_supported = true;
+ supported = true;
+ break;
+ }
+ }
+ }
+
+ BX_TRACE("GL_EXTENSION %s: %s", supported ? " (supported)" : "", _name);
+ BX_UNUSED(supported);
+ }
+
struct RendererContextGL : public RendererContextI
{
RendererContextGL()
@@ -1365,42 +1393,31 @@ namespace bgfx { namespace gl
strncpy(name, pos, len);
name[len] = '\0';
- bool supported = false;
- for (uint32_t ii = 0; ii < Extension::Count; ++ii)
- {
- Extension& extension = s_extension[ii];
- if (!extension.m_supported
- && extension.m_initialize)
- {
- const char* ext = name;
- if (0 == strncmp(ext, "GL_", 3) ) // skip GL_
- {
- ext += 3;
- }
-
- if (0 == strcmp(ext, extension.m_name) )
- {
- extension.m_supported = true;
- supported = true;
- break;
- }
- }
- }
-
- BX_TRACE("GL_EXTENSION %3d%s: %s", index, supported ? " (supported)" : "", name);
- BX_UNUSED(supported);
+ updateExtension(name);
pos += len+1;
++index;
}
+ }
+ else if (NULL != glGetStringi)
+ {
+ GLint numExtensions = 0;
+ glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
+ glGetError(); // ignore error if glGetIntegerv returns NULL.
- BX_TRACE("Supported extensions:");
- for (uint32_t ii = 0; ii < Extension::Count; ++ii)
+ for (GLint index = 0; index < numExtensions; ++index)
{
- if (s_extension[ii].m_supported)
- {
- BX_TRACE("\t%2d: %s", ii, s_extension[ii].m_name);
- }
+ const char* name = (const char*)glGetStringi(GL_EXTENSIONS, index);
+ updateExtension(name);
+ }
+ }
+
+ BX_TRACE("Supported extensions:");
+ for (uint32_t ii = 0; ii < Extension::Count; ++ii)
+ {
+ if (s_extension[ii].m_supported)
+ {
+ BX_TRACE("\t%2d: %s", ii, s_extension[ii].m_name);
}
}
}
@@ -1502,9 +1519,9 @@ namespace bgfx { namespace gl
// internalFormat and format must match:
// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml
setTextureFormat(TextureFormat::RGBA8, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
- setTextureFormat(TextureFormat::R5G6B5, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
- setTextureFormat(TextureFormat::RGBA4, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
- setTextureFormat(TextureFormat::RGB5A1, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
+ setTextureFormat(TextureFormat::R5G6B5, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV);
+ setTextureFormat(TextureFormat::RGBA4, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV);
+ setTextureFormat(TextureFormat::RGB5A1, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV);
if (s_extension[Extension::OES_texture_half_float].m_supported
|| s_extension[Extension::OES_texture_float ].m_supported)
@@ -2200,7 +2217,7 @@ namespace bgfx { namespace gl
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = 1;
- tc.m_format = texture.m_requestedFormat;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
@@ -2211,14 +2228,24 @@ namespace bgfx { namespace gl
release(mem);
}
+ void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE
+ {
+ m_textures[_handle.idx].overrideInternal(_ptr);
+ }
+
+ uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE
+ {
+ return uintptr_t(m_textures[_handle.idx].m_id);
+ }
+
void destroyTexture(TextureHandle _handle) BX_OVERRIDE
{
m_textures[_handle.idx].destroy();
}
- void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
+ void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE
{
- m_frameBuffers[_handle.idx].create(_num, _textureHandles);
+ m_frameBuffers[_handle.idx].create(_num, _attachment);
}
void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE
@@ -2362,7 +2389,10 @@ namespace bgfx { namespace gl
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
{
- GL_CHECK(glBindSampler(0, 0) );
+ if (m_samplerObjectSupport)
+ {
+ GL_CHECK(glBindSampler(0, 0) );
+ }
}
}
}
@@ -2882,6 +2912,11 @@ namespace bgfx { namespace gl
, m_capture
) );
+ if (GL_RGBA == m_readPixelsFmt)
+ {
+ imageSwizzleBgra8(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture, m_capture);
+ }
+
g_callback->captureFrame(m_capture, m_captureSize);
}
}
@@ -3171,29 +3206,34 @@ namespace bgfx { namespace gl
GL_CHECK(glUseProgram(program.m_id) );
program.bindAttributes(vertexDecl, 0);
+ float mrtClear[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4];
+
if (BGFX_CLEAR_COLOR_USE_PALETTE & _clear.m_flags)
{
- float mrtClear[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4];
for (uint32_t ii = 0; ii < numMrt; ++ii)
{
uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]);
memcpy(mrtClear[ii], _palette[index], 16);
}
-
- GL_CHECK(glUniform4fv(0, numMrt, mrtClear[0]) );
}
else
{
float rgba[4] =
{
- _clear.m_index[0]*1.0f/255.0f,
- _clear.m_index[1]*1.0f/255.0f,
- _clear.m_index[2]*1.0f/255.0f,
- _clear.m_index[3]*1.0f/255.0f,
+ _clear.m_index[0] * 1.0f / 255.0f,
+ _clear.m_index[1] * 1.0f / 255.0f,
+ _clear.m_index[2] * 1.0f / 255.0f,
+ _clear.m_index[3] * 1.0f / 255.0f,
};
- GL_CHECK(glUniform4fv(0, 1, rgba) );
+
+ for (uint32_t ii = 0; ii < numMrt; ++ii)
+ {
+ memcpy(mrtClear[ii], rgba, 16);
+ }
}
+ GL_CHECK(glUniform4fv(0, numMrt, mrtClear[0]) );
+
GL_CHECK(glDrawArrays(GL_TRIANGLE_STRIP
, 0
, 4
@@ -3909,7 +3949,7 @@ namespace bgfx { namespace gl
}
}
- bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _format, uint8_t _numMips, uint32_t _flags)
+ bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags)
{
m_target = _target;
m_numMips = _numMips;
@@ -3918,13 +3958,13 @@ namespace bgfx { namespace gl
m_height = _height;
m_depth = _depth;
m_currentSamplerHash = UINT32_MAX;
- m_requestedFormat = _format;
- m_textureFormat = _format;
+ m_requestedFormat =
+ m_textureFormat = uint8_t(_format);
- const bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
+ const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE );
- if (!bufferOnly)
+ if (!writeOnly)
{
GL_CHECK(glGenTextures(1, &m_id) );
BX_CHECK(0 != m_id, "Failed to generate texture id.");
@@ -3998,7 +4038,7 @@ namespace bgfx { namespace gl
msaaQuality = bx::uint32_min(s_renderGL->m_maxMsaa, msaaQuality == 0 ? 0 : 1<<msaaQuality);
if (0 != msaaQuality
- || bufferOnly)
+ || writeOnly)
{
GL_CHECK(glGenRenderbuffers(1, &m_rbo) );
BX_CHECK(0 != m_rbo, "Failed to generate renderbuffer id.");
@@ -4024,7 +4064,7 @@ namespace bgfx { namespace gl
GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, 0) );
- if (bufferOnly)
+ if (writeOnly)
{
// This is render buffer, there is no sampling, no need
// to create texture.
@@ -4234,7 +4274,8 @@ namespace bgfx { namespace gl
void TextureGL::destroy()
{
- if (0 != m_id)
+ if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED)
+ && 0 != m_id)
{
GL_CHECK(glBindTexture(m_target, 0) );
GL_CHECK(glDeleteTextures(1, &m_id) );
@@ -4248,6 +4289,13 @@ namespace bgfx { namespace gl
}
}
+ void TextureGL::overrideInternal(uintptr_t _ptr)
+ {
+ destroy();
+ m_flags |= BGFX_TEXTURE_INTERNAL_SHARED;
+ m_id = (GLuint)_ptr;
+ }
+
void TextureGL::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
{
BX_UNUSED(_z, _depth);
@@ -4316,7 +4364,7 @@ namespace bgfx { namespace gl
if (convert)
{
- imageDecodeToRgba8(temp, data, width, height, srcpitch, m_requestedFormat);
+ imageDecodeToRgba8(temp, data, width, height, srcpitch, TextureFormat::Enum(m_requestedFormat) );
data = temp;
srcpitch = rectpitch;
}
@@ -4969,12 +5017,12 @@ namespace bgfx { namespace gl
BX_UNUSED(complete);
}
- void FrameBufferGL::create(uint8_t _num, const TextureHandle* _handles)
+ void FrameBufferGL::create(uint8_t _num, const Attachment* _attachment)
{
GL_CHECK(glGenFramebuffers(1, &m_fbo[0]) );
m_numTh = _num;
- memcpy(m_th, _handles, _num*sizeof(TextureHandle) );
+ memcpy(m_attachment, _attachment, _num*sizeof(Attachment) );
postReset();
}
@@ -4992,15 +5040,15 @@ namespace bgfx { namespace gl
uint32_t colorIdx = 0;
for (uint32_t ii = 0; ii < m_numTh; ++ii)
{
- TextureHandle handle = m_th[ii];
+ TextureHandle handle = m_attachment[ii].handle;
if (isValid(handle) )
{
const TextureGL& texture = s_renderGL->m_textures[handle.idx];
if (0 == colorIdx)
{
- m_width = texture.m_width;
- m_height = texture.m_height;
+ m_width = bx::uint32_max(texture.m_width >> m_attachment[ii].mip, 1);
+ m_height = bx::uint32_max(texture.m_height >> m_attachment[ii].mip, 1);
}
GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx;
@@ -5038,7 +5086,7 @@ namespace bgfx { namespace gl
else
{
GLenum target = GL_TEXTURE_CUBE_MAP == texture.m_target
- ? GL_TEXTURE_CUBE_MAP_POSITIVE_X
+ ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer
: texture.m_target
;
@@ -5046,7 +5094,7 @@ namespace bgfx { namespace gl
, attachment
, target
, texture.m_id
- , 0
+ , m_attachment[ii].mip
) );
}
@@ -5086,7 +5134,7 @@ namespace bgfx { namespace gl
colorIdx = 0;
for (uint32_t ii = 0; ii < m_numTh; ++ii)
{
- TextureHandle handle = m_th[ii];
+ TextureHandle handle = m_attachment[ii].handle;
if (isValid(handle) )
{
const TextureGL& texture = s_renderGL->m_textures[handle.idx];
@@ -5097,11 +5145,17 @@ namespace bgfx { namespace gl
if (!isDepth( (TextureFormat::Enum)texture.m_textureFormat) )
{
++colorIdx;
+
+ GLenum target = GL_TEXTURE_CUBE_MAP == texture.m_target
+ ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer
+ : texture.m_target
+ ;
+
GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER
, attachment
- , texture.m_target
+ , target
, texture.m_id
- , 0
+ , m_attachment[ii].mip
) );
}
}
@@ -6315,6 +6369,11 @@ namespace bgfx { namespace gl
blitMsaaFbo();
+ if (m_vaoSupport)
+ {
+ GL_CHECK(glBindVertexArray(m_vao) );
+ }
+
if (0 < _render->m_num)
{
if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) )
diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h
index 34804d6b23c..91c49c22f02 100644
--- a/3rdparty/bgfx/src/renderer_gl.h
+++ b/3rdparty/bgfx/src/renderer_gl.h
@@ -13,6 +13,7 @@
|| BX_PLATFORM_BSD \
|| BX_PLATFORM_QNX \
|| BX_PLATFORM_RPI \
+ || BX_PLATFORM_STEAMLINK \
|| BX_PLATFORM_WINDOWS \
) )
@@ -321,6 +322,18 @@ typedef uint64_t GLuint64;
# define GL_R11F_G11F_B10F 0x8C3A
#endif // GL_R11F_G11F_B10F
+#ifndef GL_UNSIGNED_SHORT_5_6_5_REV
+# define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
+#endif // GL_UNSIGNED_SHORT_5_6_5_REV
+
+#ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV
+# define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
+#endif // GL_UNSIGNED_SHORT_1_5_5_5_REV
+
+#ifndef GL_UNSIGNED_SHORT_4_4_4_4_REV
+# define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
+#endif // GL_UNSIGNED_SHORT_4_4_4_4_REV
+
#ifndef GL_UNSIGNED_INT_10F_11F_11F_REV
# define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
#endif // GL_UNSIGNED_INT_10F_11F_11F_REV
@@ -742,6 +755,10 @@ typedef uint64_t GLuint64;
# define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif // GL_FRAMEBUFFER_SRGB
+#ifndef GL_NUM_EXTENSIONS
+# define GL_NUM_EXTENSIONS 0x821D
+#endif // GL_NUM_EXTENSIONS
+
// _KHR or _ARB...
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
@@ -1103,9 +1120,10 @@ namespace bgfx { namespace gl
{
}
- bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _format, uint8_t _numMips, uint32_t _flags);
+ bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags);
void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
void destroy();
+ void overrideInternal(uintptr_t _ptr);
void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
void setSamplerState(uint32_t _flags, const float _rgba[4]);
void commit(uint32_t _stage, uint32_t _flags, const float _palette[][4]);
@@ -1152,7 +1170,7 @@ namespace bgfx { namespace gl
memset(m_fbo, 0, sizeof(m_fbo) );
}
- void create(uint8_t _num, const TextureHandle* _handles);
+ void create(uint8_t _num, const Attachment* _attachment);
void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat);
void postReset();
uint16_t destroy();
@@ -1166,7 +1184,7 @@ namespace bgfx { namespace gl
uint16_t m_denseIdx;
uint8_t m_num;
uint8_t m_numTh;
- TextureHandle m_th[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
+ Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
};
struct ProgramGL
diff --git a/3rdparty/bgfx/src/renderer_mtl.h b/3rdparty/bgfx/src/renderer_mtl.h
index 2b683cff891..f471ee5d457 100644
--- a/3rdparty/bgfx/src/renderer_mtl.h
+++ b/3rdparty/bgfx/src/renderer_mtl.h
@@ -694,7 +694,7 @@ namespace bgfx { namespace mtl
m_depthHandle.idx = invalidHandle;
}
- void create(uint8_t _num, const TextureHandle* _handles);
+ void create(uint8_t _num, const Attachment* _attachment);
void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat);
void postReset();
uint16_t destroy();
diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm
index bb52c45b855..08faee495f7 100644
--- a/3rdparty/bgfx/src/renderer_mtl.mm
+++ b/3rdparty/bgfx/src/renderer_mtl.mm
@@ -495,6 +495,7 @@ namespace bgfx { namespace mtl
m_occlusionQuery.preReset();
+ g_internalData.context = m_device;
return true;
}
@@ -666,7 +667,7 @@ namespace bgfx { namespace mtl
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = 1;
- tc.m_format = texture.m_requestedFormat;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
@@ -677,14 +678,25 @@ namespace bgfx { namespace mtl
release(mem);
}
+ void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE
+ {
+ BX_UNUSED(_handle, _ptr);
+ }
+
+ uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE
+ {
+ BX_UNUSED(_handle);
+ return 0;
+ }
+
void destroyTexture(TextureHandle _handle) BX_OVERRIDE
{
m_textures[_handle.idx].destroy();
}
- void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
+ void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE
{
- m_frameBuffers[_handle.idx].create(_num, _textureHandles);
+ m_frameBuffers[_handle.idx].create(_num, _attachment);
}
void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE
@@ -1887,7 +1899,7 @@ namespace bgfx { namespace mtl
, 0 != (_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
);
- const bool bufferOnly = 0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
+ const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
// const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
// const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK);
const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
@@ -1919,11 +1931,11 @@ namespace bgfx { namespace mtl
desc.resourceOptions = MTLResourceStorageModePrivate;
desc.cpuCacheMode = MTLCPUCacheModeDefaultCache;
- desc.storageMode = (MTLStorageMode)(bufferOnly
+ desc.storageMode = (MTLStorageMode)(writeOnly
? 2 /*MTLStorageModePrivate*/
: 1 /*MTLStorageModeManaged*/
);
- desc.usage = bufferOnly
+ desc.usage = writeOnly
? MTLTextureUsageShaderWrite
: MTLTextureUsageShaderRead
;
@@ -2040,7 +2052,13 @@ namespace bgfx { namespace mtl
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
- imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat);
+ imageDecodeToBgra8(temp
+ , data
+ , _rect.m_width
+ , _rect.m_height
+ , srcpitch
+ , TextureFormat::Enum(m_requestedFormat)
+ );
data = temp;
}
@@ -2061,12 +2079,12 @@ namespace bgfx { namespace mtl
: m_sampler, _stage);
}
- void FrameBufferMtl::create(uint8_t _num, const TextureHandle* _handles)
+ void FrameBufferMtl::create(uint8_t _num, const Attachment* _attachment)
{
m_num = 0;
for (uint32_t ii = 0; ii < _num; ++ii)
{
- TextureHandle handle = _handles[ii];
+ TextureHandle handle = _attachment[ii].handle;
if (isValid(handle) )
{
const TextureMtl& texture = s_renderMtl->m_textures[handle.idx];
diff --git a/3rdparty/bgfx/src/renderer_null.cpp b/3rdparty/bgfx/src/renderer_null.cpp
index 021944e15cd..9b3de91416b 100644
--- a/3rdparty/bgfx/src/renderer_null.cpp
+++ b/3rdparty/bgfx/src/renderer_null.cpp
@@ -121,11 +121,20 @@ namespace bgfx { namespace noop
{
}
+ void overrideInternal(TextureHandle /*_handle*/, uintptr_t /*_ptr*/) BX_OVERRIDE
+ {
+ }
+
+ uintptr_t getInternal(TextureHandle /*_handle*/) BX_OVERRIDE
+ {
+ return 0;
+ }
+
void destroyTexture(TextureHandle /*_handle*/) BX_OVERRIDE
{
}
- void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const TextureHandle* /*_textureHandles*/) BX_OVERRIDE
+ void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const Attachment* /*_attachment*/) BX_OVERRIDE
{
}
diff --git a/3rdparty/bgfx/src/shader_dx9bc.cpp b/3rdparty/bgfx/src/shader_dx9bc.cpp
index 81d3dfb606a..071a9e2705e 100644
--- a/3rdparty/bgfx/src/shader_dx9bc.cpp
+++ b/3rdparty/bgfx/src/shader_dx9bc.cpp
@@ -722,8 +722,7 @@ namespace bgfx
{
bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) );
- bx::CrtAllocator r;
- bx::MemoryBlock mb(&r);
+ bx::MemoryBlock mb(g_allocator);
bx::MemoryWriter writer(&mb);
for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;)
diff --git a/3rdparty/bgfx/src/shader_dxbc.cpp b/3rdparty/bgfx/src/shader_dxbc.cpp
index a1fde52f7ab..36d81842c8d 100644
--- a/3rdparty/bgfx/src/shader_dxbc.cpp
+++ b/3rdparty/bgfx/src/shader_dxbc.cpp
@@ -1903,8 +1903,7 @@ namespace bgfx
{
bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) );
- bx::CrtAllocator r;
- bx::MemoryBlock mb(&r);
+ bx::MemoryBlock mb(g_allocator);
bx::MemoryWriter writer(&mb);
for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;)
diff --git a/3rdparty/bgfx/tools/bin/windows/.gitignore b/3rdparty/bgfx/tools/bin/windows/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/3rdparty/bgfx/tools/bin/windows/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/3rdparty/bgfx/tools/bin/windows/geometryc.exe b/3rdparty/bgfx/tools/bin/windows/geometryc.exe
new file mode 100644
index 00000000000..f1e001cf2ea
--- /dev/null
+++ b/3rdparty/bgfx/tools/bin/windows/geometryc.exe
Binary files differ
diff --git a/3rdparty/bgfx/tools/bin/windows/shaderc.exe b/3rdparty/bgfx/tools/bin/windows/shaderc.exe
new file mode 100644
index 00000000000..0e1b0346140
--- /dev/null
+++ b/3rdparty/bgfx/tools/bin/windows/shaderc.exe
Binary files differ
diff --git a/3rdparty/bgfx/tools/bin/windows/texturec.exe b/3rdparty/bgfx/tools/bin/windows/texturec.exe
new file mode 100644
index 00000000000..652b3b729de
--- /dev/null
+++ b/3rdparty/bgfx/tools/bin/windows/texturec.exe
Binary files differ
diff --git a/3rdparty/bgfx/tools/geometryc/geometryc.cpp b/3rdparty/bgfx/tools/geometryc/geometryc.cpp
index 4856d71ea12..7687f3c5e38 100644
--- a/3rdparty/bgfx/tools/geometryc/geometryc.cpp
+++ b/3rdparty/bgfx/tools/geometryc/geometryc.cpp
@@ -811,7 +811,7 @@ int main(int _argc, const char* _argv[])
PrimitiveArray primitives;
bx::CrtFileWriter writer;
- if (0 != writer.open(outFilePath) )
+ if (!bx::open(&writer, outFilePath) )
{
printf("Unable to open output file '%s'.", outFilePath);
exit(EXIT_FAILURE);
@@ -1000,8 +1000,8 @@ int main(int _argc, const char* _argv[])
);
}
- printf("size: %d\n", uint32_t(writer.seek() ) );
- writer.close();
+ printf("size: %d\n", uint32_t(bx::seek(&writer) ) );
+ bx::close(&writer);
delete [] indexData;
delete [] vertexData;
diff --git a/3rdparty/bgfx/tools/makedisttex.cpp b/3rdparty/bgfx/tools/makedisttex.cpp
deleted file mode 100644
index 6bc99b5289d..00000000000
--- a/3rdparty/bgfx/tools/makedisttex.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright 2011-2016 Branimir Karadzic. All rights reserved.
- * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-#include <edtaa3/edtaa3func.h>
-
-#define STB_IMAGE_IMPLEMENTATION
-#include <stb/stb_image.c>
-
-#define BX_NAMESPACE 1
-#include <bx/bx.h>
-#include <bx/commandline.h>
-#include <bx/uint32_t.h>
-
-long int fsize(FILE* _file)
-{
- long int pos = ftell(_file);
- fseek(_file, 0L, SEEK_END);
- long int size = ftell(_file);
- fseek(_file, pos, SEEK_SET);
- return size;
-}
-
-void edtaa3(double* _img, uint16_t _width, uint16_t _height, double* _out)
-{
- uint32_t size = _width*_height;
-
- short* xdist = (short*)malloc(size*sizeof(short) );
- short* ydist = (short*)malloc(size*sizeof(short) );
- double* gx = (double*)malloc(size*sizeof(double) );
- double* gy = (double*)malloc(size*sizeof(double) );
-
- computegradient(_img, _width, _height, gx, gy);
- edtaa3(_img, gx, gy, _width, _height, xdist, ydist, _out);
-
- for (uint32_t ii = 0; ii < size; ++ii)
- {
- if (_out[ii] < 0.0)
- {
- _out[ii] = 0.0;
- }
- }
-
- free(xdist);
- free(ydist);
- free(gx);
- free(gy);
-}
-
-void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, bool _grayscale, const void* _data)
-{
- FILE* file = fopen(_filePath, "wb");
- if ( NULL != file )
- {
- uint8_t type = _grayscale ? 3 : 2;
- uint8_t bpp = _grayscale ? 8 : 32;
- uint8_t xorig = 0;
- uint8_t yorig = 0;
-
- putc(0, file);
- putc(0, file);
- putc(type, file);
- putc(0, file);
- putc(0, file);
- putc(0, file);
- putc(0, file);
- putc(0, file);
- putc(0, file);
- putc(xorig, file);
- putc(0, file);
- putc(yorig, file);
- putc(_width&0xff, file);
- putc( (_width>>8)&0xff, file);
- putc(_height&0xff, file);
- putc( (_height>>8)&0xff, file);
- putc(bpp, file);
- putc(32, file);
-
- uint32_t width = _width * bpp / 8;
- uint8_t* data = (uint8_t*)_data;
- for (uint32_t yy = 0; yy < _height; ++yy)
- {
- fwrite(data, width, 1, file);
- data += _pitch;
- }
-
- fclose(file);
- }
-}
-
-inline double min(double _a, double _b)
-{
- return _a > _b ? _b : _a;
-}
-
-inline double max(double _a, double _b)
-{
- return _a > _b ? _a : _b;
-}
-
-inline double clamp(double _val, double _min, double _max)
-{
- return max(min(_val, _max), _min);
-}
-
-inline double saturate(double _val)
-{
- return clamp(_val, 0.0, 1.0);
-}
-
-int main(int _argc, const char* _argv[])
-{
- bx::CommandLine cmdLine(_argc, _argv);
-
- const char* inFilePath = cmdLine.findOption('i');
- if (NULL == inFilePath)
- {
- fprintf(stderr, "Input file name must be specified.\n");
- return EXIT_FAILURE;
- }
-
- const char* outFilePath = cmdLine.findOption('o');
- if (NULL == outFilePath)
- {
- fprintf(stderr, "Output file name must be specified.\n");
- return EXIT_FAILURE;
- }
-
- double edge = 16.0;
- const char* edgeOpt = cmdLine.findOption('e');
- if (NULL != edgeOpt)
- {
- edge = atof(edgeOpt);
- }
-
- int width;
- int height;
- int comp;
-
- stbi_uc* img = stbi_load(inFilePath, &width, &height, &comp, 1);
-
- if (NULL == img)
- {
- fprintf(stderr, "Failed to load %s.\n", inFilePath);
- return EXIT_FAILURE;
- }
-
- uint32_t size = width*height;
-
- double* imgIn = (double*)malloc(size*sizeof(double) );
- double* outside = (double*)malloc(size*sizeof(double) );
- double* inside = (double*)malloc(size*sizeof(double) );
-
- for (uint32_t ii = 0; ii < size; ++ii)
- {
- imgIn[ii] = double(img[ii])/255.0;
- }
-
- edtaa3(imgIn, width, height, outside);
-
- for (uint32_t ii = 0; ii < size; ++ii)
- {
- imgIn[ii] = 1.0 - imgIn[ii];
- }
-
- edtaa3(imgIn, width, height, inside);
-
- free(imgIn);
-
- uint8_t* grayscale = (uint8_t*)malloc(size);
-
- double edgeOffset = edge*0.5;
- double invEdge = 1.0/edge;
-
- for (uint32_t ii = 0; ii < size; ++ii)
- {
- double dist = saturate( ( (outside[ii] - inside[ii])+edgeOffset) * invEdge);
- grayscale[ii] = 255-uint8_t(dist * 255.0);
- }
-
- free(inside);
- free(outside);
-
- saveTga(outFilePath, width, height, width, true, grayscale);
-
- free(grayscale);
-
- return EXIT_SUCCESS;
-}
diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.cpp b/3rdparty/bgfx/tools/shaderc/shaderc.cpp
index 4b6c7ec0ff1..915119afc91 100644
--- a/3rdparty/bgfx/tools/shaderc/shaderc.cpp
+++ b/3rdparty/bgfx/tools/shaderc/shaderc.cpp
@@ -4,8 +4,7 @@
*/
#include "shaderc.h"
-
-bool g_verbose = false;
+#include <bx/tokenizecmd.h>
#define MAX_TAGS 256
extern "C"
@@ -13,215 +12,124 @@ extern "C"
#include <fpp.h>
} // extern "C"
-#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x2)
-#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x4)
-#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x4)
-
-long int fsize(FILE* _file)
+namespace bgfx
{
- long int pos = ftell(_file);
- fseek(_file, 0L, SEEK_END);
- long int size = ftell(_file);
- fseek(_file, pos, SEEK_SET);
- return size;
-}
+ bool g_verbose = false;
-static const char* s_ARB_shader_texture_lod[] =
-{
- "texture2DLod",
- "texture2DProjLod",
- "texture3DLod",
- "texture3DProjLod",
- "textureCubeLod",
- "shadow2DLod",
- "shadow2DProjLod",
- NULL
- // "texture1DLod",
- // "texture1DProjLod",
- // "shadow1DLod",
- // "shadow1DProjLod",
-};
-
-static const char* s_EXT_shadow_samplers[] =
-{
- "shadow2D",
- "shadow2DProj",
- "sampler2DShadow",
- NULL
-};
-
-static const char* s_OES_standard_derivatives[] =
-{
- "dFdx",
- "dFdy",
- "fwidth",
- NULL
-};
+ #define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x2)
+ #define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x4)
+ #define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x4)
-static const char* s_OES_texture_3D[] =
-{
- "texture3D",
- "texture3DProj",
- "texture3DLod",
- "texture3DProjLod",
- NULL
-};
-
-static const char* s_130[] =
-{
- "uint",
- "uint2",
- "uint3",
- "uint4",
- "isampler3D",
- "usampler3D",
- NULL
-};
-
-const char* s_uniformTypeName[UniformType::Count] =
-{
- "int",
- NULL,
- "vec4",
- "mat3",
- "mat4",
-};
-
-const char* interpolationDx11(const char* _glsl)
-{
- if (0 == strcmp(_glsl, "smooth") )
- {
- return "linear";
- }
- else if (0 == strcmp(_glsl, "flat") )
+ long int fsize(FILE* _file)
{
- return "nointerpolation";
+ long int pos = ftell(_file);
+ fseek(_file, 0L, SEEK_END);
+ long int size = ftell(_file);
+ fseek(_file, pos, SEEK_SET);
+ return size;
}
- return _glsl; // noperspective
-}
-
-const char* getUniformTypeName(UniformType::Enum _enum)
-{
- return s_uniformTypeName[_enum];
-}
-
-UniformType::Enum nameToUniformTypeEnum(const char* _name)
-{
- for (uint32_t ii = 0; ii < UniformType::Count; ++ii)
+ static const char* s_ARB_shader_texture_lod[] =
{
- if (NULL != s_uniformTypeName[ii]
- && 0 == strcmp(_name, s_uniformTypeName[ii]) )
- {
- return UniformType::Enum(ii);
- }
- }
-
- return UniformType::Count;
-}
-
-int32_t writef(bx::WriterI* _writer, const char* _format, ...)
-{
- va_list argList;
- va_start(argList, _format);
-
- char temp[2048];
-
- char* out = temp;
- int32_t max = sizeof(temp);
- int32_t len = bx::vsnprintf(out, max, _format, argList);
- if (len > max)
+ "texture2DLod",
+ "texture2DProjLod",
+ "texture3DLod",
+ "texture3DProjLod",
+ "textureCubeLod",
+ "shadow2DLod",
+ "shadow2DProjLod",
+ NULL
+ // "texture1DLod",
+ // "texture1DProjLod",
+ // "shadow1DLod",
+ // "shadow1DProjLod",
+ };
+
+ static const char* s_EXT_shadow_samplers[] =
{
- out = (char*)alloca(len);
- len = bx::vsnprintf(out, len, _format, argList);
- }
+ "shadow2D",
+ "shadow2DProj",
+ "sampler2DShadow",
+ NULL
+ };
- len = bx::write(_writer, out, len);
-
- va_end(argList);
-
- return len;
-}
-
-class Bin2cWriter : public bx::CrtFileWriter
-{
-public:
- Bin2cWriter(const char* _name)
- : m_name(_name)
+ static const char* s_OES_standard_derivatives[] =
{
- }
+ "dFdx",
+ "dFdy",
+ "fwidth",
+ NULL
+ };
- virtual ~Bin2cWriter()
+ static const char* s_OES_texture_3D[] =
{
- }
-
- virtual int32_t close() BX_OVERRIDE
+ "texture3D",
+ "texture3DProj",
+ "texture3DLod",
+ "texture3DProjLod",
+ NULL
+ };
+
+ static const char* s_130[] =
+ {
+ "uint",
+ "uint2",
+ "uint3",
+ "uint4",
+ "isampler3D",
+ "usampler3D",
+ NULL
+ };
+
+ const char* s_uniformTypeName[UniformType::Count] =
{
- generate();
- return bx::CrtFileWriter::close();
+ "int",
+ NULL,
+ "vec4",
+ "mat3",
+ "mat4",
+ };
+
+ const char* interpolationDx11(const char* _glsl)
+ {
+ if (0 == strcmp(_glsl, "smooth") )
+ {
+ return "linear";
+ }
+ else if (0 == strcmp(_glsl, "flat") )
+ {
+ return "nointerpolation";
+ }
+
+ return _glsl; // noperspective
}
- virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE
+ const char* getUniformTypeName(UniformType::Enum _enum)
{
- const char* data = (const char*)_data;
- m_buffer.insert(m_buffer.end(), data, data+_size);
- return _size;
+ return s_uniformTypeName[_enum];
}
-private:
- void generate()
+ UniformType::Enum nameToUniformTypeEnum(const char* _name)
{
-#define HEX_DUMP_WIDTH 16
-#define HEX_DUMP_SPACE_WIDTH 96
-#define HEX_DUMP_FORMAT "%-" BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "." BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "s"
- const uint8_t* data = &m_buffer[0];
- uint32_t size = (uint32_t)m_buffer.size();
-
- outf("static const uint8_t %s[%d] =\n{\n", m_name.c_str(), size);
-
- if (NULL != data)
+ for (uint32_t ii = 0; ii < UniformType::Count; ++ii)
{
- char hex[HEX_DUMP_SPACE_WIDTH+1];
- char ascii[HEX_DUMP_WIDTH+1];
- uint32_t hexPos = 0;
- uint32_t asciiPos = 0;
- for (uint32_t ii = 0; ii < size; ++ii)
- {
- bx::snprintf(&hex[hexPos], sizeof(hex)-hexPos, "0x%02x, ", data[asciiPos]);
- hexPos += 6;
-
- ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.';
- asciiPos++;
-
- if (HEX_DUMP_WIDTH == asciiPos)
- {
- ascii[asciiPos] = '\0';
- outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii);
- data += asciiPos;
- hexPos = 0;
- asciiPos = 0;
- }
- }
-
- if (0 != asciiPos)
+ if (NULL != s_uniformTypeName[ii]
+ && 0 == strcmp(_name, s_uniformTypeName[ii]) )
{
- ascii[asciiPos] = '\0';
- outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii);
+ return UniformType::Enum(ii);
}
}
- outf("};\n");
-#undef HEX_DUMP_WIDTH
-#undef HEX_DUMP_SPACE_WIDTH
-#undef HEX_DUMP_FORMAT
+ return UniformType::Count;
}
- int32_t outf(const char* _format, ...)
+ int32_t writef(bx::WriterI* _writer, const char* _format, ...)
{
va_list argList;
va_start(argList, _format);
char temp[2048];
+
char* out = temp;
int32_t max = sizeof(temp);
int32_t len = bx::vsnprintf(out, max, _format, argList);
@@ -231,1584 +139,1703 @@ private:
len = bx::vsnprintf(out, len, _format, argList);
}
- int32_t size = bx::CrtFileWriter::write(out, len);
+ len = bx::write(_writer, out, len);
va_end(argList);
- return size;
+ return len;
}
- std::string m_filePath;
- std::string m_name;
- typedef std::vector<uint8_t> Buffer;
- Buffer m_buffer;
-};
-
-struct Varying
-{
- std::string m_precision;
- std::string m_interpolation;
- std::string m_name;
- std::string m_type;
- std::string m_init;
- std::string m_semantics;
-};
-
-typedef std::unordered_map<std::string, Varying> VaryingMap;
-
-class File
-{
-public:
- File(const char* _filePath)
- : m_data(NULL)
+ class Bin2cWriter : public bx::CrtFileWriter
{
- FILE* file = fopen(_filePath, "r");
- if (NULL != file)
+ public:
+ Bin2cWriter(const char* _name)
+ : m_name(_name)
{
- m_size = fsize(file);
- m_data = new char[m_size+1];
- m_size = (uint32_t)fread(m_data, 1, m_size, file);
- m_data[m_size] = '\0';
- fclose(file);
}
- }
- ~File()
- {
- delete [] m_data;
- }
-
- const char* getData() const
- {
- return m_data;
- }
+ virtual ~Bin2cWriter()
+ {
+ }
- uint32_t getSize() const
- {
- return m_size;
- }
+ virtual void close() BX_OVERRIDE
+ {
+ generate();
+ return bx::CrtFileWriter::close();
+ }
-private:
- char* m_data;
- uint32_t m_size;
-};
+ virtual int32_t write(const void* _data, int32_t _size, bx::Error*) BX_OVERRIDE
+ {
+ const char* data = (const char*)_data;
+ m_buffer.insert(m_buffer.end(), data, data+_size);
+ return _size;
+ }
-void strInsert(char* _str, const char* _insert)
-{
- size_t len = strlen(_insert);
- memmove(&_str[len], _str, strlen(_str) );
- memcpy(_str, _insert, len);
-}
+ private:
+ void generate()
+ {
+#define HEX_DUMP_WIDTH 16
+#define HEX_DUMP_SPACE_WIDTH 96
+#define HEX_DUMP_FORMAT "%-" BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "." BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "s"
+ const uint8_t* data = &m_buffer[0];
+ uint32_t size = (uint32_t)m_buffer.size();
-void strReplace(char* _str, const char* _find, const char* _replace)
-{
- const size_t len = strlen(_find);
+ outf("static const uint8_t %s[%d] =\n{\n", m_name.c_str(), size);
- char* replace = (char*)alloca(len+1);
- bx::strlcpy(replace, _replace, len+1);
- for (size_t ii = strlen(replace); ii < len; ++ii)
- {
- replace[ii] = ' ';
- }
- replace[len] = '\0';
+ if (NULL != data)
+ {
+ char hex[HEX_DUMP_SPACE_WIDTH+1];
+ char ascii[HEX_DUMP_WIDTH+1];
+ uint32_t hexPos = 0;
+ uint32_t asciiPos = 0;
+ for (uint32_t ii = 0; ii < size; ++ii)
+ {
+ bx::snprintf(&hex[hexPos], sizeof(hex)-hexPos, "0x%02x, ", data[asciiPos]);
+ hexPos += 6;
- BX_CHECK(len >= strlen(_replace), "");
- for (char* ptr = strstr(_str, _find); NULL != ptr; ptr = strstr(ptr + len, _find) )
- {
- memcpy(ptr, replace, len);
- }
-}
+ ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.';
+ asciiPos++;
-void strNormalizeEol(char* _str)
-{
- strReplace(_str, "\r\n", "\n");
- strReplace(_str, "\r", "\n");
-}
+ if (HEX_DUMP_WIDTH == asciiPos)
+ {
+ ascii[asciiPos] = '\0';
+ outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii);
+ data += asciiPos;
+ hexPos = 0;
+ asciiPos = 0;
+ }
+ }
-void printCode(const char* _code, int32_t _line, int32_t _start, int32_t _end)
-{
- fprintf(stderr, "Code:\n---\n");
+ if (0 != asciiPos)
+ {
+ ascii[asciiPos] = '\0';
+ outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii);
+ }
+ }
- LineReader lr(_code);
- for (int32_t line = 1; !lr.isEof() && line < _end; ++line)
- {
- if (line >= _start)
- {
- fprintf(stderr, "%s%3d: %s", _line == line ? ">>> " : " ", line, lr.getLine().c_str() );
- }
- else
- {
- lr.skipLine();
+ outf("};\n");
+#undef HEX_DUMP_WIDTH
+#undef HEX_DUMP_SPACE_WIDTH
+#undef HEX_DUMP_FORMAT
}
- }
-
- fprintf(stderr, "---\n");
-}
-void writeFile(const char* _filePath, const void* _data, int32_t _size)
-{
- bx::CrtFileWriter out;
- if (0 == out.open(_filePath) )
- {
- out.write(_data, _size);
- out.close();
- }
-}
+ int32_t outf(const char* _format, ...)
+ {
+ va_list argList;
+ va_start(argList, _format);
+
+ char temp[2048];
+ char* out = temp;
+ int32_t max = sizeof(temp);
+ int32_t len = bx::vsnprintf(out, max, _format, argList);
+ if (len > max)
+ {
+ out = (char*)alloca(len);
+ len = bx::vsnprintf(out, len, _format, argList);
+ }
-struct Preprocessor
-{
- Preprocessor(const char* _filePath, bool _gles, const char* _includeDir = NULL)
- : m_tagptr(m_tags)
- , m_scratchPos(0)
- , m_fgetsPos(0)
- {
- m_tagptr->tag = FPPTAG_USERDATA;
- m_tagptr->data = this;
- m_tagptr++;
+ bx::Error err;
+ int32_t size = bx::CrtFileWriter::write(out, len, &err);
- m_tagptr->tag = FPPTAG_DEPENDS;
- m_tagptr->data = (void*)fppDepends;
- m_tagptr++;
+ va_end(argList);
- m_tagptr->tag = FPPTAG_INPUT;
- m_tagptr->data = (void*)fppInput;
- m_tagptr++;
+ return size;
+ }
- m_tagptr->tag = FPPTAG_OUTPUT;
- m_tagptr->data = (void*)fppOutput;
- m_tagptr++;
+ std::string m_filePath;
+ std::string m_name;
+ typedef std::vector<uint8_t> Buffer;
+ Buffer m_buffer;
+ };
- m_tagptr->tag = FPPTAG_ERROR;
- m_tagptr->data = (void*)fppError;
- m_tagptr++;
+ struct Varying
+ {
+ std::string m_precision;
+ std::string m_interpolation;
+ std::string m_name;
+ std::string m_type;
+ std::string m_init;
+ std::string m_semantics;
+ };
- m_tagptr->tag = FPPTAG_IGNOREVERSION;
- m_tagptr->data = (void*)0;
- m_tagptr++;
+ typedef std::unordered_map<std::string, Varying> VaryingMap;
- m_tagptr->tag = FPPTAG_LINE;
- m_tagptr->data = (void*)0;
- m_tagptr++;
+ class File
+ {
+ public:
+ File(const char* _filePath)
+ : m_data(NULL)
+ {
+ FILE* file = fopen(_filePath, "r");
+ if (NULL != file)
+ {
+ m_size = fsize(file);
+ m_data = new char[m_size+1];
+ m_size = (uint32_t)fread(m_data, 1, m_size, file);
+ m_data[m_size] = '\0';
+ fclose(file);
+ }
+ }
- m_tagptr->tag = FPPTAG_INPUT_NAME;
- m_tagptr->data = scratch(_filePath);
- m_tagptr++;
+ ~File()
+ {
+ delete [] m_data;
+ }
- if (NULL != _includeDir)
+ const char* getData() const
{
- addInclude(_includeDir);
+ return m_data;
}
- if (!_gles)
+ uint32_t getSize() const
{
- m_default = "#define lowp\n#define mediump\n#define highp\n";
+ return m_size;
}
- }
- void setDefine(const char* _define)
+ private:
+ char* m_data;
+ uint32_t m_size;
+ };
+
+ void strInsert(char* _str, const char* _insert)
{
- m_tagptr->tag = FPPTAG_DEFINE;
- m_tagptr->data = scratch(_define);
- m_tagptr++;
+ size_t len = strlen(_insert);
+ memmove(&_str[len], _str, strlen(_str) );
+ memcpy(_str, _insert, len);
}
- void setDefaultDefine(const char* _name)
+ void strReplace(char* _str, const char* _find, const char* _replace)
{
- char temp[1024];
- bx::snprintf(temp, BX_COUNTOF(temp)
- , "#ifndef %s\n"
- "# define %s 0\n"
- "#endif // %s\n"
- "\n"
- , _name
- , _name
- , _name
- );
+ const size_t len = strlen(_find);
- m_default += temp;
+ char* replace = (char*)alloca(len+1);
+ bx::strlcpy(replace, _replace, len+1);
+ for (size_t ii = strlen(replace); ii < len; ++ii)
+ {
+ replace[ii] = ' ';
+ }
+ replace[len] = '\0';
+
+ BX_CHECK(len >= strlen(_replace), "");
+ for (char* ptr = strstr(_str, _find); NULL != ptr; ptr = strstr(ptr + len, _find) )
+ {
+ memcpy(ptr, replace, len);
+ }
}
- void writef(const char* _format, ...)
+ void strNormalizeEol(char* _str)
{
- va_list argList;
- va_start(argList, _format);
- bx::stringPrintfVargs(m_default, _format, argList);
- va_end(argList);
+ strReplace(_str, "\r\n", "\n");
+ strReplace(_str, "\r", "\n");
}
- void addInclude(const char* _includeDir)
+ void printCode(const char* _code, int32_t _line, int32_t _start, int32_t _end)
{
- char* start = scratch(_includeDir);
+ fprintf(stderr, "Code:\n---\n");
- for (char* split = strchr(start, ';'); NULL != split; split = strchr(start, ';'))
+ LineReader lr(_code);
+ for (int32_t line = 1; !lr.isEof() && line < _end; ++line)
{
- *split = '\0';
- m_tagptr->tag = FPPTAG_INCLUDE_DIR;
- m_tagptr->data = start;
- m_tagptr++;
- start = split + 1;
+ if (line >= _start)
+ {
+ fprintf(stderr, "%s%3d: %s", _line == line ? ">>> " : " ", line, lr.getLine().c_str() );
+ }
+ else
+ {
+ lr.skipLine();
+ }
}
- m_tagptr->tag = FPPTAG_INCLUDE_DIR;
- m_tagptr->data = start;
- m_tagptr++;
+ fprintf(stderr, "---\n");
}
- void addDependency(const char* _fileName)
+ void writeFile(const char* _filePath, const void* _data, int32_t _size)
{
- m_depends += " \\\n ";
- m_depends += _fileName;
+ bx::CrtFileWriter out;
+ if (bx::open(&out, _filePath) )
+ {
+ bx::write(&out, _data, _size);
+ bx::close(&out);
+ }
}
- bool run(const char* _input)
+ struct Preprocessor
{
- m_fgetsPos = 0;
+ Preprocessor(const char* _filePath, bool _gles, const char* _includeDir = NULL)
+ : m_tagptr(m_tags)
+ , m_scratchPos(0)
+ , m_fgetsPos(0)
+ {
+ m_tagptr->tag = FPPTAG_USERDATA;
+ m_tagptr->data = this;
+ m_tagptr++;
- m_preprocessed.clear();
- m_input = m_default;
- m_input += "\n\n";
+ m_tagptr->tag = FPPTAG_DEPENDS;
+ m_tagptr->data = (void*)fppDepends;
+ m_tagptr++;
- size_t len = strlen(_input)+1;
- char* temp = new char[len];
- bx::eolLF(temp, len, _input);
- m_input += temp;
- delete [] temp;
+ m_tagptr->tag = FPPTAG_INPUT;
+ m_tagptr->data = (void*)fppInput;
+ m_tagptr++;
- fppTag* tagptr = m_tagptr;
+ m_tagptr->tag = FPPTAG_OUTPUT;
+ m_tagptr->data = (void*)fppOutput;
+ m_tagptr++;
- tagptr->tag = FPPTAG_END;
- tagptr->data = 0;
- tagptr++;
+ m_tagptr->tag = FPPTAG_ERROR;
+ m_tagptr->data = (void*)fppError;
+ m_tagptr++;
- int result = fppPreProcess(m_tags);
+ m_tagptr->tag = FPPTAG_IGNOREVERSION;
+ m_tagptr->data = (void*)0;
+ m_tagptr++;
- return 0 == result;
- }
+ m_tagptr->tag = FPPTAG_LINE;
+ m_tagptr->data = (void*)0;
+ m_tagptr++;
- char* fgets(char* _buffer, int _size)
- {
- int ii = 0;
- for (char ch = m_input[m_fgetsPos]; m_fgetsPos < m_input.size() && ii < _size-1; ch = m_input[++m_fgetsPos])
- {
- _buffer[ii++] = ch;
+ m_tagptr->tag = FPPTAG_INPUT_NAME;
+ m_tagptr->data = scratch(_filePath);
+ m_tagptr++;
+
+ if (NULL != _includeDir)
+ {
+ addInclude(_includeDir);
+ }
- if (ch == '\n' || ii == _size)
+ if (!_gles)
{
- _buffer[ii] = '\0';
- m_fgetsPos++;
- return _buffer;
+ m_default = "#define lowp\n#define mediump\n#define highp\n";
}
}
- return NULL;
- }
+ void setDefine(const char* _define)
+ {
+ m_tagptr->tag = FPPTAG_DEFINE;
+ m_tagptr->data = scratch(_define);
+ m_tagptr++;
+ }
- static void fppDepends(char* _fileName, void* _userData)
- {
- Preprocessor* thisClass = (Preprocessor*)_userData;
- thisClass->addDependency(_fileName);
- }
+ void setDefaultDefine(const char* _name)
+ {
+ char temp[1024];
+ bx::snprintf(temp, BX_COUNTOF(temp)
+ , "#ifndef %s\n"
+ "# define %s 0\n"
+ "#endif // %s\n"
+ "\n"
+ , _name
+ , _name
+ , _name
+ );
+
+ m_default += temp;
+ }
- static char* fppInput(char* _buffer, int _size, void* _userData)
- {
- Preprocessor* thisClass = (Preprocessor*)_userData;
- return thisClass->fgets(_buffer, _size);
- }
+ void writef(const char* _format, ...)
+ {
+ va_list argList;
+ va_start(argList, _format);
+ bx::stringPrintfVargs(m_default, _format, argList);
+ va_end(argList);
+ }
- static void fppOutput(int _ch, void* _userData)
- {
- Preprocessor* thisClass = (Preprocessor*)_userData;
- thisClass->m_preprocessed += _ch;
- }
+ void addInclude(const char* _includeDir)
+ {
+ char* start = scratch(_includeDir);
- static void fppError(void* /*_userData*/, char* _format, va_list _vargs)
- {
- vfprintf(stderr, _format, _vargs);
- }
+ for (char* split = strchr(start, ';'); NULL != split; split = strchr(start, ';') )
+ {
+ *split = '\0';
+ m_tagptr->tag = FPPTAG_INCLUDE_DIR;
+ m_tagptr->data = start;
+ m_tagptr++;
+ start = split + 1;
+ }
- char* scratch(const char* _str)
- {
- char* result = &m_scratch[m_scratchPos];
- strcpy(result, _str);
- m_scratchPos += (uint32_t)strlen(_str)+1;
+ m_tagptr->tag = FPPTAG_INCLUDE_DIR;
+ m_tagptr->data = start;
+ m_tagptr++;
+ }
- return result;
- }
+ void addDependency(const char* _fileName)
+ {
+ m_depends += " \\\n ";
+ m_depends += _fileName;
+ }
- fppTag m_tags[MAX_TAGS];
- fppTag* m_tagptr;
+ bool run(const char* _input)
+ {
+ m_fgetsPos = 0;
- std::string m_depends;
- std::string m_default;
- std::string m_input;
- std::string m_preprocessed;
- char m_scratch[16<<10];
- uint32_t m_scratchPos;
- uint32_t m_fgetsPos;
-};
+ m_preprocessed.clear();
+ m_input = m_default;
+ m_input += "\n\n";
-typedef std::vector<std::string> InOut;
+ size_t len = strlen(_input)+1;
+ char* temp = new char[len];
+ bx::eolLF(temp, len, _input);
+ m_input += temp;
+ delete [] temp;
-uint32_t parseInOut(InOut& _inout, const char* _str, const char* _eol)
-{
- uint32_t hash = 0;
- _str = bx::strws(_str);
+ fppTag* tagptr = m_tagptr;
- if (_str < _eol)
- {
- const char* delim;
- do
+ tagptr->tag = FPPTAG_END;
+ tagptr->data = 0;
+ tagptr++;
+
+ int result = fppPreProcess(m_tags);
+
+ return 0 == result;
+ }
+
+ char* fgets(char* _buffer, int _size)
{
- delim = strpbrk(_str, " ,");
- if (NULL != delim)
+ int ii = 0;
+ for (char ch = m_input[m_fgetsPos]; m_fgetsPos < m_input.size() && ii < _size-1; ch = m_input[++m_fgetsPos])
{
- delim = delim > _eol ? _eol : delim;
- std::string token;
- token.assign(_str, delim-_str);
- _inout.push_back(token);
- _str = bx::strws(delim + 1);
+ _buffer[ii++] = ch;
+
+ if (ch == '\n' || ii == _size)
+ {
+ _buffer[ii] = '\0';
+ m_fgetsPos++;
+ return _buffer;
+ }
}
+
+ return NULL;
}
- while (delim < _eol && _str < _eol && NULL != delim);
- std::sort(_inout.begin(), _inout.end() );
+ static void fppDepends(char* _fileName, void* _userData)
+ {
+ Preprocessor* thisClass = (Preprocessor*)_userData;
+ thisClass->addDependency(_fileName);
+ }
- bx::HashMurmur2A murmur;
- murmur.begin();
- for (InOut::const_iterator it = _inout.begin(), itEnd = _inout.end(); it != itEnd; ++it)
+ static char* fppInput(char* _buffer, int _size, void* _userData)
{
- murmur.add(it->c_str(), (uint32_t)it->size() );
+ Preprocessor* thisClass = (Preprocessor*)_userData;
+ return thisClass->fgets(_buffer, _size);
}
- hash = murmur.end();
- }
- return hash;
-}
+ static void fppOutput(int _ch, void* _userData)
+ {
+ Preprocessor* thisClass = (Preprocessor*)_userData;
+ thisClass->m_preprocessed += _ch;
+ }
-void addFragData(Preprocessor& _preprocessor, char* _data, uint32_t _idx, bool _comma)
-{
- char find[32];
- bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx);
+ static void fppError(void* /*_userData*/, char* _format, va_list _vargs)
+ {
+ vfprintf(stderr, _format, _vargs);
+ }
- char replace[32];
- bx::snprintf(replace, sizeof(replace), "gl_FragData_%d_", _idx);
+ char* scratch(const char* _str)
+ {
+ char* result = &m_scratch[m_scratchPos];
+ strcpy(result, _str);
+ m_scratchPos += (uint32_t)strlen(_str)+1;
- strReplace(_data, find, replace);
+ return result;
+ }
- _preprocessor.writef(
- " \\\n\t%sout vec4 gl_FragData_%d_ : SV_TARGET%d"
- , _comma ? ", " : " "
- , _idx
- , _idx
- );
-}
+ fppTag m_tags[MAX_TAGS];
+ fppTag* m_tagptr;
-void voidFragData(char* _data, uint32_t _idx)
-{
- char find[32];
- bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx);
+ std::string m_depends;
+ std::string m_default;
+ std::string m_input;
+ std::string m_preprocessed;
+ char m_scratch[16<<10];
+ uint32_t m_scratchPos;
+ uint32_t m_fgetsPos;
+ };
- strReplace(_data, find, "bgfx_VoidFrag");
-}
+ typedef std::vector<std::string> InOut;
-// c - compute
-// d - domain
-// f - fragment
-// g - geometry
-// h - hull
-// v - vertex
-//
-// OpenGL #version Features Direct3D Features Shader Model
-// 2.1 120 vf 9.0 vf 2.0
-// 3.0 130
-// 3.1 140
-// 3.2 150 vgf
-// 3.3 330 10.0 vgf 4.0
-// 4.0 400 vhdgf
-// 4.1 410
-// 4.2 420 11.0 vhdgf+c 5.0
-// 4.3 430 vhdgf+c
-// 4.4 440
-
-void help(const char* _error = NULL)
-{
- if (NULL != _error)
+ uint32_t parseInOut(InOut& _inout, const char* _str, const char* _eol)
{
- fprintf(stderr, "Error:\n%s\n\n", _error);
- }
+ uint32_t hash = 0;
+ _str = bx::strws(_str);
- fprintf(stderr
- , "shaderc, bgfx shader compiler tool\n"
- "Copyright 2011-2016 Branimir Karadzic. All rights reserved.\n"
- "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n"
- );
-
- fprintf(stderr
- , "Usage: shaderc -f <in> -o <out> --type <v/f> --platform <platform>\n"
-
- "\n"
- "Options:\n"
- " -f <file path> Input file path.\n"
- " -i <include path> Include path (for multiple paths use semicolon).\n"
- " -o <file path> Output file path.\n"
- " --bin2c <file path> Generate C header file.\n"
- " --depends Generate makefile style depends file.\n"
- " --platform <platform> Target platform.\n"
- " android\n"
- " asm.js\n"
- " ios\n"
- " linux\n"
- " nacl\n"
- " osx\n"
- " windows\n"
- " --preprocess Preprocess only.\n"
- " --raw Do not process shader. No preprocessor, and no glsl-optimizer (GLSL only).\n"
- " --type <type> Shader type (vertex, fragment)\n"
- " --varyingdef <file path> Path to varying.def.sc file.\n"
- " --verbose Verbose.\n"
-
- "\n"
- "Options (DX9 and DX11 only):\n"
-
- "\n"
- " --debug Debug information.\n"
- " --disasm Disassemble compiled shader.\n"
- " -p, --profile <profile> Shader model (f.e. ps_3_0).\n"
- " -O <level> Optimization level (0, 1, 2, 3).\n"
- " --Werror Treat warnings as errors.\n"
-
- "\n"
- "For additional information, see https://github.com/bkaradzic/bgfx\n"
- );
-}
+ if (_str < _eol)
+ {
+ const char* delim;
+ do
+ {
+ delim = strpbrk(_str, " ,");
+ if (NULL != delim)
+ {
+ delim = delim > _eol ? _eol : delim;
+ std::string token;
+ token.assign(_str, delim-_str);
+ _inout.push_back(token);
+ _str = bx::strws(delim + 1);
+ }
+ }
+ while (delim < _eol && _str < _eol && NULL != delim);
-int main(int _argc, const char* _argv[])
-{
- bx::CommandLine cmdLine(_argc, _argv);
+ std::sort(_inout.begin(), _inout.end() );
- if (cmdLine.hasArg('h', "help") )
- {
- help();
- return EXIT_FAILURE;
- }
+ bx::HashMurmur2A murmur;
+ murmur.begin();
+ for (InOut::const_iterator it = _inout.begin(), itEnd = _inout.end(); it != itEnd; ++it)
+ {
+ murmur.add(it->c_str(), (uint32_t)it->size() );
+ }
+ hash = murmur.end();
+ }
- g_verbose = cmdLine.hasArg("verbose");
+ return hash;
+ }
- const char* filePath = cmdLine.findOption('f');
- if (NULL == filePath)
+ void addFragData(Preprocessor& _preprocessor, char* _data, uint32_t _idx, bool _comma)
{
- help("Shader file name must be specified.");
- return EXIT_FAILURE;
+ char find[32];
+ bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx);
+
+ char replace[32];
+ bx::snprintf(replace, sizeof(replace), "gl_FragData_%d_", _idx);
+
+ strReplace(_data, find, replace);
+
+ _preprocessor.writef(
+ " \\\n\t%sout vec4 gl_FragData_%d_ : SV_TARGET%d"
+ , _comma ? ", " : " "
+ , _idx
+ , _idx
+ );
}
- const char* outFilePath = cmdLine.findOption('o');
- if (NULL == outFilePath)
+ void voidFragData(char* _data, uint32_t _idx)
{
- help("Output file name must be specified.");
- return EXIT_FAILURE;
+ char find[32];
+ bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx);
+
+ strReplace(_data, find, "bgfx_VoidFrag");
}
- const char* type = cmdLine.findOption('\0', "type");
- if (NULL == type)
+ // c - compute
+ // d - domain
+ // f - fragment
+ // g - geometry
+ // h - hull
+ // v - vertex
+ //
+ // OpenGL #version Features Direct3D Features Shader Model
+ // 2.1 120 vf 9.0 vf 2.0
+ // 3.0 130
+ // 3.1 140
+ // 3.2 150 vgf
+ // 3.3 330 10.0 vgf 4.0
+ // 4.0 400 vhdgf
+ // 4.1 410
+ // 4.2 420 11.0 vhdgf+c 5.0
+ // 4.3 430 vhdgf+c
+ // 4.4 440
+
+ void help(const char* _error = NULL)
{
- help("Must specify shader type.");
- return EXIT_FAILURE;
+ if (NULL != _error)
+ {
+ fprintf(stderr, "Error:\n%s\n\n", _error);
+ }
+
+ fprintf(stderr
+ , "shaderc, bgfx shader compiler tool\n"
+ "Copyright 2011-2016 Branimir Karadzic. All rights reserved.\n"
+ "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n"
+ );
+
+ fprintf(stderr
+ , "Usage: shaderc -f <in> -o <out> --type <v/f> --platform <platform>\n"
+
+ "\n"
+ "Options:\n"
+ " -f <file path> Input file path.\n"
+ " -i <include path> Include path (for multiple paths use semicolon).\n"
+ " -o <file path> Output file path.\n"
+ " --bin2c <file path> Generate C header file.\n"
+ " --depends Generate makefile style depends file.\n"
+ " --platform <platform> Target platform.\n"
+ " android\n"
+ " asm.js\n"
+ " ios\n"
+ " linux\n"
+ " nacl\n"
+ " osx\n"
+ " windows\n"
+ " --preprocess Preprocess only.\n"
+ " --define <defines> Add defines to preprocessor (semicolon separated).\n"
+ " --raw Do not process shader. No preprocessor, and no glsl-optimizer (GLSL only).\n"
+ " --type <type> Shader type (vertex, fragment)\n"
+ " --varyingdef <file path> Path to varying.def.sc file.\n"
+ " --verbose Verbose.\n"
+
+ "\n"
+ "Options (DX9 and DX11 only):\n"
+
+ "\n"
+ " --debug Debug information.\n"
+ " --disasm Disassemble compiled shader.\n"
+ " -p, --profile <profile> Shader model (f.e. ps_3_0).\n"
+ " -O <level> Optimization level (0, 1, 2, 3).\n"
+ " --Werror Treat warnings as errors.\n"
+
+ "\n"
+ "For additional information, see https://github.com/bkaradzic/bgfx\n"
+ );
}
- const char* platform = cmdLine.findOption('\0', "platform");
- if (NULL == platform)
+ int compileShader(int _argc, const char* _argv[])
{
- help("Must specify platform.");
- return EXIT_FAILURE;
- }
+ bx::CommandLine cmdLine(_argc, _argv);
- bool raw = cmdLine.hasArg('\0', "raw");
+ if (cmdLine.hasArg('h', "help") )
+ {
+ help();
+ return EXIT_FAILURE;
+ }
- uint32_t glsl = 0;
- uint32_t essl = 0;
- uint32_t hlsl = 2;
- uint32_t d3d = 11;
- uint32_t metal = 0;
- const char* profile = cmdLine.findOption('p', "profile");
- if (NULL != profile)
- {
- if (0 == strncmp(&profile[1], "s_4_0_level", 11) )
+ g_verbose = cmdLine.hasArg("verbose");
+
+ const char* filePath = cmdLine.findOption('f');
+ if (NULL == filePath)
{
- hlsl = 2;
+ help("Shader file name must be specified.");
+ return EXIT_FAILURE;
}
- else if (0 == strncmp(&profile[1], "s_3", 3) )
+
+ const char* outFilePath = cmdLine.findOption('o');
+ if (NULL == outFilePath)
{
- hlsl = 3;
- d3d = 9;
+ help("Output file name must be specified.");
+ return EXIT_FAILURE;
}
- else if (0 == strncmp(&profile[1], "s_4", 3) )
+
+ const char* type = cmdLine.findOption('\0', "type");
+ if (NULL == type)
{
- hlsl = 4;
+ help("Must specify shader type.");
+ return EXIT_FAILURE;
}
- else if (0 == strncmp(&profile[1], "s_5", 3) )
+
+ const char* platform = cmdLine.findOption('\0', "platform");
+ if (NULL == platform)
{
- hlsl = 5;
+ help("Must specify platform.");
+ return EXIT_FAILURE;
}
- else if (0 == strcmp(profile, "metal") )
+
+ bool raw = cmdLine.hasArg('\0', "raw");
+
+ uint32_t glsl = 0;
+ uint32_t essl = 0;
+ uint32_t hlsl = 2;
+ uint32_t d3d = 11;
+ uint32_t metal = 0;
+ const char* profile = cmdLine.findOption('p', "profile");
+ if (NULL != profile)
{
- metal = 1;
+ if (0 == strncmp(&profile[1], "s_4_0_level", 11) )
+ {
+ hlsl = 2;
+ }
+ else if (0 == strncmp(&profile[1], "s_3", 3) )
+ {
+ hlsl = 3;
+ d3d = 9;
+ }
+ else if (0 == strncmp(&profile[1], "s_4", 3) )
+ {
+ hlsl = 4;
+ }
+ else if (0 == strncmp(&profile[1], "s_5", 3) )
+ {
+ hlsl = 5;
+ }
+ else if (0 == strcmp(profile, "metal") )
+ {
+ metal = 1;
+ }
+ else
+ {
+ glsl = atoi(profile);
+ }
}
else
{
- glsl = atoi(profile);
+ essl = 2;
}
- }
- else
- {
- essl = 2;
- }
- const char* bin2c = NULL;
- if (cmdLine.hasArg("bin2c") )
- {
- bin2c = cmdLine.findOption("bin2c");
- if (NULL == bin2c)
+ const char* bin2c = NULL;
+ if (cmdLine.hasArg("bin2c") )
{
- bin2c = bx::baseName(outFilePath);
- uint32_t len = (uint32_t)strlen(bin2c);
- char* temp = (char*)alloca(len+1);
- for (char *out = temp; *bin2c != '\0';)
+ bin2c = cmdLine.findOption("bin2c");
+ if (NULL == bin2c)
{
- char ch = *bin2c++;
- if (isalnum(ch) )
+ bin2c = bx::baseName(outFilePath);
+ uint32_t len = (uint32_t)strlen(bin2c);
+ char* temp = (char*)alloca(len+1);
+ for (char *out = temp; *bin2c != '\0';)
{
- *out++ = ch;
- }
- else
- {
- *out++ = '_';
+ char ch = *bin2c++;
+ if (isalnum(ch) )
+ {
+ *out++ = ch;
+ }
+ else
+ {
+ *out++ = '_';
+ }
}
- }
- temp[len] = '\0';
+ temp[len] = '\0';
- bin2c = temp;
+ bin2c = temp;
+ }
}
- }
- bool depends = cmdLine.hasArg("depends");
- bool preprocessOnly = cmdLine.hasArg("preprocess");
- const char* includeDir = cmdLine.findOption('i');
+ bool depends = cmdLine.hasArg("depends");
+ bool preprocessOnly = cmdLine.hasArg("preprocess");
+ const char* includeDir = cmdLine.findOption('i');
- Preprocessor preprocessor(filePath, 0 != essl, includeDir);
+ Preprocessor preprocessor(filePath, 0 != essl, includeDir);
- std::string dir;
- {
- const char* base = bx::baseName(filePath);
+ std::string dir;
+ {
+ const char* base = bx::baseName(filePath);
- if (base != filePath)
+ if (base != filePath)
+ {
+ dir.assign(filePath, base-filePath);
+ preprocessor.addInclude(dir.c_str() );
+ }
+ }
+
+ const char* defines = cmdLine.findOption("define");
+ while (NULL != defines
+ && '\0' != *defines)
{
- dir.assign(filePath, base-filePath);
- preprocessor.addInclude(dir.c_str() );
+ defines = bx::strws(defines);
+ const char* eol = strchr(defines, ';');
+ if (NULL == eol)
+ {
+ eol = defines + strlen(defines);
+ }
+ std::string define(defines, eol);
+ preprocessor.setDefine(define.c_str() );
+ defines = ';' == *eol ? eol+1 : eol;
}
- }
- preprocessor.setDefaultDefine("BX_PLATFORM_ANDROID");
- preprocessor.setDefaultDefine("BX_PLATFORM_EMSCRIPTEN");
- preprocessor.setDefaultDefine("BX_PLATFORM_IOS");
- preprocessor.setDefaultDefine("BX_PLATFORM_LINUX");
- preprocessor.setDefaultDefine("BX_PLATFORM_NACL");
- preprocessor.setDefaultDefine("BX_PLATFORM_OSX");
- preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS");
- preprocessor.setDefaultDefine("BX_PLATFORM_XBOX360");
-// preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_ESSL");
- preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_GLSL");
- preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_HLSL");
- preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_METAL");
- preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_COMPUTE");
- preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_FRAGMENT");
- preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX");
-
- char glslDefine[128];
- bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", essl ? 1 : glsl);
-
- if (0 == bx::stricmp(platform, "android") )
- {
- preprocessor.setDefine("BX_PLATFORM_ANDROID=1");
- preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
- }
- else if (0 == bx::stricmp(platform, "asm.js") )
- {
- preprocessor.setDefine("BX_PLATFORM_EMSCRIPTEN=1");
- preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
- }
- else if (0 == bx::stricmp(platform, "ios") )
- {
- preprocessor.setDefine("BX_PLATFORM_IOS=1");
- preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
- }
- else if (0 == bx::stricmp(platform, "linux") )
- {
- preprocessor.setDefine("BX_PLATFORM_LINUX=1");
- preprocessor.setDefine(glslDefine);
- }
- else if (0 == bx::stricmp(platform, "nacl") )
- {
- preprocessor.setDefine("BX_PLATFORM_NACL=1");
- preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
- }
- else if (0 == bx::stricmp(platform, "osx") )
- {
- preprocessor.setDefine("BX_PLATFORM_OSX=1");
- preprocessor.setDefine(glslDefine);
- char temp[256];
- bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_METAL=%d", metal);
- preprocessor.setDefine(temp);
- }
- else if (0 == bx::stricmp(platform, "windows") )
- {
- preprocessor.setDefine("BX_PLATFORM_WINDOWS=1");
- char temp[256];
- bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_HLSL=%d", hlsl);
- preprocessor.setDefine(temp);
- }
- else if (0 == bx::stricmp(platform, "xbox360") )
- {
- preprocessor.setDefine("BX_PLATFORM_XBOX360=1");
- preprocessor.setDefine("BGFX_SHADER_LANGUAGE_HLSL=3");
- }
- else
- {
- fprintf(stderr, "Unknown platform %s?!", platform);
- return EXIT_FAILURE;
- }
+ preprocessor.setDefaultDefine("BX_PLATFORM_ANDROID");
+ preprocessor.setDefaultDefine("BX_PLATFORM_EMSCRIPTEN");
+ preprocessor.setDefaultDefine("BX_PLATFORM_IOS");
+ preprocessor.setDefaultDefine("BX_PLATFORM_LINUX");
+ preprocessor.setDefaultDefine("BX_PLATFORM_NACL");
+ preprocessor.setDefaultDefine("BX_PLATFORM_OSX");
+ preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS");
+ preprocessor.setDefaultDefine("BX_PLATFORM_XBOX360");
+ // preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_ESSL");
+ preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_GLSL");
+ preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_HLSL");
+ preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_METAL");
+ preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_COMPUTE");
+ preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_FRAGMENT");
+ preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX");
+
+ char glslDefine[128];
+ bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", essl ? 1 : glsl);
+
+ if (0 == bx::stricmp(platform, "android") )
+ {
+ preprocessor.setDefine("BX_PLATFORM_ANDROID=1");
+ preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
+ }
+ else if (0 == bx::stricmp(platform, "asm.js") )
+ {
+ preprocessor.setDefine("BX_PLATFORM_EMSCRIPTEN=1");
+ preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
+ }
+ else if (0 == bx::stricmp(platform, "ios") )
+ {
+ preprocessor.setDefine("BX_PLATFORM_IOS=1");
+ preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
+ }
+ else if (0 == bx::stricmp(platform, "linux") )
+ {
+ preprocessor.setDefine("BX_PLATFORM_LINUX=1");
+ preprocessor.setDefine(glslDefine);
+ }
+ else if (0 == bx::stricmp(platform, "nacl") )
+ {
+ preprocessor.setDefine("BX_PLATFORM_NACL=1");
+ preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
+ }
+ else if (0 == bx::stricmp(platform, "osx") )
+ {
+ preprocessor.setDefine("BX_PLATFORM_OSX=1");
+ preprocessor.setDefine(glslDefine);
+ char temp[256];
+ bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_METAL=%d", metal);
+ preprocessor.setDefine(temp);
+ }
+ else if (0 == bx::stricmp(platform, "windows") )
+ {
+ preprocessor.setDefine("BX_PLATFORM_WINDOWS=1");
+ char temp[256];
+ bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_HLSL=%d", hlsl);
+ preprocessor.setDefine(temp);
+ }
+ else if (0 == bx::stricmp(platform, "xbox360") )
+ {
+ preprocessor.setDefine("BX_PLATFORM_XBOX360=1");
+ preprocessor.setDefine("BGFX_SHADER_LANGUAGE_HLSL=3");
+ }
+ else
+ {
+ fprintf(stderr, "Unknown platform %s?!", platform);
+ return EXIT_FAILURE;
+ }
- preprocessor.setDefine("M_PI=3.1415926535897932384626433832795");
+ preprocessor.setDefine("M_PI=3.1415926535897932384626433832795");
- char shaderType = tolower(type[0]);
- switch (shaderType)
- {
- case 'c':
- preprocessor.setDefine("BGFX_SHADER_TYPE_COMPUTE=1");
- break;
+ char shaderType = tolower(type[0]);
+ switch (shaderType)
+ {
+ case 'c':
+ preprocessor.setDefine("BGFX_SHADER_TYPE_COMPUTE=1");
+ break;
- case 'f':
- preprocessor.setDefine("BGFX_SHADER_TYPE_FRAGMENT=1");
- break;
+ case 'f':
+ preprocessor.setDefine("BGFX_SHADER_TYPE_FRAGMENT=1");
+ break;
- case 'v':
- preprocessor.setDefine("BGFX_SHADER_TYPE_VERTEX=1");
- break;
+ case 'v':
+ preprocessor.setDefine("BGFX_SHADER_TYPE_VERTEX=1");
+ break;
- default:
- fprintf(stderr, "Unknown type: %s?!", type);
- return EXIT_FAILURE;
- }
+ default:
+ fprintf(stderr, "Unknown type: %s?!", type);
+ return EXIT_FAILURE;
+ }
- bool compiled = false;
+ bool compiled = false;
- FILE* file = fopen(filePath, "r");
- if (NULL == file)
- {
- fprintf(stderr, "Unable to open file '%s'.\n", filePath);
- }
- else
- {
- VaryingMap varyingMap;
-
- std::string defaultVarying = dir + "varying.def.sc";
- const char* varyingdef = cmdLine.findOption("varyingdef", defaultVarying.c_str() );
- File attribdef(varyingdef);
- const char* parse = attribdef.getData();
- if (NULL != parse
- && *parse != '\0')
+ FILE* file = fopen(filePath, "r");
+ if (NULL == file)
{
- preprocessor.addDependency(varyingdef);
+ fprintf(stderr, "Unable to open file '%s'.\n", filePath);
}
else
{
- fprintf(stderr, "ERROR: Failed to parse varying def file: \"%s\" No input/output semantics will be generated in the code!\n", varyingdef);
- }
-
- while (NULL != parse
- && *parse != '\0')
- {
- parse = bx::strws(parse);
- const char* eol = strchr(parse, ';');
- if (NULL == eol)
+ VaryingMap varyingMap;
+
+ std::string defaultVarying = dir + "varying.def.sc";
+ const char* varyingdef = cmdLine.findOption("varyingdef", defaultVarying.c_str() );
+ File attribdef(varyingdef);
+ const char* parse = attribdef.getData();
+ if (NULL != parse
+ && *parse != '\0')
{
- eol = bx::streol(parse);
+ preprocessor.addDependency(varyingdef);
}
-
- if (NULL != eol)
+ else
{
- const char* precision = NULL;
- const char* interpolation = NULL;
- const char* typen = parse;
+ fprintf(stderr, "ERROR: Failed to parse varying def file: \"%s\" No input/output semantics will be generated in the code!\n", varyingdef);
+ }
- if (0 == strncmp(typen, "lowp", 4)
- || 0 == strncmp(typen, "mediump", 7)
- || 0 == strncmp(typen, "highp", 5) )
+ while (NULL != parse
+ && *parse != '\0')
+ {
+ parse = bx::strws(parse);
+ const char* eol = strchr(parse, ';');
+ if (NULL == eol)
{
- precision = typen;
- typen = parse = bx::strws(bx::strword(parse) );
+ eol = bx::streol(parse);
}
- if (0 == strncmp(typen, "flat", 4)
- || 0 == strncmp(typen, "smooth", 6)
- || 0 == strncmp(typen, "noperspective", 13) )
+ if (NULL != eol)
{
- interpolation = typen;
- typen = parse = bx::strws(bx::strword(parse) );
- }
+ const char* precision = NULL;
+ const char* interpolation = NULL;
+ const char* typen = parse;
- const char* name = parse = bx::strws(bx::strword(parse) );
- const char* column = parse = bx::strws(bx::strword(parse) );
- const char* semantics = parse = bx::strws((*parse == ':' ? ++parse : parse));
- const char* assign = parse = bx::strws(bx::strword(parse) );
- const char* init = parse = bx::strws((*parse == '=' ? ++parse : parse));
-
- if (typen < eol
- && name < eol
- && column < eol
- && ':' == *column
- && semantics < eol)
- {
- Varying var;
- if (NULL != precision)
+ if (0 == strncmp(typen, "lowp", 4)
+ || 0 == strncmp(typen, "mediump", 7)
+ || 0 == strncmp(typen, "highp", 5) )
{
- var.m_precision.assign(precision, bx::strword(precision)-precision);
+ precision = typen;
+ typen = parse = bx::strws(bx::strword(parse) );
}
- if (NULL != interpolation)
+ if (0 == strncmp(typen, "flat", 4)
+ || 0 == strncmp(typen, "smooth", 6)
+ || 0 == strncmp(typen, "noperspective", 13) )
{
- var.m_interpolation.assign(interpolation, bx::strword(interpolation)-interpolation);
+ interpolation = typen;
+ typen = parse = bx::strws(bx::strword(parse) );
}
- var.m_type.assign(typen, bx::strword(typen)-typen);
- var.m_name.assign(name, bx::strword(name)-name);
- var.m_semantics.assign(semantics, bx::strword(semantics)-semantics);
-
- if (d3d == 9
- && var.m_semantics == "BITANGENT")
+ const char* name = parse = bx::strws(bx::strword(parse) );
+ const char* column = parse = bx::strws(bx::strword(parse) );
+ const char* semantics = parse = bx::strws( (*parse == ':' ? ++parse : parse) );
+ const char* assign = parse = bx::strws(bx::strword(parse) );
+ const char* init = parse = bx::strws( (*parse == '=' ? ++parse : parse) );
+
+ if (typen < eol
+ && name < eol
+ && column < eol
+ && ':' == *column
+ && semantics < eol)
{
- var.m_semantics = "BINORMAL";
- }
+ Varying var;
+ if (NULL != precision)
+ {
+ var.m_precision.assign(precision, bx::strword(precision)-precision);
+ }
- if (assign < eol
- && '=' == *assign
- && init < eol)
- {
- var.m_init.assign(init, eol-init);
+ if (NULL != interpolation)
+ {
+ var.m_interpolation.assign(interpolation, bx::strword(interpolation)-interpolation);
+ }
+
+ var.m_type.assign(typen, bx::strword(typen)-typen);
+ var.m_name.assign(name, bx::strword(name)-name);
+ var.m_semantics.assign(semantics, bx::strword(semantics)-semantics);
+
+ if (d3d == 9
+ && var.m_semantics == "BITANGENT")
+ {
+ var.m_semantics = "BINORMAL";
+ }
+
+ if (assign < eol
+ && '=' == *assign
+ && init < eol)
+ {
+ var.m_init.assign(init, eol-init);
+ }
+
+ varyingMap.insert(std::make_pair(var.m_name, var) );
}
- varyingMap.insert(std::make_pair(var.m_name, var) );
+ parse = bx::strws(bx::strnl(eol) );
}
-
- parse = bx::strws(bx::strnl(eol) );
}
- }
- InOut shaderInputs;
- InOut shaderOutputs;
- uint32_t inputHash = 0;
- uint32_t outputHash = 0;
+ InOut shaderInputs;
+ InOut shaderOutputs;
+ uint32_t inputHash = 0;
+ uint32_t outputHash = 0;
- char* data;
- char* input;
- {
- const size_t padding = 1024;
- uint32_t size = (uint32_t)fsize(file);
- data = new char[size+padding+1];
- size = (uint32_t)fread(data, 1, size, file);
- // Compiler generates "error X3000: syntax error: unexpected end of file"
- // if input doesn't have empty line at EOF.
- data[size] = '\n';
- memset(&data[size+1], 0, padding);
- fclose(file);
-
- strNormalizeEol(data);
-
- input = const_cast<char*>(bx::strws(data) );
- while (input[0] == '$')
+ char* data;
+ char* input;
{
- const char* str = bx::strws(input+1);
- const char* eol = bx::streol(str);
- const char* nl = bx::strnl(eol);
- input = const_cast<char*>(nl);
+ const size_t padding = 1024;
+ uint32_t size = (uint32_t)fsize(file);
+ data = new char[size+padding+1];
+ size = (uint32_t)fread(data, 1, size, file);
+ // Compiler generates "error X3000: syntax error: unexpected end of file"
+ // if input doesn't have empty line at EOF.
+ data[size] = '\n';
+ memset(&data[size+1], 0, padding);
+ fclose(file);
- if (0 == strncmp(str, "input", 5) )
- {
- str += 5;
- const char* comment = strstr(str, "//");
- eol = NULL != comment && comment < eol ? comment : eol;
- inputHash = parseInOut(shaderInputs, str, eol);
- }
- else if (0 == strncmp(str, "output", 6) )
+ strNormalizeEol(data);
+
+ input = const_cast<char*>(bx::strws(data) );
+ while (input[0] == '$')
{
- str += 6;
- const char* comment = strstr(str, "//");
- eol = NULL != comment && comment < eol ? comment : eol;
- outputHash = parseInOut(shaderOutputs, str, eol);
+ const char* str = bx::strws(input+1);
+ const char* eol = bx::streol(str);
+ const char* nl = bx::strnl(eol);
+ input = const_cast<char*>(nl);
+
+ if (0 == strncmp(str, "input", 5) )
+ {
+ str += 5;
+ const char* comment = strstr(str, "//");
+ eol = NULL != comment && comment < eol ? comment : eol;
+ inputHash = parseInOut(shaderInputs, str, eol);
+ }
+ else if (0 == strncmp(str, "output", 6) )
+ {
+ str += 6;
+ const char* comment = strstr(str, "//");
+ eol = NULL != comment && comment < eol ? comment : eol;
+ outputHash = parseInOut(shaderOutputs, str, eol);
+ }
+ else if (0 == strncmp(str, "raw", 3) )
+ {
+ raw = true;
+ str += 3;
+ }
+
+ input = const_cast<char*>(bx::strws(input) );
}
- else if (0 == strncmp(str, "raw", 3) )
+
+ if (!raw)
{
- raw = true;
- str += 3;
+ // To avoid commented code being recognized as used feature,
+ // first preprocess pass is used to strip all comments before
+ // substituting code.
+ preprocessor.run(input);
+ delete [] data;
+
+ size = (uint32_t)preprocessor.m_preprocessed.size();
+ data = new char[size+padding+1];
+ memcpy(data, preprocessor.m_preprocessed.c_str(), size);
+ memset(&data[size], 0, padding+1);
+ input = data;
}
-
- input = const_cast<char*>(bx::strws(input) );
}
- if (!raw)
+ if (raw)
{
- // To avoid commented code being recognized as used feature,
- // first preprocess pass is used to strip all comments before
- // substituting code.
- preprocessor.run(input);
- delete [] data;
-
- size = (uint32_t)preprocessor.m_preprocessed.size();
- data = new char[size+padding+1];
- memcpy(data, preprocessor.m_preprocessed.c_str(), size);
- memset(&data[size], 0, padding+1);
- input = data;
- }
- }
+ bx::CrtFileWriter* writer = NULL;
- if (raw)
- {
- bx::CrtFileWriter* writer = NULL;
-
- if (NULL != bin2c)
- {
- writer = new Bin2cWriter(bin2c);
- }
- else
- {
- writer = new bx::CrtFileWriter;
- }
+ if (NULL != bin2c)
+ {
+ writer = new Bin2cWriter(bin2c);
+ }
+ else
+ {
+ writer = new bx::CrtFileWriter;
+ }
- if (0 != writer->open(outFilePath) )
- {
- fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
- return EXIT_FAILURE;
- }
+ if (!bx::open(writer, outFilePath) )
+ {
+ fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
+ return EXIT_FAILURE;
+ }
- if ('f' == shaderType)
- {
- bx::write(writer, BGFX_CHUNK_MAGIC_FSH);
- bx::write(writer, inputHash);
- }
- else if ('v' == shaderType)
- {
- bx::write(writer, BGFX_CHUNK_MAGIC_VSH);
- bx::write(writer, outputHash);
- }
- else
- {
- bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
- bx::write(writer, outputHash);
- }
+ if ('f' == shaderType)
+ {
+ bx::write(writer, BGFX_CHUNK_MAGIC_FSH);
+ bx::write(writer, inputHash);
+ }
+ else if ('v' == shaderType)
+ {
+ bx::write(writer, BGFX_CHUNK_MAGIC_VSH);
+ bx::write(writer, outputHash);
+ }
+ else
+ {
+ bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
+ bx::write(writer, outputHash);
+ }
- if (0 != glsl)
- {
- bx::write(writer, uint16_t(0) );
+ if (0 != glsl)
+ {
+ bx::write(writer, uint16_t(0) );
- uint32_t shaderSize = (uint32_t)strlen(input);
- bx::write(writer, shaderSize);
- bx::write(writer, input, shaderSize);
- bx::write(writer, uint8_t(0) );
+ uint32_t shaderSize = (uint32_t)strlen(input);
+ bx::write(writer, shaderSize);
+ bx::write(writer, input, shaderSize);
+ bx::write(writer, uint8_t(0) );
- compiled = true;
- }
- else
- {
- compiled = compileHLSLShader(cmdLine, d3d, input, writer);
- }
+ compiled = true;
+ }
+ else
+ {
+ compiled = compileHLSLShader(cmdLine, d3d, input, writer);
+ }
- writer->close();
- delete writer;
- }
- else if ('c' == shaderType) // Compute
- {
- char* entry = strstr(input, "void main()");
- if (NULL == entry)
- {
- fprintf(stderr, "Shader entry point 'void main()' is not found.\n");
+ bx::close(writer);
+ delete writer;
}
- else
+ else if ('c' == shaderType) // Compute
{
- if (0 != glsl
- || 0 != essl
- || 0 != metal)
+ char* entry = strstr(input, "void main()");
+ if (NULL == entry)
{
+ fprintf(stderr, "Shader entry point 'void main()' is not found.\n");
}
else
{
- preprocessor.writef(
- "#define lowp\n"
- "#define mediump\n"
- "#define highp\n"
- "#define ivec2 int2\n"
- "#define ivec3 int3\n"
- "#define ivec4 int4\n"
- "#define uvec2 uint2\n"
- "#define uvec3 uint3\n"
- "#define uvec4 uint4\n"
- "#define vec2 float2\n"
- "#define vec3 float3\n"
- "#define vec4 float4\n"
- "#define mat2 float2x2\n"
- "#define mat3 float3x3\n"
- "#define mat4 float4x4\n"
- );
-
- entry[4] = '_';
-
- preprocessor.writef("#define void_main()");
- preprocessor.writef(" \\\n\tvoid main(");
-
- uint32_t arg = 0;
-
- const bool hasLocalInvocationID = NULL != strstr(input, "gl_LocalInvocationID");
- const bool hasLocalInvocationIndex = NULL != strstr(input, "gl_LocalInvocationIndex");
- const bool hasGlobalInvocationID = NULL != strstr(input, "gl_GlobalInvocationID");
- const bool hasWorkGroupID = NULL != strstr(input, "gl_WorkGroupID");
-
- if (hasLocalInvocationID)
- {
- preprocessor.writef(
- " \\\n\t%sint3 gl_LocalInvocationID : SV_GroupThreadID"
- , arg++ > 0 ? ", " : " "
- );
- }
-
- if (hasLocalInvocationIndex)
+ if (0 != glsl
+ || 0 != essl
+ || 0 != metal)
{
- preprocessor.writef(
- " \\\n\t%sint gl_LocalInvocationIndex : SV_GroupIndex"
- , arg++ > 0 ? ", " : " "
- );
}
-
- if (hasGlobalInvocationID)
+ else
{
preprocessor.writef(
- " \\\n\t%sint3 gl_GlobalInvocationID : SV_DispatchThreadID"
- , arg++ > 0 ? ", " : " "
+ "#define lowp\n"
+ "#define mediump\n"
+ "#define highp\n"
+ "#define ivec2 int2\n"
+ "#define ivec3 int3\n"
+ "#define ivec4 int4\n"
+ "#define uvec2 uint2\n"
+ "#define uvec3 uint3\n"
+ "#define uvec4 uint4\n"
+ "#define vec2 float2\n"
+ "#define vec3 float3\n"
+ "#define vec4 float4\n"
+ "#define mat2 float2x2\n"
+ "#define mat3 float3x3\n"
+ "#define mat4 float4x4\n"
);
- }
- if (hasWorkGroupID)
- {
- preprocessor.writef(
- " \\\n\t%sint3 gl_WorkGroupID : SV_GroupID"
- , arg++ > 0 ? ", " : " "
- );
- }
+ entry[4] = '_';
- preprocessor.writef(
- " \\\n\t)\n"
- );
- }
+ preprocessor.writef("#define void_main()");
+ preprocessor.writef(" \\\n\tvoid main(");
- if (preprocessor.run(input) )
- {
- BX_TRACE("Input file: %s", filePath);
- BX_TRACE("Output file: %s", outFilePath);
+ uint32_t arg = 0;
- if (preprocessOnly)
- {
- bx::CrtFileWriter writer;
+ const bool hasLocalInvocationID = NULL != strstr(input, "gl_LocalInvocationID");
+ const bool hasLocalInvocationIndex = NULL != strstr(input, "gl_LocalInvocationIndex");
+ const bool hasGlobalInvocationID = NULL != strstr(input, "gl_GlobalInvocationID");
+ const bool hasWorkGroupID = NULL != strstr(input, "gl_WorkGroupID");
- if (0 != writer.open(outFilePath) )
+ if (hasLocalInvocationID)
{
- fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
- return EXIT_FAILURE;
+ preprocessor.writef(
+ " \\\n\t%sint3 gl_LocalInvocationID : SV_GroupThreadID"
+ , arg++ > 0 ? ", " : " "
+ );
}
- writer.write(preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() );
- writer.close();
-
- return EXIT_SUCCESS;
- }
-
- {
- bx::CrtFileWriter* writer = NULL;
-
- if (NULL != bin2c)
+ if (hasLocalInvocationIndex)
{
- writer = new Bin2cWriter(bin2c);
+ preprocessor.writef(
+ " \\\n\t%sint gl_LocalInvocationIndex : SV_GroupIndex"
+ , arg++ > 0 ? ", " : " "
+ );
}
- else
+
+ if (hasGlobalInvocationID)
{
- writer = new bx::CrtFileWriter;
+ preprocessor.writef(
+ " \\\n\t%sint3 gl_GlobalInvocationID : SV_DispatchThreadID"
+ , arg++ > 0 ? ", " : " "
+ );
}
- if (0 != writer->open(outFilePath) )
+ if (hasWorkGroupID)
{
- fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
- return EXIT_FAILURE;
+ preprocessor.writef(
+ " \\\n\t%sint3 gl_WorkGroupID : SV_GroupID"
+ , arg++ > 0 ? ", " : " "
+ );
}
- bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
- bx::write(writer, outputHash);
+ preprocessor.writef(
+ " \\\n\t)\n"
+ );
+ }
- if (0 != glsl
- || 0 != essl)
+ if (preprocessor.run(input) )
+ {
+ BX_TRACE("Input file: %s", filePath);
+ BX_TRACE("Output file: %s", outFilePath);
+
+ if (preprocessOnly)
{
- std::string code;
+ bx::CrtFileWriter writer;
- if (essl)
- {
- bx::stringPrintf(code, "#version 310 es\n");
- }
- else
+ if (!bx::open(&writer, outFilePath) )
{
- bx::stringPrintf(code, "#version %d\n", glsl == 0 ? 430 : glsl);
+ fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
+ return EXIT_FAILURE;
}
- code += preprocessor.m_preprocessed;
-#if 1
- bx::write(writer, uint16_t(0) );
-
- uint32_t shaderSize = (uint32_t)code.size();
- bx::write(writer, shaderSize);
- bx::write(writer, code.c_str(), shaderSize);
- bx::write(writer, uint8_t(0) );
+ bx::write(&writer, preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() );
+ bx::close(&writer);
- compiled = true;
-#else
- compiled = compileGLSLShader(cmdLine, essl, code, writer);
-#endif // 0
- }
- else
- {
- compiled = compileHLSLShader(cmdLine, d3d, preprocessor.m_preprocessed, writer);
+ return EXIT_SUCCESS;
}
- writer->close();
- delete writer;
- }
-
- if (compiled)
- {
- if (depends)
{
- std::string ofp = outFilePath;
- ofp += ".d";
- bx::CrtFileWriter writer;
- if (0 == writer.open(ofp.c_str() ) )
+ bx::CrtFileWriter* writer = NULL;
+
+ if (NULL != bin2c)
{
- writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() );
- writer.close();
+ writer = new Bin2cWriter(bin2c);
+ }
+ else
+ {
+ writer = new bx::CrtFileWriter;
}
- }
- }
- }
- }
- }
- else // Vertex/Fragment
- {
- char* entry = strstr(input, "void main()");
- if (NULL == entry)
- {
- fprintf(stderr, "Shader entry point 'void main()' is not found.\n");
- }
- else
- {
- if (0 != glsl
- || 0 != essl
- || 0 != metal)
- {
- if (120 == glsl
- || 0 != essl)
- {
- preprocessor.writef(
- "#define ivec2 vec2\n"
- "#define ivec3 vec3\n"
- "#define ivec4 vec4\n"
- );
- }
- if (0 == essl)
- {
- // bgfx shadow2D/Proj behave like EXT_shadow_samplers
- // not as GLSL language 1.2 specs shadow2D/Proj.
- preprocessor.writef(
- "#define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord).x\n"
- "#define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord).x\n"
- );
- }
+ if (!bx::open(writer, outFilePath) )
+ {
+ fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
+ return EXIT_FAILURE;
+ }
- for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it)
- {
- VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
- if (varyingIt != varyingMap.end() )
- {
- const Varying& var = varyingIt->second;
- const char* name = var.m_name.c_str();
+ bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
+ bx::write(writer, outputHash);
- if (0 == strncmp(name, "a_", 2)
- || 0 == strncmp(name, "i_", 2) )
+ if (0 != glsl
+ || 0 != essl)
{
- preprocessor.writef("attribute %s %s %s %s;\n"
- , var.m_precision.c_str()
- , var.m_interpolation.c_str()
- , var.m_type.c_str()
- , name
- );
+ std::string code;
+
+ if (essl)
+ {
+ bx::stringPrintf(code, "#version 310 es\n");
+ }
+ else
+ {
+ bx::stringPrintf(code, "#version %d\n", glsl == 0 ? 430 : glsl);
+ }
+
+ code += preprocessor.m_preprocessed;
+ #if 1
+ bx::write(writer, uint16_t(0) );
+
+ uint32_t shaderSize = (uint32_t)code.size();
+ bx::write(writer, shaderSize);
+ bx::write(writer, code.c_str(), shaderSize);
+ bx::write(writer, uint8_t(0) );
+
+ compiled = true;
+ #else
+ compiled = compileGLSLShader(cmdLine, essl, code, writer);
+ #endif // 0
}
else
{
- preprocessor.writef("%s varying %s %s %s;\n"
- , var.m_interpolation.c_str()
- , var.m_precision.c_str()
- , var.m_type.c_str()
- , name
- );
+ compiled = compileHLSLShader(cmdLine, d3d, preprocessor.m_preprocessed, writer);
}
+
+ bx::close(writer);
+ delete writer;
}
- }
- for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it)
- {
- VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
- if (varyingIt != varyingMap.end() )
+ if (compiled)
{
- const Varying& var = varyingIt->second;
- preprocessor.writef("%s varying %s %s;\n"
- , var.m_interpolation.c_str()
- , var.m_type.c_str()
- , var.m_name.c_str()
- );
+ if (depends)
+ {
+ std::string ofp = outFilePath;
+ ofp += ".d";
+ bx::CrtFileWriter writer;
+ if (bx::open(&writer, ofp.c_str() ) )
+ {
+ writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() );
+ bx::close(&writer);
+ }
+ }
}
}
}
+ }
+ else // Vertex/Fragment
+ {
+ char* entry = strstr(input, "void main()");
+ if (NULL == entry)
+ {
+ fprintf(stderr, "Shader entry point 'void main()' is not found.\n");
+ }
else
{
- preprocessor.writef(
- "#define lowp\n"
- "#define mediump\n"
- "#define highp\n"
- "#define ivec2 int2\n"
- "#define ivec3 int3\n"
- "#define ivec4 int4\n"
- "#define uvec2 uint2\n"
- "#define uvec3 uint3\n"
- "#define uvec4 uint4\n"
- "#define vec2 float2\n"
- "#define vec3 float3\n"
- "#define vec4 float4\n"
- "#define mat2 float2x2\n"
- "#define mat3 float3x3\n"
- "#define mat4 float4x4\n"
- );
-
- if (hlsl < 4)
+ if (0 != glsl
+ || 0 != essl
+ || 0 != metal)
{
- preprocessor.writef(
- "#define flat\n"
- "#define smooth\n"
- "#define noperspective\n"
- );
- }
-
- entry[4] = '_';
-
- if ('f' == shaderType)
- {
- const char* brace = strstr(entry, "{");
- if (NULL != brace)
+ if (120 == glsl
+ || 0 != essl)
{
- strInsert(const_cast<char*>(brace+1), "\nvec4 bgfx_VoidFrag;\n");
+ preprocessor.writef(
+ "#define ivec2 vec2\n"
+ "#define ivec3 vec3\n"
+ "#define ivec4 vec4\n"
+ );
}
- const bool hasFragCoord = NULL != strstr(input, "gl_FragCoord") || hlsl > 3 || hlsl == 2;
- const bool hasFragDepth = NULL != strstr(input, "gl_FragDepth");
- const bool hasFrontFacing = NULL != strstr(input, "gl_FrontFacing");
- const bool hasPrimitiveId = NULL != strstr(input, "gl_PrimitiveID");
-
- bool hasFragData[8] = {};
- uint32_t numFragData = 0;
- for (uint32_t ii = 0; ii < BX_COUNTOF(hasFragData); ++ii)
+ if (0 == essl)
{
- char temp[32];
- bx::snprintf(temp, BX_COUNTOF(temp), "gl_FragData[%d]", ii);
- hasFragData[ii] = NULL != strstr(input, temp);
- numFragData += hasFragData[ii];
+ // bgfx shadow2D/Proj behave like EXT_shadow_samplers
+ // not as GLSL language 1.2 specs shadow2D/Proj.
+ preprocessor.writef(
+ "#define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord).x\n"
+ "#define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord).x\n"
+ );
}
- if (0 == numFragData)
+ for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it)
{
- // GL errors when both gl_FragColor and gl_FragData is used.
- // This will trigger the same error with HLSL compiler too.
- preprocessor.writef("#define gl_FragColor gl_FragData_0_\n");
- }
-
- preprocessor.writef("#define void_main()");
- preprocessor.writef(" \\\n\tvoid main(");
-
- uint32_t arg = 0;
+ VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
+ if (varyingIt != varyingMap.end() )
+ {
+ const Varying& var = varyingIt->second;
+ const char* name = var.m_name.c_str();
- if (hasFragCoord)
- {
- preprocessor.writef(" \\\n\tvec4 gl_FragCoord : SV_POSITION");
- ++arg;
+ if (0 == strncmp(name, "a_", 2)
+ || 0 == strncmp(name, "i_", 2) )
+ {
+ preprocessor.writef("attribute %s %s %s %s;\n"
+ , var.m_precision.c_str()
+ , var.m_interpolation.c_str()
+ , var.m_type.c_str()
+ , name
+ );
+ }
+ else
+ {
+ preprocessor.writef("%s varying %s %s %s;\n"
+ , var.m_interpolation.c_str()
+ , var.m_precision.c_str()
+ , var.m_type.c_str()
+ , name
+ );
+ }
+ }
}
- for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it)
+ for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it)
{
VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
if (varyingIt != varyingMap.end() )
{
const Varying& var = varyingIt->second;
- preprocessor.writef(" \\\n\t%s%s %s %s : %s"
- , arg++ > 0 ? ", " : " "
- , interpolationDx11(var.m_interpolation.c_str() )
+ preprocessor.writef("%s varying %s %s;\n"
+ , var.m_interpolation.c_str()
, var.m_type.c_str()
, var.m_name.c_str()
- , var.m_semantics.c_str()
);
}
}
+ }
+ else
+ {
+ preprocessor.writef(
+ "#define lowp\n"
+ "#define mediump\n"
+ "#define highp\n"
+ "#define ivec2 int2\n"
+ "#define ivec3 int3\n"
+ "#define ivec4 int4\n"
+ "#define uvec2 uint2\n"
+ "#define uvec3 uint3\n"
+ "#define uvec4 uint4\n"
+ "#define vec2 float2\n"
+ "#define vec3 float3\n"
+ "#define vec4 float4\n"
+ "#define mat2 float2x2\n"
+ "#define mat3 float3x3\n"
+ "#define mat4 float4x4\n"
+ );
- addFragData(preprocessor, input, 0, arg++ > 0);
+ if (hlsl < 4)
+ {
+ preprocessor.writef(
+ "#define flat\n"
+ "#define smooth\n"
+ "#define noperspective\n"
+ );
+ }
- const uint32_t maxRT = d3d > 9 ? BX_COUNTOF(hasFragData) : 4;
+ entry[4] = '_';
- for (uint32_t ii = 1; ii < BX_COUNTOF(hasFragData); ++ii)
+ if ('f' == shaderType)
{
- if (ii < maxRT)
+ const char* brace = strstr(entry, "{");
+ if (NULL != brace)
{
- if (hasFragData[ii])
- {
- addFragData(preprocessor, input, ii, arg++ > 0);
- }
+ strInsert(const_cast<char*>(brace+1), "\nvec4 bgfx_VoidFrag;\n");
}
- else
+
+ const bool hasFragCoord = NULL != strstr(input, "gl_FragCoord") || hlsl > 3 || hlsl == 2;
+ const bool hasFragDepth = NULL != strstr(input, "gl_FragDepth");
+ const bool hasFrontFacing = NULL != strstr(input, "gl_FrontFacing");
+ const bool hasPrimitiveId = NULL != strstr(input, "gl_PrimitiveID");
+
+ bool hasFragData[8] = {};
+ uint32_t numFragData = 0;
+ for (uint32_t ii = 0; ii < BX_COUNTOF(hasFragData); ++ii)
{
- voidFragData(input, ii);
+ char temp[32];
+ bx::snprintf(temp, BX_COUNTOF(temp), "gl_FragData[%d]", ii);
+ hasFragData[ii] = NULL != strstr(input, temp);
+ numFragData += hasFragData[ii];
}
- }
- if (hasFragDepth)
- {
- preprocessor.writef(
- " \\\n\t%sout float gl_FragDepth : SV_DEPTH"
- , arg++ > 0 ? ", " : " "
- );
- }
+ if (0 == numFragData)
+ {
+ // GL errors when both gl_FragColor and gl_FragData is used.
+ // This will trigger the same error with HLSL compiler too.
+ preprocessor.writef("#define gl_FragColor gl_FragData_0_\n");
+ }
- if (hasFrontFacing
- && hlsl >= 3)
- {
- preprocessor.writef(
- " \\\n\t%sfloat __vface : VFACE"
- , arg++ > 0 ? ", " : " "
- );
- }
+ preprocessor.writef("#define void_main()");
+ preprocessor.writef(" \\\n\tvoid main(");
- if (hasPrimitiveId)
- {
- if (d3d > 9)
+ uint32_t arg = 0;
+
+ if (hasFragCoord)
{
- preprocessor.writef(
- " \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID"
- , arg++ > 0 ? ", " : " "
- );
+ preprocessor.writef(" \\\n\tvec4 gl_FragCoord : SV_POSITION");
+ ++arg;
}
- else
+
+ for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it)
{
- fprintf(stderr, "PrimitiveID builtin is not supported by this D3D9 HLSL.\n");
- return EXIT_FAILURE;
+ VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
+ if (varyingIt != varyingMap.end() )
+ {
+ const Varying& var = varyingIt->second;
+ preprocessor.writef(" \\\n\t%s%s %s %s : %s"
+ , arg++ > 0 ? ", " : " "
+ , interpolationDx11(var.m_interpolation.c_str() )
+ , var.m_type.c_str()
+ , var.m_name.c_str()
+ , var.m_semantics.c_str()
+ );
+ }
}
- }
- preprocessor.writef(
- " \\\n\t)\n"
- );
+ addFragData(preprocessor, input, 0, arg++ > 0);
- if (hasFrontFacing)
- {
- if (hlsl >= 3)
+ const uint32_t maxRT = d3d > 9 ? BX_COUNTOF(hasFragData) : 4;
+
+ for (uint32_t ii = 1; ii < BX_COUNTOF(hasFragData); ++ii)
+ {
+ if (ii < maxRT)
+ {
+ if (hasFragData[ii])
+ {
+ addFragData(preprocessor, input, ii, arg++ > 0);
+ }
+ }
+ else
+ {
+ voidFragData(input, ii);
+ }
+ }
+
+ if (hasFragDepth)
{
preprocessor.writef(
- "#define gl_FrontFacing (__vface <= 0.0)\n"
+ " \\\n\t%sout float gl_FragDepth : SV_DEPTH"
+ , arg++ > 0 ? ", " : " "
);
}
- else
+
+ if (hasFrontFacing
+ && hlsl >= 3)
{
preprocessor.writef(
- "#define gl_FrontFacing false\n"
+ " \\\n\t%sfloat __vface : VFACE"
+ , arg++ > 0 ? ", " : " "
);
}
- }
- }
- else if ('v' == shaderType)
- {
- const char* brace = strstr(entry, "{");
- if (NULL != brace)
- {
- const char* end = bx::strmb(brace, '{', '}');
- if (NULL != end)
+
+ if (hasPrimitiveId)
{
- strInsert(const_cast<char*>(end), "__RETURN__;\n");
+ if (d3d > 9)
+ {
+ preprocessor.writef(
+ " \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID"
+ , arg++ > 0 ? ", " : " "
+ );
+ }
+ else
+ {
+ fprintf(stderr, "PrimitiveID builtin is not supported by this D3D9 HLSL.\n");
+ return EXIT_FAILURE;
+ }
}
- }
- preprocessor.writef(
- "struct Output\n"
- "{\n"
- "\tvec4 gl_Position : SV_POSITION;\n"
- "#define gl_Position _varying_.gl_Position\n"
- );
- for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it)
- {
- VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
- if (varyingIt != varyingMap.end() )
+ preprocessor.writef(
+ " \\\n\t)\n"
+ );
+
+ if (hasFrontFacing)
{
- const Varying& var = varyingIt->second;
- preprocessor.writef("\t%s %s : %s;\n", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() );
- preprocessor.writef("#define %s _varying_.%s\n", var.m_name.c_str(), var.m_name.c_str() );
+ if (hlsl >= 3)
+ {
+ preprocessor.writef(
+ "#define gl_FrontFacing (__vface <= 0.0)\n"
+ );
+ }
+ else
+ {
+ preprocessor.writef(
+ "#define gl_FrontFacing false\n"
+ );
+ }
}
}
- preprocessor.writef(
- "};\n"
- );
-
- preprocessor.writef("#define void_main() \\\n");
- preprocessor.writef("Output main(");
- bool first = true;
- for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it)
+ else if ('v' == shaderType)
{
- VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
- if (varyingIt != varyingMap.end() )
+ const char* brace = strstr(entry, "{");
+ if (NULL != brace)
{
- const Varying& var = varyingIt->second;
- preprocessor.writef("%s%s %s : %s\\\n", first ? "" : "\t, ", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() );
- first = false;
+ const char* end = bx::strmb(brace, '{', '}');
+ if (NULL != end)
+ {
+ strInsert(const_cast<char*>(end), "__RETURN__;\n");
+ }
}
- }
- preprocessor.writef(
- ") \\\n"
- "{ \\\n"
- "\tOutput _varying_;"
- );
- for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it)
- {
- VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
- if (varyingIt != varyingMap.end() )
+ preprocessor.writef(
+ "struct Output\n"
+ "{\n"
+ "\tvec4 gl_Position : SV_POSITION;\n"
+ "#define gl_Position _varying_.gl_Position\n"
+ );
+ for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it)
{
- const Varying& var = varyingIt->second;
- preprocessor.writef(" \\\n\t%s", var.m_name.c_str() );
- if (!var.m_init.empty() )
+ VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
+ if (varyingIt != varyingMap.end() )
{
- preprocessor.writef(" = %s", var.m_init.c_str() );
+ const Varying& var = varyingIt->second;
+ preprocessor.writef("\t%s %s : %s;\n", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() );
+ preprocessor.writef("#define %s _varying_.%s\n", var.m_name.c_str(), var.m_name.c_str() );
}
- preprocessor.writef(";");
}
- }
-
- preprocessor.writef(
- "\n#define __RETURN__ \\\n"
- "\t} \\\n"
- "\treturn _varying_"
- );
- }
- }
-
- if (preprocessor.run(input) )
- {
- BX_TRACE("Input file: %s", filePath);
- BX_TRACE("Output file: %s", outFilePath);
-
- if (preprocessOnly)
- {
- bx::CrtFileWriter writer;
+ preprocessor.writef(
+ "};\n"
+ );
- if (0 != writer.open(outFilePath) )
- {
- fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
- return EXIT_FAILURE;
- }
+ preprocessor.writef("#define void_main() \\\n");
+ preprocessor.writef("Output main(");
+ bool first = true;
+ for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it)
+ {
+ VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
+ if (varyingIt != varyingMap.end() )
+ {
+ const Varying& var = varyingIt->second;
+ preprocessor.writef("%s%s %s : %s\\\n", first ? "" : "\t, ", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() );
+ first = false;
+ }
+ }
+ preprocessor.writef(
+ ") \\\n"
+ "{ \\\n"
+ "\tOutput _varying_;"
+ );
- if (0 != glsl)
- {
- if (NULL == profile)
+ for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it)
{
- writef(&writer
- , "#ifdef GL_ES\n"
- "precision highp float;\n"
- "#endif // GL_ES\n\n"
- );
+ VaryingMap::const_iterator varyingIt = varyingMap.find(*it);
+ if (varyingIt != varyingMap.end() )
+ {
+ const Varying& var = varyingIt->second;
+ preprocessor.writef(" \\\n\t%s", var.m_name.c_str() );
+ if (!var.m_init.empty() )
+ {
+ preprocessor.writef(" = %s", var.m_init.c_str() );
+ }
+ preprocessor.writef(";");
+ }
}
- }
- writer.write(preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() );
- writer.close();
- return EXIT_SUCCESS;
+ preprocessor.writef(
+ "\n#define __RETURN__ \\\n"
+ "\t} \\\n"
+ "\treturn _varying_"
+ );
+ }
}
+ if (preprocessor.run(input) )
{
- bx::CrtFileWriter* writer = NULL;
+ BX_TRACE("Input file: %s", filePath);
+ BX_TRACE("Output file: %s", outFilePath);
- if (NULL != bin2c)
- {
- writer = new Bin2cWriter(bin2c);
- }
- else
+ if (preprocessOnly)
{
- writer = new bx::CrtFileWriter;
- }
+ bx::CrtFileWriter writer;
- if (0 != writer->open(outFilePath) )
- {
- fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
- return EXIT_FAILURE;
- }
+ if (!bx::open(&writer, outFilePath) )
+ {
+ fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
+ return EXIT_FAILURE;
+ }
- if ('f' == shaderType)
- {
- bx::write(writer, BGFX_CHUNK_MAGIC_FSH);
- bx::write(writer, inputHash);
- }
- else if ('v' == shaderType)
- {
- bx::write(writer, BGFX_CHUNK_MAGIC_VSH);
- bx::write(writer, outputHash);
- }
- else
- {
- bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
- bx::write(writer, outputHash);
+ if (0 != glsl)
+ {
+ if (NULL == profile)
+ {
+ writef(&writer
+ , "#ifdef GL_ES\n"
+ "precision highp float;\n"
+ "#endif // GL_ES\n\n"
+ );
+ }
+ }
+ bx::write(&writer, preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() );
+ bx::close(&writer);
+
+ return EXIT_SUCCESS;
}
- if (0 != glsl
- || 0 != essl
- || 0 != metal)
{
- std::string code;
-
- bool hasTextureLod = NULL != bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/);
+ bx::CrtFileWriter* writer = NULL;
- if (0 == essl)
+ if (NULL != bin2c)
{
- const bool need130 = 120 == glsl
- && bx::findIdentifierMatch(input, s_130)
- ;
-
- if (0 != metal)
- {
- bx::stringPrintf(code, "#version 120\n");
- }
- else
- {
- bx::stringPrintf(code, "#version %s\n", need130 ? "130" : profile);
- }
+ writer = new Bin2cWriter(bin2c);
+ }
+ else
+ {
+ writer = new bx::CrtFileWriter;
+ }
- bx::stringPrintf(code
- , "#define bgfxShadow2D shadow2D\n"
- "#define bgfxShadow2DProj shadow2DProj\n"
- );
+ if (!bx::open(writer, outFilePath) )
+ {
+ fprintf(stderr, "Unable to open output file '%s'.", outFilePath);
+ return EXIT_FAILURE;
+ }
- if (hasTextureLod
- && 130 > glsl)
- {
- bx::stringPrintf(code
- , "#extension GL_ARB_shader_texture_lod : enable\n"
- );
- }
+ if ('f' == shaderType)
+ {
+ bx::write(writer, BGFX_CHUNK_MAGIC_FSH);
+ bx::write(writer, inputHash);
+ }
+ else if ('v' == shaderType)
+ {
+ bx::write(writer, BGFX_CHUNK_MAGIC_VSH);
+ bx::write(writer, outputHash);
}
else
{
- // Pretend that all extensions are available.
- // This will be stripped later.
- if (hasTextureLod)
+ bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
+ bx::write(writer, outputHash);
+ }
+
+ if (0 != glsl
+ || 0 != essl
+ || 0 != metal)
+ {
+ std::string code;
+
+ bool hasTextureLod = NULL != bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/);
+
+ if (0 == essl)
{
+ const bool need130 = 120 == glsl
+ && bx::findIdentifierMatch(input, s_130)
+ ;
+
+ if (0 != metal)
+ {
+ bx::stringPrintf(code, "#version 120\n");
+ }
+ else
+ {
+ bx::stringPrintf(code, "#version %s\n", need130 ? "130" : profile);
+ }
+
bx::stringPrintf(code
- , "#extension GL_EXT_shader_texture_lod : enable\n"
- "#define texture2DLod texture2DLodEXT\n"
- "#define texture2DProjLod texture2DProjLodEXT\n"
- "#define textureCubeLod textureCubeLodEXT\n"
-// "#define texture2DGrad texture2DGradEXT\n"
-// "#define texture2DProjGrad texture2DProjGradEXT\n"
-// "#define textureCubeGrad textureCubeGradEXT\n"
+ , "#define bgfxShadow2D shadow2D\n"
+ "#define bgfxShadow2DProj shadow2DProj\n"
);
- }
- if (NULL != bx::findIdentifierMatch(input, s_OES_standard_derivatives) )
- {
- bx::stringPrintf(code, "#extension GL_OES_standard_derivatives : enable\n");
+ if (hasTextureLod
+ && 130 > glsl)
+ {
+ bx::stringPrintf(code
+ , "#extension GL_ARB_shader_texture_lod : enable\n"
+ );
+ }
}
-
- if (NULL != bx::findIdentifierMatch(input, s_OES_texture_3D) )
+ else
{
- bx::stringPrintf(code, "#extension GL_OES_texture_3D : enable\n");
+ // Pretend that all extensions are available.
+ // This will be stripped later.
+ if (hasTextureLod)
+ {
+ bx::stringPrintf(code
+ , "#extension GL_EXT_shader_texture_lod : enable\n"
+ "#define texture2DLod texture2DLodEXT\n"
+ "#define texture2DProjLod texture2DProjLodEXT\n"
+ "#define textureCubeLod textureCubeLodEXT\n"
+ // "#define texture2DGrad texture2DGradEXT\n"
+ // "#define texture2DProjGrad texture2DProjGradEXT\n"
+ // "#define textureCubeGrad textureCubeGradEXT\n"
+ );
+ }
+
+ if (NULL != bx::findIdentifierMatch(input, s_OES_standard_derivatives) )
+ {
+ bx::stringPrintf(code, "#extension GL_OES_standard_derivatives : enable\n");
+ }
+
+ if (NULL != bx::findIdentifierMatch(input, s_OES_texture_3D) )
+ {
+ bx::stringPrintf(code, "#extension GL_OES_texture_3D : enable\n");
+ }
+
+ if (NULL != bx::findIdentifierMatch(input, s_EXT_shadow_samplers) )
+ {
+ bx::stringPrintf(code
+ , "#extension GL_EXT_shadow_samplers : enable\n"
+ "#define shadow2D shadow2DEXT\n"
+ "#define shadow2DProj shadow2DProjEXT\n"
+ );
+ }
+
+ if (NULL != bx::findIdentifierMatch(input, "gl_FragDepth") )
+ {
+ bx::stringPrintf(code
+ , "#extension GL_EXT_frag_depth : enable\n"
+ "#define gl_FragDepth gl_FragDepthEXT\n"
+ );
+ }
}
- if (NULL != bx::findIdentifierMatch(input, s_EXT_shadow_samplers) )
- {
- bx::stringPrintf(code
- , "#extension GL_EXT_shadow_samplers : enable\n"
- "#define shadow2D shadow2DEXT\n"
- "#define shadow2DProj shadow2DProjEXT\n"
+ code += preprocessor.m_preprocessed;
+ compiled = compileGLSLShader(cmdLine
+ , metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl
+ , code
+ , writer
);
- }
-
- if (NULL != bx::findIdentifierMatch(input, "gl_FragDepth") )
- {
- bx::stringPrintf(code
- , "#extension GL_EXT_frag_depth : enable\n"
- "#define gl_FragDepth gl_FragDepthEXT\n"
+ }
+ else
+ {
+ compiled = compileHLSLShader(cmdLine
+ , d3d
+ , preprocessor.m_preprocessed
+ , writer
);
- }
}
- code += preprocessor.m_preprocessed;
- compiled = compileGLSLShader(cmdLine
- , metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl
- , code
- , writer
- );
- }
- else
- {
- compiled = compileHLSLShader(cmdLine
- , d3d
- , preprocessor.m_preprocessed
- , writer
- );
+ bx::close(writer);
+ delete writer;
}
- writer->close();
- delete writer;
- }
-
- if (compiled)
- {
- if (depends)
+ if (compiled)
{
- std::string ofp = outFilePath;
- ofp += ".d";
- bx::CrtFileWriter writer;
- if (0 == writer.open(ofp.c_str() ) )
+ if (depends)
{
- writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() );
- writer.close();
+ std::string ofp = outFilePath;
+ ofp += ".d";
+ bx::CrtFileWriter writer;
+ if (bx::open(&writer, ofp.c_str() ) )
+ {
+ writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() );
+ bx::close(&writer);
+ }
}
}
}
}
}
+
+ delete [] data;
}
- delete [] data;
- }
+ if (compiled)
+ {
+ return EXIT_SUCCESS;
+ }
- if (compiled)
- {
- return EXIT_SUCCESS;
+ remove(outFilePath);
+
+ fprintf(stderr, "Failed to build shader.\n");
+ return EXIT_FAILURE;
}
- remove(outFilePath);
+} // namespace bgfx
- fprintf(stderr, "Failed to build shader.\n");
- return EXIT_FAILURE;
+int main(int _argc, const char* _argv[])
+{
+ return bgfx::compileShader(_argc, _argv);
}
diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.h b/3rdparty/bgfx/tools/shaderc/shaderc.h
index b7818ff1867..29bf450e474 100644
--- a/3rdparty/bgfx/tools/shaderc/shaderc.h
+++ b/3rdparty/bgfx/tools/shaderc/shaderc.h
@@ -6,9 +6,14 @@
#ifndef SHADERC_H_HEADER_GUARD
#define SHADERC_H_HEADER_GUARD
+namespace bgfx
+{
+ extern bool g_verbose;
+}
+
#define _BX_TRACE(_format, ...) \
BX_MACRO_BLOCK_BEGIN \
- if (g_verbose) \
+ if (bgfx::g_verbose) \
{ \
fprintf(stderr, BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \
} \
@@ -39,8 +44,6 @@
# define SHADERC_CONFIG_HLSL BX_PLATFORM_WINDOWS
#endif // SHADERC_CONFIG_HLSL
-extern bool g_verbose;
-
#include <alloca.h>
#include <stdio.h>
#include <stdint.h>
@@ -61,83 +64,74 @@ extern bool g_verbose;
#include <bx/hash.h>
#include "../../src/vertexdecl.h"
-class LineReader
+namespace bgfx
{
-public:
- LineReader(const char* _str)
- : m_str(_str)
- , m_pos(0)
- , m_size((uint32_t)strlen(_str))
- {
- }
-
- std::string getLine()
- {
- const char* str = &m_str[m_pos];
- skipLine();
-
- const char* eol = &m_str[m_pos];
-
- std::string tmp;
- tmp.assign(str, eol - str);
- return tmp;
- }
+ extern bool g_verbose;
- bool isEof() const
+ class LineReader
{
- return m_str[m_pos] == '\0';
- }
+ public:
+ LineReader(const char* _str)
+ : m_str(_str)
+ , m_pos(0)
+ , m_size((uint32_t)strlen(_str))
+ {
+ }
+
+ std::string getLine()
+ {
+ const char* str = &m_str[m_pos];
+ skipLine();
+
+ const char* eol = &m_str[m_pos];
+
+ std::string tmp;
+ tmp.assign(str, eol - str);
+ return tmp;
+ }
+
+ bool isEof() const
+ {
+ return m_str[m_pos] == '\0';
+ }
+
+ void skipLine()
+ {
+ const char* str = &m_str[m_pos];
+ const char* nl = bx::strnl(str);
+ m_pos += (uint32_t)(nl - str);
+ }
+
+ const char* m_str;
+ uint32_t m_pos;
+ uint32_t m_size;
+ };
- void skipLine()
- {
- const char* str = &m_str[m_pos];
- const char* nl = bx::strnl(str);
- m_pos += (uint32_t)(nl - str);
- }
+ #define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10)
+ #define BGFX_UNIFORM_SAMPLERBIT UINT8_C(0x20)
- const char* m_str;
- uint32_t m_pos;
- uint32_t m_size;
-};
+ const char* getUniformTypeName(UniformType::Enum _enum);
+ UniformType::Enum nameToUniformTypeEnum(const char* _name);
-struct UniformType
-{
- enum Enum
+ struct Uniform
{
- Int1,
- End,
-
- Vec4,
- Mat3,
- Mat4,
-
- Count
+ std::string name;
+ UniformType::Enum type;
+ uint8_t num;
+ uint16_t regIndex;
+ uint16_t regCount;
};
-};
-#define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10)
-#define BGFX_UNIFORM_SAMPLERBIT UINT8_C(0x20)
+ typedef std::vector<Uniform> UniformArray;
-const char* getUniformTypeName(UniformType::Enum _enum);
-UniformType::Enum nameToUniformTypeEnum(const char* _name);
+ void printCode(const char* _code, int32_t _line = 0, int32_t _start = 0, int32_t _end = INT32_MAX);
+ void strReplace(char* _str, const char* _find, const char* _replace);
+ int32_t writef(bx::WriterI* _writer, const char* _format, ...);
+ void writeFile(const char* _filePath, const void* _data, int32_t _size);
-struct Uniform
-{
- std::string name;
- UniformType::Enum type;
- uint8_t num;
- uint16_t regIndex;
- uint16_t regCount;
-};
-
-typedef std::vector<Uniform> UniformArray;
-
-void printCode(const char* _code, int32_t _line = 0, int32_t _start = 0, int32_t _end = INT32_MAX);
-void strReplace(char* _str, const char* _find, const char* _replace);
-int32_t writef(bx::WriterI* _writer, const char* _format, ...);
-void writeFile(const char* _filePath, const void* _data, int32_t _size);
-
-bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool firstPass = true);
-bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer);
+ bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool firstPass = true);
+ bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer);
+
+} // namespace bgfx
#endif // SHADERC_H_HEADER_GUARD
diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp
index 674b19d16fd..0a4ce15d937 100644
--- a/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp
+++ b/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp
@@ -6,207 +6,211 @@
#include "shaderc.h"
#include "glsl_optimizer.h"
-bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer)
+namespace bgfx
{
- char ch = tolower(_cmdLine.findOption('\0', "type")[0]);
- const glslopt_shader_type type = ch == 'f'
- ? kGlslOptShaderFragment
- : (ch == 'c' ? kGlslOptShaderCompute : kGlslOptShaderVertex);
-
- glslopt_target target = kGlslTargetOpenGL;
- switch (_gles)
+ bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer)
{
- case BX_MAKEFOURCC('M', 'T', 'L', 0):
- target = kGlslTargetMetal;
- break;
-
- case 2:
- target = kGlslTargetOpenGLES20;
- break;
-
- case 3:
- target = kGlslTargetOpenGLES30;
- break;
-
- default:
- target = kGlslTargetOpenGL;
- break;
- }
-
- glslopt_ctx* ctx = glslopt_initialize(target);
-
- glslopt_shader* shader = glslopt_optimize(ctx, type, _code.c_str(), 0);
+ char ch = tolower(_cmdLine.findOption('\0', "type")[0]);
+ const glslopt_shader_type type = ch == 'f'
+ ? kGlslOptShaderFragment
+ : (ch == 'c' ? kGlslOptShaderCompute : kGlslOptShaderVertex);
- if (!glslopt_get_status(shader) )
- {
- const char* log = glslopt_get_log(shader);
- int32_t source = 0;
- int32_t line = 0;
- int32_t column = 0;
- int32_t start = 0;
- int32_t end = INT32_MAX;
-
- if (3 == sscanf(log, "%u:%u(%u):", &source, &line, &column)
- && 0 != line)
+ glslopt_target target = kGlslTargetOpenGL;
+ switch (_gles)
{
- start = bx::uint32_imax(1, line-10);
- end = start + 20;
- }
+ case BX_MAKEFOURCC('M', 'T', 'L', 0):
+ target = kGlslTargetMetal;
+ break;
- printCode(_code.c_str(), line, start, end);
- fprintf(stderr, "Error: %s\n", log);
- glslopt_cleanup(ctx);
- return false;
- }
+ case 2:
+ target = kGlslTargetOpenGLES20;
+ break;
- const char* optimizedShader = glslopt_get_output(shader);
-
- // Trim all directives.
- while ('#' == *optimizedShader)
- {
- optimizedShader = bx::strnl(optimizedShader);
- }
+ case 3:
+ target = kGlslTargetOpenGLES30;
+ break;
- if (0 != _gles)
- {
- char* code = const_cast<char*>(optimizedShader);
- strReplace(code, "gl_FragDepthEXT", "gl_FragDepth");
-
- strReplace(code, "texture2DLodEXT", "texture2DLod");
- strReplace(code, "texture2DProjLodEXT", "texture2DProjLod");
- strReplace(code, "textureCubeLodEXT", "textureCubeLod");
- strReplace(code, "texture2DGradEXT", "texture2DGrad");
- strReplace(code, "texture2DProjGradEXT", "texture2DProjGrad");
- strReplace(code, "textureCubeGradEXT", "textureCubeGrad");
-
- strReplace(code, "shadow2DEXT", "shadow2D");
- strReplace(code, "shadow2DProjEXT", "shadow2DProj");
- }
+ default:
+ target = kGlslTargetOpenGL;
+ break;
+ }
- UniformArray uniforms;
+ glslopt_ctx* ctx = glslopt_initialize(target);
- {
- const char* parse = optimizedShader;
+ glslopt_shader* shader = glslopt_optimize(ctx, type, _code.c_str(), 0);
- while (NULL != parse
- && *parse != '\0')
+ if (!glslopt_get_status(shader) )
{
- parse = bx::strws(parse);
- const char* eol = strchr(parse, ';');
- if (NULL != eol)
+ const char* log = glslopt_get_log(shader);
+ int32_t source = 0;
+ int32_t line = 0;
+ int32_t column = 0;
+ int32_t start = 0;
+ int32_t end = INT32_MAX;
+
+ if (3 == sscanf(log, "%u:%u(%u):", &source, &line, &column)
+ && 0 != line)
{
- const char* qualifier = parse;
- parse = bx::strws(bx::strword(parse) );
-
- if (0 == strncmp(qualifier, "attribute", 9)
- || 0 == strncmp(qualifier, "varying", 7) )
- {
- // skip attributes and varyings.
- parse = eol + 1;
- continue;
- }
-
- if (0 != strncmp(qualifier, "uniform", 7) )
- {
- // end if there is no uniform keyword.
- parse = NULL;
- continue;
- }
-
- const char* precision = NULL;
- const char* typen = parse;
-
- if (0 == strncmp(typen, "lowp", 4)
- || 0 == strncmp(typen, "mediump", 7)
- || 0 == strncmp(typen, "highp", 5) )
- {
- precision = typen;
- typen = parse = bx::strws(bx::strword(parse) );
- }
-
- BX_UNUSED(precision);
+ start = bx::uint32_imax(1, line-10);
+ end = start + 20;
+ }
- char uniformType[256];
- parse = bx::strword(parse);
+ printCode(_code.c_str(), line, start, end);
+ fprintf(stderr, "Error: %s\n", log);
+ glslopt_cleanup(ctx);
+ return false;
+ }
- if (0 == strncmp(typen, "sampler", 7) )
- {
- strcpy(uniformType, "int");
- }
- else
- {
- bx::strlcpy(uniformType, typen, parse-typen+1);
- }
+ const char* optimizedShader = glslopt_get_output(shader);
- const char* name = parse = bx::strws(parse);
+ // Trim all directives.
+ while ('#' == *optimizedShader)
+ {
+ optimizedShader = bx::strnl(optimizedShader);
+ }
- char uniformName[256];
- uint8_t num = 1;
- const char* array = bx::strnstr(name, "[", eol-parse);
- if (NULL != array)
- {
- bx::strlcpy(uniformName, name, array-name+1);
+ if (0 != _gles)
+ {
+ char* code = const_cast<char*>(optimizedShader);
+ strReplace(code, "gl_FragDepthEXT", "gl_FragDepth");
+
+ strReplace(code, "texture2DLodEXT", "texture2DLod");
+ strReplace(code, "texture2DProjLodEXT", "texture2DProjLod");
+ strReplace(code, "textureCubeLodEXT", "textureCubeLod");
+ strReplace(code, "texture2DGradEXT", "texture2DGrad");
+ strReplace(code, "texture2DProjGradEXT", "texture2DProjGrad");
+ strReplace(code, "textureCubeGradEXT", "textureCubeGrad");
+
+ strReplace(code, "shadow2DEXT", "shadow2D");
+ strReplace(code, "shadow2DProjEXT", "shadow2DProj");
+ }
- char arraySize[32];
- const char* end = bx::strnstr(array, "]", eol-array);
- bx::strlcpy(arraySize, array+1, end-array);
- num = atoi(arraySize);
- }
- else
- {
- bx::strlcpy(uniformName, name, eol-name+1);
- }
+ UniformArray uniforms;
- Uniform un;
- un.type = nameToUniformTypeEnum(uniformType);
+ {
+ const char* parse = optimizedShader;
- if (UniformType::Count != un.type)
+ while (NULL != parse
+ && *parse != '\0')
+ {
+ parse = bx::strws(parse);
+ const char* eol = strchr(parse, ';');
+ if (NULL != eol)
{
- BX_TRACE("name: %s (type %d, num %d)", uniformName, un.type, num);
+ const char* qualifier = parse;
+ parse = bx::strws(bx::strword(parse) );
+
+ if (0 == strncmp(qualifier, "attribute", 9)
+ || 0 == strncmp(qualifier, "varying", 7) )
+ {
+ // skip attributes and varyings.
+ parse = eol + 1;
+ continue;
+ }
+
+ if (0 != strncmp(qualifier, "uniform", 7) )
+ {
+ // end if there is no uniform keyword.
+ parse = NULL;
+ continue;
+ }
+
+ const char* precision = NULL;
+ const char* typen = parse;
+
+ if (0 == strncmp(typen, "lowp", 4)
+ || 0 == strncmp(typen, "mediump", 7)
+ || 0 == strncmp(typen, "highp", 5) )
+ {
+ precision = typen;
+ typen = parse = bx::strws(bx::strword(parse) );
+ }
+
+ BX_UNUSED(precision);
+
+ char uniformType[256];
+ parse = bx::strword(parse);
+
+ if (0 == strncmp(typen, "sampler", 7) )
+ {
+ strcpy(uniformType, "int");
+ }
+ else
+ {
+ bx::strlcpy(uniformType, typen, parse-typen+1);
+ }
+
+ const char* name = parse = bx::strws(parse);
+
+ char uniformName[256];
+ uint8_t num = 1;
+ const char* array = bx::strnstr(name, "[", eol-parse);
+ if (NULL != array)
+ {
+ 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);
+ num = atoi(arraySize);
+ }
+ else
+ {
+ bx::strlcpy(uniformName, name, eol-name+1);
+ }
+
+ Uniform un;
+ un.type = nameToUniformTypeEnum(uniformType);
+
+ if (UniformType::Count != un.type)
+ {
+ BX_TRACE("name: %s (type %d, num %d)", uniformName, un.type, num);
+
+ un.name = uniformName;
+ un.num = num;
+ un.regIndex = 0;
+ un.regCount = num;
+ uniforms.push_back(un);
+ }
- un.name = uniformName;
- un.num = num;
- un.regIndex = 0;
- un.regCount = num;
- uniforms.push_back(un);
+ parse = eol + 1;
}
-
- parse = eol + 1;
}
}
- }
- uint16_t count = (uint16_t)uniforms.size();
- bx::write(_writer, count);
+ uint16_t count = (uint16_t)uniforms.size();
+ bx::write(_writer, count);
- for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it)
- {
- const Uniform& un = *it;
- 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;
- bx::write(_writer, uniformType);
- bx::write(_writer, un.num);
- bx::write(_writer, un.regIndex);
- bx::write(_writer, un.regCount);
-
- BX_TRACE("%s, %s, %d, %d, %d"
- , un.name.c_str()
- , getUniformTypeName(un.type)
- , un.num
- , un.regIndex
- , un.regCount
- );
- }
+ for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it)
+ {
+ const Uniform& un = *it;
+ 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;
+ bx::write(_writer, uniformType);
+ bx::write(_writer, un.num);
+ bx::write(_writer, un.regIndex);
+ bx::write(_writer, un.regCount);
+
+ BX_TRACE("%s, %s, %d, %d, %d"
+ , un.name.c_str()
+ , getUniformTypeName(un.type)
+ , un.num
+ , un.regIndex
+ , un.regCount
+ );
+ }
- uint32_t shaderSize = (uint32_t)strlen(optimizedShader);
- bx::write(_writer, shaderSize);
- bx::write(_writer, optimizedShader, shaderSize);
- uint8_t nul = 0;
- bx::write(_writer, nul);
+ uint32_t shaderSize = (uint32_t)strlen(optimizedShader);
+ bx::write(_writer, shaderSize);
+ bx::write(_writer, optimizedShader, shaderSize);
+ uint8_t nul = 0;
+ bx::write(_writer, nul);
- glslopt_cleanup(ctx);
+ glslopt_cleanup(ctx);
+
+ return true;
+ }
- return true;
-}
+} // namespace bgfx
diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp
index cdac5edd7b3..8f861047ded 100644
--- a/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp
+++ b/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp
@@ -7,677 +7,796 @@
#if SHADERC_CONFIG_HLSL
-#define INITGUID
+#if defined(__MINGW32__)
+# define __REQUIRED_RPCNDR_H_VERSION__ 475
+# define __in
+# define __out
+#endif // defined(__MINGW32__)
+
#include <d3dcompiler.h>
#include <d3d11shader.h>
+#include <bx/os.h>
#ifndef D3D_SVF_USED
# define D3D_SVF_USED 2
#endif // D3D_SVF_USED
-struct CTHeader
-{
- uint32_t Size;
- uint32_t Creator;
- uint32_t Version;
- uint32_t Constants;
- uint32_t ConstantInfo;
- uint32_t Flags;
- uint32_t Target;
-};
-
-struct CTInfo
-{
- uint32_t Name;
- uint16_t RegisterSet;
- uint16_t RegisterIndex;
- uint16_t RegisterCount;
- uint16_t Reserved;
- uint32_t TypeInfo;
- uint32_t DefaultValue;
-};
-
-struct CTType
-{
- uint16_t Class;
- uint16_t Type;
- uint16_t Rows;
- uint16_t Columns;
- uint16_t Elements;
- uint16_t StructMembers;
- uint32_t StructMemberInfo;
-};
-
-struct RemapInputSemantic
+namespace bgfx
{
- bgfx::Attrib::Enum m_attr;
- const char* m_name;
- uint8_t m_index;
-};
+ typedef HRESULT(WINAPI* PFN_D3D_COMPILE)(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData
+ , _In_ SIZE_T SrcDataSize
+ , _In_opt_ LPCSTR pSourceName
+ , _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL) ) CONST D3D_SHADER_MACRO* pDefines
+ , _In_opt_ ID3DInclude* pInclude
+ , _In_opt_ LPCSTR pEntrypoint
+ , _In_ LPCSTR pTarget
+ , _In_ UINT Flags1
+ , _In_ UINT Flags2
+ , _Out_ ID3DBlob** ppCode
+ , _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs
+ );
-static const RemapInputSemantic s_remapInputSemantic[bgfx::Attrib::Count+1] =
-{
- { bgfx::Attrib::Position, "POSITION", 0 },
- { bgfx::Attrib::Normal, "NORMAL", 0 },
- { bgfx::Attrib::Tangent, "TANGENT", 0 },
- { bgfx::Attrib::Bitangent, "BITANGENT", 0 },
- { bgfx::Attrib::Color0, "COLOR", 0 },
- { bgfx::Attrib::Color1, "COLOR", 1 },
- { bgfx::Attrib::Indices, "BLENDINDICES", 0 },
- { bgfx::Attrib::Weight, "BLENDWEIGHT", 0 },
- { bgfx::Attrib::TexCoord0, "TEXCOORD", 0 },
- { bgfx::Attrib::TexCoord1, "TEXCOORD", 1 },
- { bgfx::Attrib::TexCoord2, "TEXCOORD", 2 },
- { bgfx::Attrib::TexCoord3, "TEXCOORD", 3 },
- { bgfx::Attrib::TexCoord4, "TEXCOORD", 4 },
- { bgfx::Attrib::TexCoord5, "TEXCOORD", 5 },
- { bgfx::Attrib::TexCoord6, "TEXCOORD", 6 },
- { bgfx::Attrib::TexCoord7, "TEXCOORD", 7 },
- { bgfx::Attrib::Count, "", 0 },
-};
-
-const RemapInputSemantic& findInputSemantic(const char* _name, uint8_t _index)
-{
- for (uint32_t ii = 0; ii < bgfx::Attrib::Count; ++ii)
- {
- const RemapInputSemantic& ris = s_remapInputSemantic[ii];
- if (0 == strcmp(ris.m_name, _name)
- && ris.m_index == _index)
- {
- return ris;
- }
- }
+ typedef HRESULT(WINAPI* PFN_D3D_DISASSEMBLE)(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData
+ , _In_ SIZE_T SrcDataSize
+ , _In_ UINT Flags
+ , _In_opt_ LPCSTR szComments
+ , _Out_ ID3DBlob** ppDisassembly
+ );
- return s_remapInputSemantic[bgfx::Attrib::Count];
-}
+ typedef HRESULT(WINAPI* PFN_D3D_REFLECT)(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData
+ , _In_ SIZE_T SrcDataSize
+ , _In_ REFIID pInterface
+ , _Out_ void** ppReflector
+ );
-struct UniformRemap
-{
- UniformType::Enum id;
- D3D_SHADER_VARIABLE_CLASS paramClass;
- D3D_SHADER_VARIABLE_TYPE paramType;
- uint8_t columns;
- uint8_t rows;
-};
-
-static const UniformRemap s_uniformRemap[] =
-{
- { UniformType::Int1, D3D_SVC_SCALAR, D3D_SVT_INT, 0, 0 },
- { UniformType::Vec4, D3D_SVC_VECTOR, D3D_SVT_FLOAT, 0, 0 },
- { UniformType::Mat3, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 3, 3 },
- { UniformType::Mat4, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 4, 4 },
- { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER, 0, 0 },
- { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER2D, 0, 0 },
- { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER3D, 0, 0 },
- { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLERCUBE, 0, 0 },
-};
-
-UniformType::Enum findUniformType(const D3D11_SHADER_TYPE_DESC& constDesc)
-{
- for (uint32_t ii = 0; ii < BX_COUNTOF(s_uniformRemap); ++ii)
- {
- const UniformRemap& remap = s_uniformRemap[ii];
+ typedef HRESULT(WINAPI* PFN_D3D_STRIP_SHADER)(_In_reads_bytes_(BytecodeLength) LPCVOID pShaderBytecode
+ , _In_ SIZE_T BytecodeLength
+ , _In_ UINT uStripFlags
+ , _Out_ ID3DBlob** ppStrippedBlob
+ );
+
+ PFN_D3D_COMPILE D3DCompile;
+ PFN_D3D_DISASSEMBLE D3DDisassemble;
+ PFN_D3D_REFLECT D3DReflect;
+ PFN_D3D_STRIP_SHADER D3DStripShader;
- if (remap.paramClass == constDesc.Class
- && remap.paramType == constDesc.Type)
+ struct D3DCompiler
+ {
+ const char* fileName;
+ const GUID IID_ID3D11ShaderReflection;
+ };
+
+ static const D3DCompiler s_d3dcompiler[] =
+ { // BK - the only different in interface is GetRequiresFlags at the end
+ // of IID_ID3D11ShaderReflection47 (which is not used anyway).
+ { "D3DCompiler_47.dll", { 0x8d536ca1, 0x0cca, 0x4956, { 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84 } } },
+ { "D3DCompiler_46.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } },
+ { "D3DCompiler_45.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } },
+ { "D3DCompiler_44.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } },
+ { "D3DCompiler_43.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } },
+ };
+
+ static const D3DCompiler* s_compiler;
+ static void* s_d3dcompilerdll;
+
+ const D3DCompiler* load()
+ {
+ for (uint32_t ii = 0; ii < BX_COUNTOF(s_d3dcompiler); ++ii)
{
- if (D3D_SVC_MATRIX_COLUMNS != constDesc.Class)
+ const D3DCompiler* compiler = &s_d3dcompiler[ii];
+ s_d3dcompilerdll = bx::dlopen(compiler->fileName);
+ if (NULL == s_d3dcompilerdll)
{
- return remap.id;
+ continue;
}
- if (remap.columns == constDesc.Columns
- && remap.rows == constDesc.Rows)
+ D3DCompile = (PFN_D3D_COMPILE )bx::dlsym(s_d3dcompilerdll, "D3DCompile");
+ D3DDisassemble = (PFN_D3D_DISASSEMBLE )bx::dlsym(s_d3dcompilerdll, "D3DDisassemble");
+ D3DReflect = (PFN_D3D_REFLECT )bx::dlsym(s_d3dcompilerdll, "D3DReflect");
+ D3DStripShader = (PFN_D3D_STRIP_SHADER)bx::dlsym(s_d3dcompilerdll, "D3DStripShader");
+
+ if (NULL == D3DCompile
+ || NULL == D3DDisassemble
+ || NULL == D3DReflect
+ || NULL == D3DStripShader)
{
- return remap.id;
+ bx::dlclose(s_d3dcompilerdll);
+ continue;
}
- }
- }
- return UniformType::Count;
-}
-
-static uint32_t s_optimizationLevelDx11[4] =
-{
- D3DCOMPILE_OPTIMIZATION_LEVEL0,
- D3DCOMPILE_OPTIMIZATION_LEVEL1,
- D3DCOMPILE_OPTIMIZATION_LEVEL2,
- D3DCOMPILE_OPTIMIZATION_LEVEL3,
-};
+ BX_TRACE("Loaded %s compiler.", compiler->fileName);
+ return compiler;
+ }
-typedef std::vector<std::string> UniformNameList;
+ fprintf(stderr, "Error: Unable to open D3DCompiler_*.dll shader compiler.\n");
+ return NULL;
+ }
-static bool isSampler(D3D_SHADER_VARIABLE_TYPE _svt)
-{
- switch (_svt)
+ void unload()
{
- case D3D_SVT_SAMPLER:
- case D3D_SVT_SAMPLER1D:
- case D3D_SVT_SAMPLER2D:
- case D3D_SVT_SAMPLER3D:
- case D3D_SVT_SAMPLERCUBE:
- return true;
-
- default:
- break;
+ bx::dlclose(s_d3dcompilerdll);
}
- return false;
-}
-
-bool getReflectionDataDx9(ID3DBlob* _code, UniformArray& _uniforms)
-{
- // see reference for magic values: https://msdn.microsoft.com/en-us/library/ff552891(VS.85).aspx
- const uint32_t D3DSIO_COMMENT = 0x0000FFFE;
- const uint32_t D3DSIO_END = 0x0000FFFF;
- const uint32_t D3DSI_OPCODE_MASK = 0x0000FFFF;
- const uint32_t D3DSI_COMMENTSIZE_MASK = 0x7FFF0000;
- const uint32_t CTAB_CONSTANT = MAKEFOURCC('C','T','A','B');
-
- // parse the shader blob for the constant table
- const size_t codeSize = _code->GetBufferSize();
- const uint32_t* ptr = (const uint32_t*)_code->GetBufferPointer();
- const uint32_t* end = (const uint32_t*)( (const uint8_t*)ptr + codeSize);
- const CTHeader* header = NULL;
-
- ptr++; // first byte is shader type / version; skip it since we already know
-
- while (ptr < end && *ptr != D3DSIO_END)
+ struct CTHeader
{
- uint32_t cur = *ptr++;
- if ( (cur & D3DSI_OPCODE_MASK) != D3DSIO_COMMENT)
- {
- continue;
- }
+ uint32_t Size;
+ uint32_t Creator;
+ uint32_t Version;
+ uint32_t Constants;
+ uint32_t ConstantInfo;
+ uint32_t Flags;
+ uint32_t Target;
+ };
+
+ struct CTInfo
+ {
+ uint32_t Name;
+ uint16_t RegisterSet;
+ uint16_t RegisterIndex;
+ uint16_t RegisterCount;
+ uint16_t Reserved;
+ uint32_t TypeInfo;
+ uint32_t DefaultValue;
+ };
+
+ struct CTType
+ {
+ uint16_t Class;
+ uint16_t Type;
+ uint16_t Rows;
+ uint16_t Columns;
+ uint16_t Elements;
+ uint16_t StructMembers;
+ uint32_t StructMemberInfo;
+ };
+
+ struct RemapInputSemantic
+ {
+ bgfx::Attrib::Enum m_attr;
+ const char* m_name;
+ uint8_t m_index;
+ };
- // try to find CTAB comment block
- uint32_t commentSize = (cur & D3DSI_COMMENTSIZE_MASK) >> 16;
- uint32_t fourcc = *ptr;
- if (fourcc == CTAB_CONSTANT)
+ static const RemapInputSemantic s_remapInputSemantic[bgfx::Attrib::Count + 1] =
+ {
+ { bgfx::Attrib::Position, "POSITION", 0 },
+ { bgfx::Attrib::Normal, "NORMAL", 0 },
+ { bgfx::Attrib::Tangent, "TANGENT", 0 },
+ { bgfx::Attrib::Bitangent, "BITANGENT", 0 },
+ { bgfx::Attrib::Color0, "COLOR", 0 },
+ { bgfx::Attrib::Color1, "COLOR", 1 },
+ { bgfx::Attrib::Indices, "BLENDINDICES", 0 },
+ { bgfx::Attrib::Weight, "BLENDWEIGHT", 0 },
+ { bgfx::Attrib::TexCoord0, "TEXCOORD", 0 },
+ { bgfx::Attrib::TexCoord1, "TEXCOORD", 1 },
+ { bgfx::Attrib::TexCoord2, "TEXCOORD", 2 },
+ { bgfx::Attrib::TexCoord3, "TEXCOORD", 3 },
+ { bgfx::Attrib::TexCoord4, "TEXCOORD", 4 },
+ { bgfx::Attrib::TexCoord5, "TEXCOORD", 5 },
+ { bgfx::Attrib::TexCoord6, "TEXCOORD", 6 },
+ { bgfx::Attrib::TexCoord7, "TEXCOORD", 7 },
+ { bgfx::Attrib::Count, "", 0 },
+ };
+
+ const RemapInputSemantic& findInputSemantic(const char* _name, uint8_t _index)
+ {
+ for (uint32_t ii = 0; ii < bgfx::Attrib::Count; ++ii)
{
- // found the constant table data
- header = (const CTHeader*)(ptr + 1);
- uint32_t tableSize = (commentSize - 1) * 4;
- if (tableSize < sizeof(CTHeader) || header->Size != sizeof(CTHeader) )
+ const RemapInputSemantic& ris = s_remapInputSemantic[ii];
+ if (0 == strcmp(ris.m_name, _name)
+ && ris.m_index == _index)
{
- fprintf(stderr, "Error: Invalid constant table data\n");
- return false;
+ return ris;
}
- break;
}
- // this is a different kind of comment section, so skip over it
- ptr += commentSize - 1;
+ return s_remapInputSemantic[bgfx::Attrib::Count];
}
- if (!header)
+ struct UniformRemap
{
- fprintf(stderr, "Error: Could not find constant table data\n");
- return false;
- }
+ UniformType::Enum id;
+ D3D_SHADER_VARIABLE_CLASS paramClass;
+ D3D_SHADER_VARIABLE_TYPE paramType;
+ uint8_t columns;
+ uint8_t rows;
+ };
+
+ static const UniformRemap s_uniformRemap[] =
+ {
+ { UniformType::Int1, D3D_SVC_SCALAR, D3D_SVT_INT, 0, 0 },
+ { UniformType::Vec4, D3D_SVC_VECTOR, D3D_SVT_FLOAT, 0, 0 },
+ { UniformType::Mat3, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 3, 3 },
+ { UniformType::Mat4, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 4, 4 },
+ { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER, 0, 0 },
+ { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER2D, 0, 0 },
+ { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER3D, 0, 0 },
+ { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLERCUBE, 0, 0 },
+ };
+
+ UniformType::Enum findUniformType(const D3D11_SHADER_TYPE_DESC& constDesc)
+ {
+ for (uint32_t ii = 0; ii < BX_COUNTOF(s_uniformRemap); ++ii)
+ {
+ const UniformRemap& remap = s_uniformRemap[ii];
- const uint8_t* headerBytePtr = (const uint8_t*)header;
- const char* creator = (const char*)(headerBytePtr + header->Creator);
+ if (remap.paramClass == constDesc.Class
+ && remap.paramType == constDesc.Type)
+ {
+ if (D3D_SVC_MATRIX_COLUMNS != constDesc.Class)
+ {
+ return remap.id;
+ }
+
+ if (remap.columns == constDesc.Columns
+ && remap.rows == constDesc.Rows)
+ {
+ return remap.id;
+ }
+ }
+ }
- BX_TRACE("Creator: %s 0x%08x", creator, header->Version);
- BX_TRACE("Num constants: %d", header->Constants);
- BX_TRACE("# cl ty RxC S By Name");
+ return UniformType::Count;
+ }
- const CTInfo* ctInfoArray = (const CTInfo*)(headerBytePtr + header->ConstantInfo);
- for (uint32_t ii = 0; ii < header->Constants; ++ii)
+ static uint32_t s_optimizationLevelD3D11[4] =
{
- const CTInfo& ctInfo = ctInfoArray[ii];
- const CTType& ctType = *(const CTType*)(headerBytePtr + ctInfo.TypeInfo);
- const char* name = (const char*)(headerBytePtr + ctInfo.Name);
-
- BX_TRACE("%3d %2d %2d [%dx%d] %d %s[%d] c%d (%d)"
- , ii
- , ctType.Class
- , ctType.Type
- , ctType.Rows
- , ctType.Columns
- , ctType.StructMembers
- , name
- , ctType.Elements
- , ctInfo.RegisterIndex
- , ctInfo.RegisterCount
- );
+ D3DCOMPILE_OPTIMIZATION_LEVEL0,
+ D3DCOMPILE_OPTIMIZATION_LEVEL1,
+ D3DCOMPILE_OPTIMIZATION_LEVEL2,
+ D3DCOMPILE_OPTIMIZATION_LEVEL3,
+ };
- D3D11_SHADER_TYPE_DESC desc;
- desc.Class = (D3D_SHADER_VARIABLE_CLASS)ctType.Class;
- desc.Type = (D3D_SHADER_VARIABLE_TYPE)ctType.Type;
- desc.Rows = ctType.Rows;
- desc.Columns = ctType.Columns;
+ typedef std::vector<std::string> UniformNameList;
- UniformType::Enum type = findUniformType(desc);
- if (UniformType::Count != type)
+ static bool isSampler(D3D_SHADER_VARIABLE_TYPE _svt)
+ {
+ switch (_svt)
{
- Uniform un;
- un.name = '$' == name[0] ? name + 1 : name;
- un.type = isSampler(desc.Type)
- ? UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | type)
- : type
- ;
- un.num = (uint8_t)ctType.Elements;
- un.regIndex = ctInfo.RegisterIndex;
- un.regCount = ctInfo.RegisterCount;
-
- _uniforms.push_back(un);
+ case D3D_SVT_SAMPLER:
+ case D3D_SVT_SAMPLER1D:
+ case D3D_SVT_SAMPLER2D:
+ case D3D_SVT_SAMPLER3D:
+ case D3D_SVT_SAMPLERCUBE:
+ return true;
+
+ default:
+ break;
}
- }
-
- return true;
-}
-bool getReflectionDataDx11(ID3DBlob* _code, bool _vshader, UniformArray& _uniforms, uint8_t& _numAttrs, uint16_t* _attrs, uint16_t& _size, UniformNameList& unusedUniforms)
-{
- ID3D11ShaderReflection* reflect = NULL;
- HRESULT hr = D3DReflect(_code->GetBufferPointer()
- , _code->GetBufferSize()
- , IID_ID3D11ShaderReflection
- , (void**)&reflect
- );
- if (FAILED(hr) )
- {
- fprintf(stderr, "Error: 0x%08x\n", (uint32_t)hr);
return false;
}
- D3D11_SHADER_DESC desc;
- hr = reflect->GetDesc(&desc);
- if (FAILED(hr) )
+ bool getReflectionDataD3D9(ID3DBlob* _code, UniformArray& _uniforms)
{
- fprintf(stderr, BX_FILE_LINE_LITERAL "Error: 0x%08x\n", (uint32_t)hr);
- return false;
- }
+ // see reference for magic values: https://msdn.microsoft.com/en-us/library/ff552891(VS.85).aspx
+ const uint32_t D3DSIO_COMMENT = 0x0000FFFE;
+ const uint32_t D3DSIO_END = 0x0000FFFF;
+ const uint32_t D3DSI_OPCODE_MASK = 0x0000FFFF;
+ const uint32_t D3DSI_COMMENTSIZE_MASK = 0x7FFF0000;
+ const uint32_t CTAB_CONSTANT = MAKEFOURCC('C', 'T', 'A', 'B');
+
+ // parse the shader blob for the constant table
+ const size_t codeSize = _code->GetBufferSize();
+ const uint32_t* ptr = (const uint32_t*)_code->GetBufferPointer();
+ const uint32_t* end = (const uint32_t*)( (const uint8_t*)ptr + codeSize);
+ const CTHeader* header = NULL;
+
+ ptr++; // first byte is shader type / version; skip it since we already know
+
+ while (ptr < end && *ptr != D3DSIO_END)
+ {
+ uint32_t cur = *ptr++;
+ if ( (cur & D3DSI_OPCODE_MASK) != D3DSIO_COMMENT)
+ {
+ continue;
+ }
- BX_TRACE("Creator: %s 0x%08x", desc.Creator, desc.Version);
- BX_TRACE("Num constant buffers: %d", desc.ConstantBuffers);
+ // try to find CTAB comment block
+ uint32_t commentSize = (cur & D3DSI_COMMENTSIZE_MASK) >> 16;
+ uint32_t fourcc = *ptr;
+ if (fourcc == CTAB_CONSTANT)
+ {
+ // found the constant table data
+ header = (const CTHeader*)(ptr + 1);
+ uint32_t tableSize = (commentSize - 1) * 4;
+ if (tableSize < sizeof(CTHeader) || header->Size != sizeof(CTHeader) )
+ {
+ fprintf(stderr, "Error: Invalid constant table data\n");
+ return false;
+ }
+ break;
+ }
- BX_TRACE("Input:");
+ // this is a different kind of comment section, so skip over it
+ ptr += commentSize - 1;
+ }
- if (_vshader) // Only care about input semantic on vertex shaders
- {
- for (uint32_t ii = 0; ii < desc.InputParameters; ++ii)
+ if (!header)
{
- D3D11_SIGNATURE_PARAMETER_DESC spd;
- reflect->GetInputParameterDesc(ii, &spd);
- BX_TRACE("\t%2d: %s%d, vt %d, ct %d, mask %x, reg %d"
+ fprintf(stderr, "Error: Could not find constant table data\n");
+ return false;
+ }
+
+ const uint8_t* headerBytePtr = (const uint8_t*)header;
+ const char* creator = (const char*)(headerBytePtr + header->Creator);
+
+ BX_TRACE("Creator: %s 0x%08x", creator, header->Version);
+ BX_TRACE("Num constants: %d", header->Constants);
+ BX_TRACE("# cl ty RxC S By Name");
+
+ const CTInfo* ctInfoArray = (const CTInfo*)(headerBytePtr + header->ConstantInfo);
+ for (uint32_t ii = 0; ii < header->Constants; ++ii)
+ {
+ const CTInfo& ctInfo = ctInfoArray[ii];
+ const CTType& ctType = *(const CTType*)(headerBytePtr + ctInfo.TypeInfo);
+ const char* name = (const char*)(headerBytePtr + ctInfo.Name);
+
+ BX_TRACE("%3d %2d %2d [%dx%d] %d %s[%d] c%d (%d)"
, ii
- , spd.SemanticName
- , spd.SemanticIndex
- , spd.SystemValueType
- , spd.ComponentType
- , spd.Mask
- , spd.Register
+ , ctType.Class
+ , ctType.Type
+ , ctType.Rows
+ , ctType.Columns
+ , ctType.StructMembers
+ , name
+ , ctType.Elements
+ , ctInfo.RegisterIndex
+ , ctInfo.RegisterCount
);
- const RemapInputSemantic& ris = findInputSemantic(spd.SemanticName, spd.SemanticIndex);
- if (ris.m_attr != bgfx::Attrib::Count)
+ D3D11_SHADER_TYPE_DESC desc;
+ desc.Class = (D3D_SHADER_VARIABLE_CLASS)ctType.Class;
+ desc.Type = (D3D_SHADER_VARIABLE_TYPE)ctType.Type;
+ desc.Rows = ctType.Rows;
+ desc.Columns = ctType.Columns;
+
+ UniformType::Enum type = findUniformType(desc);
+ if (UniformType::Count != type)
{
- _attrs[_numAttrs] = bgfx::attribToId(ris.m_attr);
- ++_numAttrs;
+ Uniform un;
+ un.name = '$' == name[0] ? name + 1 : name;
+ un.type = isSampler(desc.Type)
+ ? UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | type)
+ : type
+ ;
+ un.num = (uint8_t)ctType.Elements;
+ un.regIndex = ctInfo.RegisterIndex;
+ un.regCount = ctInfo.RegisterCount;
+
+ _uniforms.push_back(un);
}
}
- }
- BX_TRACE("Output:");
- for (uint32_t ii = 0; ii < desc.OutputParameters; ++ii)
- {
- D3D11_SIGNATURE_PARAMETER_DESC spd;
- reflect->GetOutputParameterDesc(ii, &spd);
- BX_TRACE("\t%2d: %s%d, %d, %d", ii, spd.SemanticName, spd.SemanticIndex, spd.SystemValueType, spd.ComponentType);
+ return true;
}
- for (uint32_t ii = 0, num = bx::uint32_min(1, desc.ConstantBuffers); ii < num; ++ii)
+ bool getReflectionDataD3D11(ID3DBlob* _code, bool _vshader, UniformArray& _uniforms, uint8_t& _numAttrs, uint16_t* _attrs, uint16_t& _size, UniformNameList& unusedUniforms)
{
- ID3D11ShaderReflectionConstantBuffer* cbuffer = reflect->GetConstantBufferByIndex(ii);
- D3D11_SHADER_BUFFER_DESC bufferDesc;
- hr = cbuffer->GetDesc(&bufferDesc);
+ ID3D11ShaderReflection* reflect = NULL;
+ HRESULT hr = D3DReflect(_code->GetBufferPointer()
+ , _code->GetBufferSize()
+ , s_compiler->IID_ID3D11ShaderReflection
+ , (void**)&reflect
+ );
+ if (FAILED(hr) )
+ {
+ fprintf(stderr, "Error: D3DReflect failed 0x%08x\n", (uint32_t)hr);
+ return false;
+ }
+
+ D3D11_SHADER_DESC desc;
+ hr = reflect->GetDesc(&desc);
+ if (FAILED(hr) )
+ {
+ fprintf(stderr, "Error: ID3D11ShaderReflection::GetDesc failed 0x%08x\n", (uint32_t)hr);
+ return false;
+ }
+
+ BX_TRACE("Creator: %s 0x%08x", desc.Creator, desc.Version);
+ BX_TRACE("Num constant buffers: %d", desc.ConstantBuffers);
- _size = (uint16_t)bufferDesc.Size;
+ BX_TRACE("Input:");
- if (SUCCEEDED(hr) )
+ if (_vshader) // Only care about input semantic on vertex shaders
{
- BX_TRACE("%s, %d, vars %d, size %d"
- , bufferDesc.Name
- , bufferDesc.Type
- , bufferDesc.Variables
- , bufferDesc.Size
- );
+ for (uint32_t ii = 0; ii < desc.InputParameters; ++ii)
+ {
+ D3D11_SIGNATURE_PARAMETER_DESC spd;
+ reflect->GetInputParameterDesc(ii, &spd);
+ BX_TRACE("\t%2d: %s%d, vt %d, ct %d, mask %x, reg %d"
+ , ii
+ , spd.SemanticName
+ , spd.SemanticIndex
+ , spd.SystemValueType
+ , spd.ComponentType
+ , spd.Mask
+ , spd.Register
+ );
- for (uint32_t jj = 0; jj < bufferDesc.Variables; ++jj)
+ const RemapInputSemantic& ris = findInputSemantic(spd.SemanticName, spd.SemanticIndex);
+ if (ris.m_attr != bgfx::Attrib::Count)
+ {
+ _attrs[_numAttrs] = bgfx::attribToId(ris.m_attr);
+ ++_numAttrs;
+ }
+ }
+ }
+
+ BX_TRACE("Output:");
+ for (uint32_t ii = 0; ii < desc.OutputParameters; ++ii)
+ {
+ D3D11_SIGNATURE_PARAMETER_DESC spd;
+ reflect->GetOutputParameterDesc(ii, &spd);
+ BX_TRACE("\t%2d: %s%d, %d, %d", ii, spd.SemanticName, spd.SemanticIndex, spd.SystemValueType, spd.ComponentType);
+ }
+
+ for (uint32_t ii = 0, num = bx::uint32_min(1, desc.ConstantBuffers); ii < num; ++ii)
+ {
+ ID3D11ShaderReflectionConstantBuffer* cbuffer = reflect->GetConstantBufferByIndex(ii);
+ D3D11_SHADER_BUFFER_DESC bufferDesc;
+ hr = cbuffer->GetDesc(&bufferDesc);
+
+ _size = (uint16_t)bufferDesc.Size;
+
+ if (SUCCEEDED(hr) )
{
- ID3D11ShaderReflectionVariable* var = cbuffer->GetVariableByIndex(jj);
- ID3D11ShaderReflectionType* type = var->GetType();
- D3D11_SHADER_VARIABLE_DESC varDesc;
- hr = var->GetDesc(&varDesc);
- if (SUCCEEDED(hr) )
+ BX_TRACE("%s, %d, vars %d, size %d"
+ , bufferDesc.Name
+ , bufferDesc.Type
+ , bufferDesc.Variables
+ , bufferDesc.Size
+ );
+
+ for (uint32_t jj = 0; jj < bufferDesc.Variables; ++jj)
{
- D3D11_SHADER_TYPE_DESC constDesc;
- hr = type->GetDesc(&constDesc);
+ ID3D11ShaderReflectionVariable* var = cbuffer->GetVariableByIndex(jj);
+ ID3D11ShaderReflectionType* type = var->GetType();
+ D3D11_SHADER_VARIABLE_DESC varDesc;
+ hr = var->GetDesc(&varDesc);
if (SUCCEEDED(hr) )
{
- UniformType::Enum uniformType = findUniformType(constDesc);
-
- if (UniformType::Count != uniformType
- && 0 != (varDesc.uFlags & D3D_SVF_USED) )
+ D3D11_SHADER_TYPE_DESC constDesc;
+ hr = type->GetDesc(&constDesc);
+ if (SUCCEEDED(hr) )
{
- Uniform un;
- un.name = varDesc.Name;
- un.type = uniformType;
- un.num = constDesc.Elements;
- un.regIndex = varDesc.StartOffset;
- un.regCount = BX_ALIGN_16(varDesc.Size) / 16;
- _uniforms.push_back(un);
-
- BX_TRACE("\t%s, %d, size %d, flags 0x%08x, %d (used)"
- , varDesc.Name
- , varDesc.StartOffset
- , varDesc.Size
- , varDesc.uFlags
- , uniformType
- );
- }
- else
- {
- if (0 == (varDesc.uFlags & D3D_SVF_USED) )
+ UniformType::Enum uniformType = findUniformType(constDesc);
+
+ if (UniformType::Count != uniformType
+ && 0 != (varDesc.uFlags & D3D_SVF_USED) )
{
- unusedUniforms.push_back(varDesc.Name);
+ Uniform un;
+ un.name = varDesc.Name;
+ un.type = uniformType;
+ un.num = constDesc.Elements;
+ un.regIndex = varDesc.StartOffset;
+ un.regCount = BX_ALIGN_16(varDesc.Size) / 16;
+ _uniforms.push_back(un);
+
+ BX_TRACE("\t%s, %d, size %d, flags 0x%08x, %d (used)"
+ , varDesc.Name
+ , varDesc.StartOffset
+ , varDesc.Size
+ , varDesc.uFlags
+ , uniformType
+ );
}
+ else
+ {
+ if (0 == (varDesc.uFlags & D3D_SVF_USED) )
+ {
+ unusedUniforms.push_back(varDesc.Name);
+ }
- BX_TRACE("\t%s, unknown type", varDesc.Name);
+ BX_TRACE("\t%s, unknown type", varDesc.Name);
+ }
}
}
}
}
}
- }
-
- BX_TRACE("Bound:");
- for (uint32_t ii = 0; ii < desc.BoundResources; ++ii)
- {
- D3D11_SHADER_INPUT_BIND_DESC bindDesc;
- hr = reflect->GetResourceBindingDesc(ii, &bindDesc);
- if (SUCCEEDED(hr) )
+ BX_TRACE("Bound:");
+ for (uint32_t ii = 0; ii < desc.BoundResources; ++ii)
{
- if (D3D_SIT_SAMPLER == bindDesc.Type)
- {
- BX_TRACE("\t%s, %d, %d, %d"
- , bindDesc.Name
- , bindDesc.Type
- , bindDesc.BindPoint
- , bindDesc.BindCount
- );
+ D3D11_SHADER_INPUT_BIND_DESC bindDesc;
- const char * end = strstr(bindDesc.Name, "Sampler");
- if (NULL != end)
+ hr = reflect->GetResourceBindingDesc(ii, &bindDesc);
+ if (SUCCEEDED(hr) )
+ {
+ if (D3D_SIT_SAMPLER == bindDesc.Type)
{
- Uniform un;
- 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;
- _uniforms.push_back(un);
+ BX_TRACE("\t%s, %d, %d, %d"
+ , bindDesc.Name
+ , bindDesc.Type
+ , bindDesc.BindPoint
+ , bindDesc.BindCount
+ );
+
+ const char * end = strstr(bindDesc.Name, "Sampler");
+ if (NULL != end)
+ {
+ Uniform un;
+ 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;
+ _uniforms.push_back(un);
+ }
}
}
}
- }
-
- if (NULL != reflect)
- {
- reflect->Release();
- }
-
- return true;
-}
-bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass)
-{
- BX_TRACE("DX11");
+ if (NULL != reflect)
+ {
+ reflect->Release();
+ }
- const char* profile = _cmdLine.findOption('p', "profile");
- if (NULL == profile)
- {
- fprintf(stderr, "Shader profile must be specified.\n");
- return false;
+ return true;
}
- bool debug = _cmdLine.hasArg('\0', "debug");
-
- uint32_t flags = D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
- flags |= debug ? D3DCOMPILE_DEBUG : 0;
- flags |= _cmdLine.hasArg('\0', "avoid-flow-control") ? D3DCOMPILE_AVOID_FLOW_CONTROL : 0;
- flags |= _cmdLine.hasArg('\0', "no-preshader") ? D3DCOMPILE_NO_PRESHADER : 0;
- flags |= _cmdLine.hasArg('\0', "partial-precision") ? D3DCOMPILE_PARTIAL_PRECISION : 0;
- flags |= _cmdLine.hasArg('\0', "prefer-flow-control") ? D3DCOMPILE_PREFER_FLOW_CONTROL : 0;
- flags |= _cmdLine.hasArg('\0', "backwards-compatibility") ? D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY : 0;
+ bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass)
+ {
+ const char* profile = _cmdLine.findOption('p', "profile");
+ if (NULL == profile)
+ {
+ fprintf(stderr, "Error: Shader profile must be specified.\n");
+ return false;
+ }
- bool werror = _cmdLine.hasArg('\0', "Werror");
+ s_compiler = load();
- if (werror)
- {
- flags |= D3DCOMPILE_WARNINGS_ARE_ERRORS;
- }
+ bool result = false;
+ bool debug = _cmdLine.hasArg('\0', "debug");
- uint32_t optimization = 3;
- if (_cmdLine.hasArg(optimization, 'O') )
- {
- optimization = bx::uint32_min(optimization, BX_COUNTOF(s_optimizationLevelDx11)-1);
- flags |= s_optimizationLevelDx11[optimization];
- }
- else
- {
- flags |= D3DCOMPILE_SKIP_OPTIMIZATION;
- }
+ uint32_t flags = D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
+ flags |= debug ? D3DCOMPILE_DEBUG : 0;
+ flags |= _cmdLine.hasArg('\0', "avoid-flow-control") ? D3DCOMPILE_AVOID_FLOW_CONTROL : 0;
+ flags |= _cmdLine.hasArg('\0', "no-preshader") ? D3DCOMPILE_NO_PRESHADER : 0;
+ flags |= _cmdLine.hasArg('\0', "partial-precision") ? D3DCOMPILE_PARTIAL_PRECISION : 0;
+ flags |= _cmdLine.hasArg('\0', "prefer-flow-control") ? D3DCOMPILE_PREFER_FLOW_CONTROL : 0;
+ flags |= _cmdLine.hasArg('\0', "backwards-compatibility") ? D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY : 0;
- BX_TRACE("Profile: %s", profile);
- BX_TRACE("Flags: 0x%08x", flags);
+ bool werror = _cmdLine.hasArg('\0', "Werror");
- ID3DBlob* code;
- ID3DBlob* errorMsg;
+ if (werror)
+ {
+ flags |= D3DCOMPILE_WARNINGS_ARE_ERRORS;
+ }
- // Output preprocessed shader so that HLSL can be debugged via GPA
- // or PIX. Compiling through memory won't embed preprocessed shader
- // file path.
- std::string hlslfp;
+ uint32_t optimization = 3;
+ if (_cmdLine.hasArg(optimization, 'O') )
+ {
+ optimization = bx::uint32_min(optimization, BX_COUNTOF(s_optimizationLevelD3D11) - 1);
+ flags |= s_optimizationLevelD3D11[optimization];
+ }
+ else
+ {
+ flags |= D3DCOMPILE_SKIP_OPTIMIZATION;
+ }
- if (debug)
- {
- hlslfp = _cmdLine.findOption('o');
- hlslfp += ".hlsl";
- writeFile(hlslfp.c_str(), _code.c_str(), (int32_t)_code.size() );
- }
+ BX_TRACE("Profile: %s", profile);
+ BX_TRACE("Flags: 0x%08x", flags);
- HRESULT hr = D3DCompile(_code.c_str()
- , _code.size()
- , hlslfp.c_str()
- , NULL
- , NULL
- , "main"
- , profile
- , flags
- , 0
- , &code
- , &errorMsg
- );
- if (FAILED(hr)
- || (werror && NULL != errorMsg) )
- {
- const char* log = (char*)errorMsg->GetBufferPointer();
+ ID3DBlob* code;
+ ID3DBlob* errorMsg;
- int32_t line = 0;
- int32_t column = 0;
- int32_t start = 0;
- int32_t end = INT32_MAX;
+ // Output preprocessed shader so that HLSL can be debugged via GPA
+ // or PIX. Compiling through memory won't embed preprocessed shader
+ // file path.
+ std::string hlslfp;
- if (2 == sscanf(log, "(%u,%u):", &line, &column)
- && 0 != line)
+ if (debug)
{
- start = bx::uint32_imax(1, line-10);
- end = start + 20;
+ hlslfp = _cmdLine.findOption('o');
+ hlslfp += ".hlsl";
+ writeFile(hlslfp.c_str(), _code.c_str(), (int32_t)_code.size() );
}
- printCode(_code.c_str(), line, start, end);
- fprintf(stderr, "Error: 0x%08x %s\n", (uint32_t)hr, log);
- errorMsg->Release();
- return false;
- }
+ HRESULT hr = D3DCompile(_code.c_str()
+ , _code.size()
+ , hlslfp.c_str()
+ , NULL
+ , NULL
+ , "main"
+ , profile
+ , flags
+ , 0
+ , &code
+ , &errorMsg
+ );
+ if (FAILED(hr)
+ || (werror && NULL != errorMsg) )
+ {
+ const char* log = (char*)errorMsg->GetBufferPointer();
- UniformArray uniforms;
- uint8_t numAttrs = 0;
- uint16_t attrs[bgfx::Attrib::Count];
- uint16_t size = 0;
+ int32_t line = 0;
+ int32_t column = 0;
+ int32_t start = 0;
+ int32_t end = INT32_MAX;
- if (_d3d == 9)
- {
- if (!getReflectionDataDx9(code, uniforms) )
- {
+ if (2 == sscanf(log, "(%u,%u):", &line, &column)
+ && 0 != line)
+ {
+ start = bx::uint32_imax(1, line - 10);
+ end = start + 20;
+ }
+
+ printCode(_code.c_str(), line, start, end);
+ fprintf(stderr, "Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log);
+ errorMsg->Release();
return false;
}
- }
- else
- {
- UniformNameList unusedUniforms;
- if (!getReflectionDataDx11(code, profile[0] == 'v', uniforms, numAttrs, attrs, size, unusedUniforms) )
+
+ UniformArray uniforms;
+ uint8_t numAttrs = 0;
+ uint16_t attrs[bgfx::Attrib::Count];
+ uint16_t size = 0;
+
+ if (_d3d == 9)
{
- return false;
+ if (!getReflectionDataD3D9(code, uniforms) )
+ {
+ fprintf(stderr, "Error: Unable to get D3D9 reflection data.\n");
+ goto error;
+ }
}
-
- if (_firstPass
- && unusedUniforms.size() > 0)
+ else
{
- const size_t strLength = strlen("uniform");
+ UniformNameList unusedUniforms;
+ if (!getReflectionDataD3D11(code, profile[0] == 'v', uniforms, numAttrs, attrs, size, unusedUniforms) )
+ {
+ fprintf(stderr, "Unable to get D3D11 reflection data.\n");
+ goto error;
+ }
- // first time through, we just find unused uniforms and get rid of them
- std::string output;
- LineReader reader(_code.c_str() );
- while (!reader.isEof() )
+ if (_firstPass
+ && unusedUniforms.size() > 0)
{
- std::string line = reader.getLine();
- for (UniformNameList::iterator it = unusedUniforms.begin(), itEnd = unusedUniforms.end(); it != itEnd; ++it)
+ const size_t strLength = strlen("uniform");
+
+ // first time through, we just find unused uniforms and get rid of them
+ std::string output;
+ LineReader reader(_code.c_str() );
+ while (!reader.isEof() )
{
- size_t index = line.find("uniform ");
- if (index == std::string::npos)
+ std::string line = reader.getLine();
+ for (UniformNameList::iterator it = unusedUniforms.begin(), itEnd = unusedUniforms.end(); it != itEnd; ++it)
{
- continue;
- }
+ 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
- // we can't just remove them, because unused functions might still reference
- // them and cause a compile error when they're gone
- if (!!bx::findIdentifierMatch(line.c_str(), it->c_str() ) )
- {
- line = line.replace(index, strLength, "static");
- unusedUniforms.erase(it);
- break;
+ // 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
+ // we can't just remove them, because unused functions might still reference
+ // them and cause a compile error when they're gone
+ if (!!bx::findIdentifierMatch(line.c_str(), it->c_str() ) )
+ {
+ line = line.replace(index, strLength, "static");
+ unusedUniforms.erase(it);
+ break;
+ }
}
+
+ output += line;
}
- output += line;
+ // recompile with the unused uniforms converted to statics
+ return compileHLSLShader(_cmdLine, _d3d, output.c_str(), _writer, false);
}
-
- // recompile with the unused uniforms converted to statics
- return compileHLSLShader(_cmdLine, _d3d, output.c_str(), _writer, false);
}
- }
- uint16_t count = (uint16_t)uniforms.size();
- bx::write(_writer, count);
+ {
+ uint16_t count = (uint16_t)uniforms.size();
+ bx::write(_writer, count);
- uint32_t fragmentBit = profile[0] == 'p' ? BGFX_UNIFORM_FRAGMENTBIT : 0;
- for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it)
- {
- const Uniform& un = *it;
- 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;
- bx::write(_writer, type);
- bx::write(_writer, un.num);
- bx::write(_writer, un.regIndex);
- bx::write(_writer, un.regCount);
-
- BX_TRACE("%s, %s, %d, %d, %d"
- , un.name.c_str()
- , getUniformTypeName(un.type)
- , un.num
- , un.regIndex
- , un.regCount
- );
- }
+ uint32_t fragmentBit = profile[0] == 'p' ? BGFX_UNIFORM_FRAGMENTBIT : 0;
+ for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it)
+ {
+ const Uniform& un = *it;
+ 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;
+ bx::write(_writer, type);
+ bx::write(_writer, un.num);
+ bx::write(_writer, un.regIndex);
+ bx::write(_writer, un.regCount);
+
+ BX_TRACE("%s, %s, %d, %d, %d"
+ , un.name.c_str()
+ , getUniformTypeName(un.type)
+ , un.num
+ , un.regIndex
+ , un.regCount
+ );
+ }
+ }
- {
- ID3DBlob* stripped;
- hr = D3DStripShader(code->GetBufferPointer()
- , code->GetBufferSize()
- , D3DCOMPILER_STRIP_REFLECTION_DATA
- | D3DCOMPILER_STRIP_TEST_BLOBS
- , &stripped
- );
+ {
+ ID3DBlob* stripped;
+ hr = D3DStripShader(code->GetBufferPointer()
+ , code->GetBufferSize()
+ , D3DCOMPILER_STRIP_REFLECTION_DATA
+ | D3DCOMPILER_STRIP_TEST_BLOBS
+ , &stripped
+ );
+
+ if (SUCCEEDED(hr) )
+ {
+ code->Release();
+ code = stripped;
+ }
+ }
- if (SUCCEEDED(hr) )
{
- code->Release();
- code = stripped;
+ uint16_t shaderSize = (uint16_t)code->GetBufferSize();
+ bx::write(_writer, shaderSize);
+ bx::write(_writer, code->GetBufferPointer(), shaderSize);
+ uint8_t nul = 0;
+ bx::write(_writer, nul);
}
- }
- uint16_t shaderSize = (uint16_t)code->GetBufferSize();
- bx::write(_writer, shaderSize);
- bx::write(_writer, code->GetBufferPointer(), shaderSize);
- uint8_t nul = 0;
- bx::write(_writer, nul);
+ if (_d3d > 9)
+ {
+ bx::write(_writer, numAttrs);
+ bx::write(_writer, attrs, numAttrs*sizeof(uint16_t) );
- if (_d3d > 9)
- {
- bx::write(_writer, numAttrs);
- bx::write(_writer, attrs, numAttrs*sizeof(uint16_t) );
+ bx::write(_writer, size);
+ }
- bx::write(_writer, size);
- }
+ if (_cmdLine.hasArg('\0', "disasm") )
+ {
+ ID3DBlob* disasm;
+ D3DDisassemble(code->GetBufferPointer()
+ , code->GetBufferSize()
+ , 0
+ , NULL
+ , &disasm
+ );
- if (_cmdLine.hasArg('\0', "disasm") )
- {
- ID3DBlob* disasm;
- D3DDisassemble(code->GetBufferPointer()
- , code->GetBufferSize()
- , 0
- , NULL
- , &disasm
- );
+ if (NULL != disasm)
+ {
+ std::string disasmfp = _cmdLine.findOption('o');
+ disasmfp += ".disasm";
- if (NULL != disasm)
- {
- std::string disasmfp = _cmdLine.findOption('o');
- disasmfp += ".disasm";
+ writeFile(disasmfp.c_str(), disasm->GetBufferPointer(), (uint32_t)disasm->GetBufferSize() );
+ disasm->Release();
+ }
+ }
- writeFile(disasmfp.c_str(), disasm->GetBufferPointer(), (uint32_t)disasm->GetBufferSize() );
- disasm->Release();
+ if (NULL != errorMsg)
+ {
+ errorMsg->Release();
}
- }
- if (NULL != errorMsg)
- {
- errorMsg->Release();
- }
+ result = true;
- code->Release();
+ error:
+ code->Release();
+ unload();
+ return result;
+ }
- return true;
-}
+} // namespace bgfx
#else
-bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass)
+namespace bgfx
{
- BX_UNUSED(_cmdLine, _d3d, _code, _writer, _firstPass);
- fprintf(stderr, "HLSL compiler is not supported on this platform.\n");
- return false;
-}
+
+ bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass)
+ {
+ BX_UNUSED(_cmdLine, _d3d, _code, _writer, _firstPass);
+ fprintf(stderr, "HLSL compiler is not supported on this platform.\n");
+ return false;
+ }
+
+} // namespace bgfx
#endif // SHADERC_CONFIG_HLSL
diff --git a/3rdparty/bgfx/tools/texturec/texturec.cpp b/3rdparty/bgfx/tools/texturec/texturec.cpp
index 7c66cdd310c..81bccfeb6f6 100644
--- a/3rdparty/bgfx/tools/texturec/texturec.cpp
+++ b/3rdparty/bgfx/tools/texturec/texturec.cpp
@@ -13,9 +13,11 @@
#include "image.h"
#include <libsquish/squish.h>
#include <etc1/etc1.h>
+#include <etc2/ProcessRGB.hpp>
#include <nvtt/nvtt.h>
#include <pvrtc/PvrTcEncoder.h>
#include <tinyexr/tinyexr.h>
+#include <edtaa3/edtaa3func.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb/stb_image.c>
@@ -54,7 +56,7 @@ namespace bgfx
::free(mem);
}
- void imageEncodeFromRgba8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint8_t _format)
+ bool imageEncodeFromRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint8_t _format)
{
TextureFormat::Enum format = TextureFormat::Enum(_format);
@@ -65,32 +67,52 @@ namespace bgfx
case TextureFormat::BC3:
case TextureFormat::BC4:
case TextureFormat::BC5:
- squish::CompressImage(_src, _width, _height, _dst
+ squish::CompressImage( (const uint8_t*)_src, _width, _height, _dst
, format == TextureFormat::BC2 ? squish::kDxt3
: format == TextureFormat::BC3 ? squish::kDxt5
: format == TextureFormat::BC4 ? squish::kBc4
: format == TextureFormat::BC5 ? squish::kBc5
: squish::kDxt1
);
- break;
+ return true;
case TextureFormat::BC6H:
- nvtt::compressBC6H(_src, _width, _height, 4, _dst);
- break;
+ nvtt::compressBC6H( (const uint8_t*)_src, _width, _height, 4, _dst);
+ return true;
case TextureFormat::BC7:
- nvtt::compressBC7(_src, _width, _height, 4, _dst);
- break;
+ nvtt::compressBC7( (const uint8_t*)_src, _width, _height, 4, _dst);
+ return true;
case TextureFormat::ETC1:
- etc1_encode_image(_src, _width, _height, 4, _width*4, _dst);
- break;
+ etc1_encode_image( (const uint8_t*)_src, _width, _height, 4, _width*4, (uint8_t*)_dst);
+ return true;
case TextureFormat::ETC2:
- case TextureFormat::ETC2A:
- case TextureFormat::ETC2A1:
- case TextureFormat::PTC12:
- break;
+ {
+ const uint32_t blockWidth = (_width +3)/4;
+ const uint32_t blockHeight = (_height+3)/4;
+ const uint32_t pitch = _width*4;
+ const uint8_t* src = (const uint8_t*)_src;
+ uint64_t* dst = (uint64_t*)_dst;
+ for (uint32_t yy = 0; yy < blockHeight; ++yy)
+ {
+ for (uint32_t xx = 0; xx < blockWidth; ++xx)
+ {
+ uint8_t block[4*4*4];
+ const uint8_t* ptr = &src[(yy*pitch+xx*4)*4];
+
+ for (uint32_t ii = 0; ii < 16; ++ii)
+ { // BGRx
+ memcpy(&block[ii*4], &ptr[(ii%4)*pitch + (ii&~3)], 4);
+ bx::xchg(block[ii*4+0], block[ii*4+2]);
+ }
+
+ *dst++ = ProcessRGB_ETC2(block);
+ }
+ }
+ }
+ return true;
case TextureFormat::PTC14:
{
@@ -98,14 +120,11 @@ namespace bgfx
RgbBitmap bmp;
bmp.width = _width;
bmp.height = _height;
- bmp.data = const_cast<uint8_t*>(_src);
+ bmp.data = (uint8_t*)const_cast<void*>(_src);
PvrTcEncoder::EncodeRgb4Bpp(_dst, bmp);
bmp.data = NULL;
}
- break;
-
- case TextureFormat::PTC12A:
- break;
+ return true;
case TextureFormat::PTC14A:
{
@@ -113,27 +132,186 @@ namespace bgfx
RgbaBitmap bmp;
bmp.width = _width;
bmp.height = _height;
- bmp.data = const_cast<uint8_t*>(_src);
+ bmp.data = (uint8_t*)const_cast<void*>(_src);
PvrTcEncoder::EncodeRgba4Bpp(_dst, bmp);
bmp.data = NULL;
}
- break;
-
- case TextureFormat::PTC22:
- case TextureFormat::PTC24:
- break;
+ return true;
case TextureFormat::BGRA8:
imageSwizzleBgra8(_width, _height, _width*4, _src, _dst);
- break;
+ return true;
case TextureFormat::RGBA8:
memcpy(_dst, _src, _width*_height*4);
- break;
+ return true;
default:
- break;
+ return imageConvert(_dst, format, _src, TextureFormat::RGBA8, _width, _height);
+ }
+
+ return false;
+ }
+
+ bool imageEncodeFromRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint8_t _format)
+ {
+ TextureFormat::Enum format = TextureFormat::Enum(_format);
+
+ const uint8_t* src = (const uint8_t*)_src;
+
+ switch (format)
+ {
+ case TextureFormat::RGBA8:
+ {
+ uint8_t* dst = (uint8_t*)_dst;
+ for (uint32_t yy = 0; yy < _height; ++yy)
+ {
+ for (uint32_t xx = 0; xx < _width; ++xx)
+ {
+ const uint32_t offset = yy*_width + xx;
+ const float* input = (const float*)&src[offset * 16];
+ uint8_t* output = &dst[offset * 4];
+ output[0] = uint8_t(input[0]*255.0f + 0.5f);
+ output[1] = uint8_t(input[1]*255.0f + 0.5f);
+ output[2] = uint8_t(input[2]*255.0f + 0.5f);
+ output[3] = uint8_t(input[3]*255.0f + 0.5f);
+ }
+ }
+ }
+ return true;
+
+ case TextureFormat::BC5:
+ {
+ uint8_t* temp = (uint8_t*)BX_ALLOC(_allocator, _width*_height*4);
+ for (uint32_t yy = 0; yy < _height; ++yy)
+ {
+ for (uint32_t xx = 0; xx < _width; ++xx)
+ {
+ const uint32_t offset = yy*_width + xx;
+ const float* input = (const float*)&src[offset * 16];
+ uint8_t* output = &temp[offset * 4];
+ output[0] = uint8_t(input[0]*255.0f + 0.5f);
+ output[1] = uint8_t(input[1]*255.0f + 0.5f);
+ output[2] = uint8_t(input[2]*255.0f + 0.5f);
+ output[3] = uint8_t(input[3]*255.0f + 0.5f);
+ }
+ }
+
+ imageEncodeFromRgba8(_dst, temp, _width, _height, _format);
+ BX_FREE(_allocator, temp);
+ }
+ return true;
+
+ default:
+ return imageConvert(_dst, format, _src, TextureFormat::RGBA32F, _width, _height);
+ }
+
+ return false;
+ }
+
+ void imageRgba32f11to01(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ uint8_t* dst = (uint8_t*)_dst;
+
+ for (uint32_t yy = 0; yy < _height; ++yy)
+ {
+ for (uint32_t xx = 0; xx < _width; ++xx)
+ {
+ const uint32_t offset = yy*_pitch + xx * 16;
+ const float* input = (const float*)&src[offset];
+ float* output = (float*)&dst[offset];
+ output[0] = input[0]*0.5f + 0.5f;
+ output[1] = input[1]*0.5f + 0.5f;
+ output[2] = input[2]*0.5f + 0.5f;
+ output[3] = input[3]*0.5f + 0.5f;
+ }
+ }
+ }
+
+ static void edtaa3(bx::AllocatorI* _allocator, double* _dst, uint32_t _width, uint32_t _height, double* _src)
+ {
+ const uint32_t numPixels = _width*_height;
+
+ short* xdist = (short *)BX_ALLOC(_allocator, numPixels*sizeof(short) );
+ short* ydist = (short *)BX_ALLOC(_allocator, numPixels*sizeof(short) );
+ double* gx = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) );
+ double* gy = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) );
+
+ ::computegradient(_src, _width, _height, gx, gy);
+ ::edtaa3(_src, gx, gy, _width, _height, xdist, ydist, _dst);
+
+ for (uint32_t ii = 0; ii < numPixels; ++ii)
+ {
+ if (_dst[ii] < 0.0)
+ {
+ _dst[ii] = 0.0;
+ }
}
+
+ BX_FREE(_allocator, xdist);
+ BX_FREE(_allocator, ydist);
+ BX_FREE(_allocator, gx);
+ BX_FREE(_allocator, gy);
+ }
+
+ inline double min(double _a, double _b)
+ {
+ return _a > _b ? _b : _a;
+ }
+
+ inline double max(double _a, double _b)
+ {
+ return _a > _b ? _a : _b;
+ }
+
+ inline double clamp(double _val, double _min, double _max)
+ {
+ return max(min(_val, _max), _min);
+ }
+
+ void imageMakeDist(bx::AllocatorI* _allocator, void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, float _edge, const void* _src)
+ {
+ const uint32_t numPixels = _width*_height;
+
+ double* imgIn = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) );
+ double* outside = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) );
+ double* inside = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) );
+
+ for (uint32_t yy = 0; yy < _height; ++yy)
+ {
+ const uint8_t* src = (const uint8_t*)_src + yy*_pitch;
+ double* dst = &imgIn[yy*_width];
+ for (uint32_t xx = 0; xx < _width; ++xx)
+ {
+ dst[xx] = double(src[xx])/255.0;
+ }
+ }
+
+ edtaa3(_allocator, outside, _width, _height, imgIn);
+
+ for (uint32_t ii = 0; ii < numPixels; ++ii)
+ {
+ imgIn[ii] = 1.0 - imgIn[ii];
+ }
+
+ edtaa3(_allocator, inside, _width, _height, imgIn);
+
+ BX_FREE(_allocator, imgIn);
+
+ uint8_t* dst = (uint8_t*)_dst;
+
+ double edgeOffset = _edge*0.5;
+ double invEdge = 1.0/_edge;
+
+ for (uint32_t ii = 0; ii < numPixels; ++ii)
+ {
+ double dist = clamp( ( (outside[ii] - inside[ii])+edgeOffset) * invEdge, 0.0, 1.0);
+ dst[ii] = 255-uint8_t(dist * 255.0);
+ }
+
+ BX_FREE(_allocator, inside);
+ BX_FREE(_allocator, outside);
}
} // namespace bgfx
@@ -168,6 +346,8 @@ void help(const char* _error = NULL)
" -o <file path> Output file path (file will be written in KTX format).\n"
" -t <format> Output format type (BC1/2/3/4/5, ETC1, PVR14, etc.).\n"
" -m, --mips Generate mip-maps.\n"
+ " -n, --normalmap Input texture is normal map.\n"
+ " --sdf <edge> Compute SDF texture.\n"
"\n"
"For additional information, see https://github.com/bkaradzic/bgfx\n"
@@ -198,14 +378,23 @@ int main(int _argc, const char* _argv[])
return EXIT_FAILURE;
}
+ bool sdf = false;
+ double edge = 16.0;
+ const char* edgeOpt = cmdLine.findOption("sdf");
+ if (NULL != edgeOpt)
+ {
+ sdf = true;
+ edge = atof(edgeOpt);
+ }
+ BX_UNUSED(sdf, edge);
+
bx::CrtFileReader reader;
- if (0 != bx::open(&reader, inputFileName) )
+ if (!bx::open(&reader, inputFileName) )
{
help("Failed to open input file.");
return EXIT_FAILURE;
}
- const bool mips = cmdLine.hasArg('m', "mips");
const char* type = cmdLine.findOption('t');
bgfx::TextureFormat::Enum format = bgfx::TextureFormat::BGRA8;
@@ -220,6 +409,9 @@ int main(int _argc, const char* _argv[])
}
}
+ const bool mips = cmdLine.hasArg('m', "mips");
+ const bool normalMap = cmdLine.hasArg('n', "normalmap");
+
uint32_t size = (uint32_t)bx::getSize(&reader);
const bgfx::Memory* mem = bgfx::alloc(size);
bx::read(&reader, mem->data, mem->size);
@@ -271,46 +463,99 @@ int main(int _argc, const char* _argv[])
ImageMip mip;
if (imageGetRawData(imageContainer, 0, 0, mem->data, mem->size, mip) )
{
- uint32_t size = imageGetSize(TextureFormat::RGBA8, mip.m_width, mip.m_height);
- uint8_t* rgba = (uint8_t*)BX_ALLOC(&allocator, size);
-
- imageDecodeToRgba8(rgba
- , mip.m_data
- , mip.m_width
- , mip.m_height
- , mip.m_width*mip.m_bpp/8
- , mip.m_format
- );
-
uint8_t numMips = mips
? imageGetNumMips(format, mip.m_width, mip.m_height)
: 1
;
- imageContainer.m_size = imageGetSize(format, mip.m_width, mip.m_height, 0, false, numMips);
- imageContainer.m_format = format;
- output = alloc(imageContainer.m_size);
- imageEncodeFromRgba8(output->data, rgba, mip.m_width, mip.m_height, format);
+ void* temp = NULL;
+
+ if (normalMap)
+ {
+ uint32_t size = imageGetSize(TextureFormat::RGBA32F, mip.m_width, mip.m_height);
+ temp = BX_ALLOC(&allocator, size);
+ float* rgba = (float*)temp;
+ float* rgbaDst = (float*)BX_ALLOC(&allocator, size);
+
+ imageDecodeToRgba32f(&allocator
+ , rgba
+ , mip.m_data
+ , mip.m_width
+ , mip.m_height
+ , mip.m_width*mip.m_bpp/8
+ , mip.m_format
+ );
+
+ if (TextureFormat::BC5 != mip.m_format)
+ {
+ for (uint32_t yy = 0; yy < mip.m_height; ++yy)
+ {
+ for (uint32_t xx = 0; xx < mip.m_width; ++xx)
+ {
+ 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;
+ }
+ }
+ }
+
+ output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips);
+
+ imageRgba32f11to01(rgbaDst, mip.m_width, mip.m_height, mip.m_width*16, rgba);
+ imageEncodeFromRgba32f(&allocator, output->data, rgbaDst, mip.m_width, mip.m_height, format);
- for (uint8_t lod = 1; lod < numMips; ++lod)
+ for (uint8_t lod = 1; lod < numMips; ++lod)
+ {
+ imageRgba32fDownsample2x2NormalMap(mip.m_width, mip.m_height, mip.m_width*16, rgba, rgba);
+ imageRgba32f11to01(rgbaDst, mip.m_width, mip.m_height, mip.m_width*16, rgba);
+
+ ImageMip dstMip;
+ imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip);
+ uint8_t* data = const_cast<uint8_t*>(dstMip.m_data);
+ imageEncodeFromRgba32f(&allocator, data, rgbaDst, dstMip.m_width, dstMip.m_height, format);
+ }
+
+ BX_FREE(&allocator, rgbaDst);
+ }
+ else
{
- ImageMip mip1;
- imageGetRawData(imageContainer, 0, lod, output->data, output->size, mip1);
- uint8_t* data = const_cast<uint8_t*>(mip1.m_data);
-
- uint32_t width = bx::uint32_max(1, mip.m_width >>lod);
- uint32_t height = bx::uint32_max(1, mip.m_height>>lod);
- imageRgba8Downsample2x2(width, height, width*4, rgba, rgba);
- imageEncodeFromRgba8(data, rgba, mip.m_width, mip.m_height, format);
+ uint32_t size = imageGetSize(TextureFormat::RGBA8, mip.m_width, mip.m_height);
+ temp = BX_ALLOC(&allocator, size);
+ uint8_t* rgba = (uint8_t*)temp;
+
+ imageDecodeToRgba8(rgba
+ , mip.m_data
+ , mip.m_width
+ , mip.m_height
+ , mip.m_width*mip.m_bpp/8
+ , mip.m_format
+ );
+
+ output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips);
+
+ imageEncodeFromRgba8(output->data, rgba, mip.m_width, mip.m_height, format);
+
+ for (uint8_t lod = 1; lod < numMips; ++lod)
+ {
+ imageRgba8Downsample2x2(mip.m_width, mip.m_height, mip.m_width*4, rgba, rgba);
+
+ ImageMip dstMip;
+ imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip);
+ uint8_t* data = const_cast<uint8_t*>(dstMip.m_data);
+ imageEncodeFromRgba8(data, rgba, dstMip.m_width, dstMip.m_height, format);
+ }
}
- BX_FREE(&allocator, rgba);
+ BX_FREE(&allocator, temp);
}
if (NULL != output)
{
bx::CrtFileWriter writer;
- if (0 == bx::open(&writer, outputFileName) )
+ if (bx::open(&writer, outputFileName) )
{
if (NULL != bx::stristr(outputFileName, ".ktx") )
{
@@ -319,8 +564,13 @@ int main(int _argc, const char* _argv[])
bx::close(&writer);
}
+ else
+ {
+ help("Failed to open output file.");
+ return EXIT_FAILURE;
+ }
- release(output);
+ imageFree(output);
}
}
diff --git a/3rdparty/bx/.appveyor.yml b/3rdparty/bx/.appveyor.yml
new file mode 100644
index 00000000000..286a3c9cc3b
--- /dev/null
+++ b/3rdparty/bx/.appveyor.yml
@@ -0,0 +1,21 @@
+shallow_clone: true
+
+os:
+ - Visual Studio 2015
+
+environment:
+ matrix:
+ - TOOLSET: vs2010
+ - TOOLSET: vs2012
+ - TOOLSET: vs2013
+ - TOOLSET: vs2015
+
+configuration:
+ - Debug
+ - Release
+
+install:
+ tools\bin\windows\genie %TOOLSET%
+
+build:
+ project: .build/projects/$(TOOLSET)/bx.sln
diff --git a/3rdparty/bx/.travis.yml b/3rdparty/bx/.travis.yml
new file mode 100644
index 00000000000..7b8e2d62283
--- /dev/null
+++ b/3rdparty/bx/.travis.yml
@@ -0,0 +1,20 @@
+language: cpp
+matrix:
+ include:
+ - compiler: gcc
+ os: linux
+ - compiler: clang
+ os: osx
+
+script:
+ make test
+
+branches:
+ only:
+ - master
+
+notifications:
+ email: false
+
+osx_image:
+ xcode61
diff --git a/3rdparty/bx/README.md b/3rdparty/bx/README.md
index c864c84fbab..88cb1bf55ac 100644
--- a/3rdparty/bx/README.md
+++ b/3rdparty/bx/README.md
@@ -3,6 +3,9 @@ bx
Base library.
+[![Build Status](https://travis-ci.org/bkaradzic/bx.svg?branch=master)](https://travis-ci.org/bkaradzic/bx)
+[![Build status](https://ci.appveyor.com/api/projects/status/edras3mltmoy31g5?svg=true)](https://ci.appveyor.com/project/bkaradzic/bx)
+
Contact
-------
diff --git a/3rdparty/bx/include/bx/bx.h b/3rdparty/bx/include/bx/bx.h
index 7ada4b2b970..80e9b765e10 100644
--- a/3rdparty/bx/include/bx/bx.h
+++ b/3rdparty/bx/include/bx/bx.h
@@ -8,6 +8,7 @@
#include <stdint.h> // uint32_t
#include <stdlib.h> // size_t
+#include <string.h> // memcpy
#include "config.h"
#include "macros.h"
@@ -52,6 +53,32 @@ namespace bx
return 0 == (un.addr & (_align-1) );
}
+ /// Scatter/gather memcpy.
+ inline void memCopy(void* _dst, const void* _src, uint32_t _size, uint32_t _num, uint32_t _srcPitch, uint32_t _dstPitch)
+ {
+ const uint8_t* src = (const uint8_t*)_src;
+ uint8_t* dst = (uint8_t*)_dst;
+
+ for (uint32_t ii = 0; ii < _num; ++ii)
+ {
+ memcpy(dst, src, _size);
+ src += _srcPitch;
+ dst += _dstPitch;
+ }
+ }
+
+ ///
+ inline void gather(void* _dst, const void* _src, uint32_t _size, uint32_t _num, uint32_t _srcPitch)
+ {
+ memCopy(_dst, _src, _size, _num, _srcPitch, _size);
+ }
+
+ ///
+ inline void scatter(void* _dst, const void* _src, uint32_t _size, uint32_t _num, uint32_t _dstPitch)
+ {
+ memCopy(_dst, _src, _size, _num, _size, _dstPitch);
+ }
+
} // namespace bx
// Annoying C++0x stuff..
diff --git a/3rdparty/bx/include/bx/config.h b/3rdparty/bx/include/bx/config.h
index 3837193e19a..6b8cfe45a7f 100644
--- a/3rdparty/bx/include/bx/config.h
+++ b/3rdparty/bx/include/bx/config.h
@@ -30,6 +30,7 @@
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_QNX \
|| BX_PLATFORM_RPI \
+ || BX_PLATFORM_STEAMLINK \
|| BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_WINRT \
? 1 : 0)
diff --git a/3rdparty/bx/include/bx/error.h b/3rdparty/bx/include/bx/error.h
new file mode 100644
index 00000000000..d98a111f5af
--- /dev/null
+++ b/3rdparty/bx/include/bx/error.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2010-2016 Branimir Karadzic. All rights reserved.
+ * License: https://github.com/bkaradzic/bx#license-bsd-2-clause
+ */
+
+#ifndef BX_ERROR_H_HEADER_GUARD
+#define BX_ERROR_H_HEADER_GUARD
+
+#include "bx.h"
+
+#define BX_ERROR_SET(_ptr, _result, _msg) \
+ BX_MACRO_BLOCK_BEGIN \
+ BX_TRACE("Error %d: %s", _result.code, "" _msg); \
+ _ptr->setError(_result, "" _msg); \
+ BX_MACRO_BLOCK_END
+
+#define BX_ERROR_USE_TEMP_WHEN_NULL(_ptr) \
+ const bx::Error tmpError; /* It should not be used directly! */ \
+ _ptr = NULL == _ptr ? const_cast<bx::Error*>(&tmpError) : _ptr
+
+#define BX_ERROR_SCOPE(_ptr) \
+ BX_ERROR_USE_TEMP_WHEN_NULL(_ptr); \
+ bx::ErrorScope bxErrorScope(const_cast<bx::Error*>(&tmpError) )
+
+#define BX_ERROR_RESULT(_err, _code) \
+ BX_STATIC_ASSERT(_code != 0, "ErrorCode 0 is reserved!"); \
+ static const bx::ErrorResult _err = { _code }
+
+namespace bx
+{
+ ///
+ struct ErrorResult
+ {
+ uint32_t code;
+ };
+
+ ///
+ class Error
+ {
+ BX_CLASS(Error
+ , NO_COPY
+ , NO_ASSIGNMENT
+ );
+
+ public:
+ Error()
+ : m_code(0)
+ {
+ }
+
+ void setError(ErrorResult _errorResult, const char* _msg)
+ {
+ BX_CHECK(0 != _errorResult.code, "Invalid ErrorResult passed to setError!");
+
+ if (!isOk() )
+ {
+ return;
+ }
+
+ m_code = _errorResult.code;
+ m_msg = _msg;
+ }
+
+ bool isOk() const
+ {
+ return 0 == m_code;
+ }
+
+ ErrorResult get() const
+ {
+ ErrorResult result = { m_code };
+ return result;
+ }
+
+ bool operator==(ErrorResult _rhs) const
+ {
+ return _rhs.code == m_code;
+ }
+
+ private:
+ const char* m_msg;
+ uint32_t m_code;
+ };
+
+ ///
+ class ErrorScope
+ {
+ BX_CLASS(ErrorScope
+ , NO_COPY
+ , NO_ASSIGNMENT
+ );
+
+ public:
+ ErrorScope(Error* _err)
+ : m_err(_err)
+ {
+ BX_CHECK(NULL != _err, "_err can't be NULL");
+ }
+
+ ~ErrorScope()
+ {
+ BX_CHECK(m_err->isOk(), "Error: %d", m_err->get().code);
+ }
+
+ private:
+ Error* m_err;
+ };
+
+} // namespace bx
+
+#endif // BX_ERROR_H_HEADER_GUARD
diff --git a/3rdparty/bx/include/bx/fpumath.h b/3rdparty/bx/include/bx/fpumath.h
index 0763f5bcb5f..be125aa69eb 100644
--- a/3rdparty/bx/include/bx/fpumath.h
+++ b/3rdparty/bx/include/bx/fpumath.h
@@ -29,9 +29,19 @@ namespace bx
return _rad * 180.0f / pi;
}
+ inline float ffloor(float _f)
+ {
+ return floorf(_f);
+ }
+
+ inline float fceil(float _f)
+ {
+ return ceilf(_f);
+ }
+
inline float fround(float _f)
{
- return floorf(_f + 0.5f);
+ return ffloor(_f + 0.5f);
}
inline float fmin(float _a, float _b)
@@ -139,6 +149,11 @@ namespace bx
return _a - floorf(_a);
}
+ inline float fmod(float _a, float _b)
+ {
+ return fmodf(_a, _b);
+ }
+
inline bool fequal(float _a, float _b, float _epsilon)
{
// http://realtimecollisiondetection.net/blog/?p=89
@@ -159,7 +174,7 @@ namespace bx
inline float fwrap(float _a, float _wrap)
{
- const float mod = fmodf(_a, _wrap);
+ const float mod = fmod(_a, _wrap);
const float result = mod < 0.0f ? _wrap + mod : mod;
return result;
}
@@ -412,8 +427,8 @@ namespace bx
inline void quatRotateAxis(float* __restrict _result, const float* _axis, float _angle)
{
const float ha = _angle * 0.5f;
- const float ca = cosf(ha);
- const float sa = sinf(ha);
+ const float ca = fcos(ha);
+ const float sa = fsin(ha);
_result[0] = _axis[0] * sa;
_result[1] = _axis[1] * sa;
_result[2] = _axis[2] * sa;
@@ -423,8 +438,8 @@ namespace bx
inline void quatRotateX(float* _result, float _ax)
{
const float hx = _ax * 0.5f;
- const float cx = cosf(hx);
- const float sx = sinf(hx);
+ const float cx = fcos(hx);
+ const float sx = fsin(hx);
_result[0] = sx;
_result[1] = 0.0f;
_result[2] = 0.0f;
@@ -434,8 +449,8 @@ namespace bx
inline void quatRotateY(float* _result, float _ay)
{
const float hy = _ay * 0.5f;
- const float cy = cosf(hy);
- const float sy = sinf(hy);
+ const float cy = fcos(hy);
+ const float sy = fsin(hy);
_result[0] = 0.0f;
_result[1] = sy;
_result[2] = 0.0f;
@@ -445,8 +460,8 @@ namespace bx
inline void quatRotateZ(float* _result, float _az)
{
const float hz = _az * 0.5f;
- const float cz = cosf(hz);
- const float sz = sinf(hz);
+ const float cz = fcos(hz);
+ const float sz = fsin(hz);
_result[0] = 0.0f;
_result[1] = 0.0f;
_result[2] = sz;
@@ -705,14 +720,14 @@ namespace bx
mtxProjRh(_result, _fovy, _aspect, _near, _far, _oglNdc);
}
- inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f)
+ inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false)
{
const float aa = 2.0f/(_right - _left);
const float bb = 2.0f/(_top - _bottom);
- const float cc = 1.0f/(_far - _near);
+ const float cc = (_oglNdc ? 2.0f : 1.0f) / (_far - _near);
const float dd = (_left + _right)/(_left - _right);
const float ee = (_top + _bottom)/(_bottom - _top);
- const float ff = _near / (_near - _far);
+ const float ff = _oglNdc ? (_near + _far)/(_near - _far) : _near/(_near - _far);
memset(_result, 0, sizeof(float)*16);
_result[ 0] = aa;
@@ -726,8 +741,8 @@ namespace bx
inline void mtxRotateX(float* _result, float _ax)
{
- const float sx = sinf(_ax);
- const float cx = cosf(_ax);
+ const float sx = fsin(_ax);
+ const float cx = fcos(_ax);
memset(_result, 0, sizeof(float)*16);
_result[ 0] = 1.0f;
@@ -740,8 +755,8 @@ namespace bx
inline void mtxRotateY(float* _result, float _ay)
{
- const float sy = sinf(_ay);
- const float cy = cosf(_ay);
+ const float sy = fsin(_ay);
+ const float cy = fcos(_ay);
memset(_result, 0, sizeof(float)*16);
_result[ 0] = cy;
@@ -754,8 +769,8 @@ namespace bx
inline void mtxRotateZ(float* _result, float _az)
{
- const float sz = sinf(_az);
- const float cz = cosf(_az);
+ const float sz = fsin(_az);
+ const float cz = fcos(_az);
memset(_result, 0, sizeof(float)*16);
_result[ 0] = cz;
@@ -768,10 +783,10 @@ namespace bx
inline void mtxRotateXY(float* _result, float _ax, float _ay)
{
- const float sx = sinf(_ax);
- const float cx = cosf(_ax);
- const float sy = sinf(_ay);
- const float cy = cosf(_ay);
+ const float sx = fsin(_ax);
+ const float cx = fcos(_ax);
+ const float sy = fsin(_ay);
+ const float cy = fcos(_ay);
memset(_result, 0, sizeof(float)*16);
_result[ 0] = cy;
@@ -787,12 +802,12 @@ namespace bx
inline void mtxRotateXYZ(float* _result, float _ax, float _ay, float _az)
{
- const float sx = sinf(_ax);
- const float cx = cosf(_ax);
- const float sy = sinf(_ay);
- const float cy = cosf(_ay);
- const float sz = sinf(_az);
- const float cz = cosf(_az);
+ const float sx = fsin(_ax);
+ const float cx = fcos(_ax);
+ const float sy = fsin(_ay);
+ const float cy = fcos(_ay);
+ const float sz = fsin(_az);
+ const float cz = fcos(_az);
memset(_result, 0, sizeof(float)*16);
_result[ 0] = cy*cz;
@@ -809,12 +824,12 @@ namespace bx
inline void mtxRotateZYX(float* _result, float _ax, float _ay, float _az)
{
- const float sx = sinf(_ax);
- const float cx = cosf(_ax);
- const float sy = sinf(_ay);
- const float cy = cosf(_ay);
- const float sz = sinf(_az);
- const float cz = cosf(_az);
+ const float sx = fsin(_ax);
+ const float cx = fcos(_ax);
+ const float sy = fsin(_ay);
+ const float cy = fcos(_ay);
+ const float sz = fsin(_az);
+ const float cz = fcos(_az);
memset(_result, 0, sizeof(float)*16);
_result[ 0] = cy*cz;
@@ -831,12 +846,12 @@ namespace bx
inline void mtxSRT(float* _result, float _sx, float _sy, float _sz, float _ax, float _ay, float _az, float _tx, float _ty, float _tz)
{
- const float sx = sinf(_ax);
- const float cx = cosf(_ax);
- const float sy = sinf(_ay);
- const float cy = cosf(_ay);
- const float sz = sinf(_az);
- const float cz = cosf(_az);
+ const float sx = fsin(_ax);
+ const float cx = fcos(_ax);
+ const float sy = fsin(_ay);
+ const float cy = fcos(_ay);
+ const float sz = fsin(_az);
+ const float cz = fcos(_az);
const float sxsz = sx*sz;
const float cycz = cy*cz;
diff --git a/3rdparty/bx/include/bx/handlealloc.h b/3rdparty/bx/include/bx/handlealloc.h
index d947256a9e2..7b10209ab2d 100644
--- a/3rdparty/bx/include/bx/handlealloc.h
+++ b/3rdparty/bx/include/bx/handlealloc.h
@@ -253,7 +253,7 @@ namespace bx
}
private:
- void insertBefore(int16_t _before, uint16_t _handle)
+ void insertBefore(uint16_t _before, uint16_t _handle)
{
Link& curr = m_links[_handle];
curr.m_next = _before;
diff --git a/3rdparty/bx/include/bx/hash.h b/3rdparty/bx/include/bx/hash.h
index de3f21c4c0e..4250115622f 100644
--- a/3rdparty/bx/include/bx/hash.h
+++ b/3rdparty/bx/include/bx/hash.h
@@ -103,7 +103,7 @@ namespace bx
static void readUnaligned(const void* _data, uint32_t& _out)
{
const uint8_t* data = (const uint8_t*)_data;
- if (BX_ENABLED(BX_CPU_ENDIAN_LITTLE) )
+ if (BX_ENABLED(BX_CPU_ENDIAN_BIG) )
{
_out = 0
| data[0]<<24
diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h
index 50fca7f0fbe..074ec0e513c 100644
--- a/3rdparty/bx/include/bx/os.h
+++ b/3rdparty/bx/include/bx/os.h
@@ -20,16 +20,17 @@
|| BX_PLATFORM_NACL \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
- || BX_PLATFORM_RPI
-
+ || BX_PLATFORM_RPI \
+ || BX_PLATFORM_STEAMLINK
# include <sched.h> // sched_yield
# if BX_PLATFORM_BSD \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_NACL \
|| BX_PLATFORM_OSX \
- || BX_PLATFORM_PS4
+ || BX_PLATFORM_PS4 \
+ || BX_PLATFORM_STEAMLINK
# include <pthread.h> // mach_port_t
-# endif // BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_NACL
+# endif // BX_PLATFORM_*
# if BX_PLATFORM_NACL
# include <sys/nacl_syscalls.h> // nanosleep
@@ -42,7 +43,9 @@
# if BX_PLATFORM_ANDROID
# include <malloc.h> // mallinfo
-# elif BX_PLATFORM_LINUX || BX_PLATFORM_RPI
+# elif BX_PLATFORM_LINUX \
+ || BX_PLATFORM_RPI \
+ || BX_PLATFORM_STEAMLINK
# include <unistd.h> // syscall
# include <sys/syscall.h>
# elif BX_PLATFORM_OSX
@@ -99,7 +102,7 @@ namespace bx
{
#if BX_PLATFORM_WINDOWS
return ::GetCurrentThreadId();
-#elif BX_PLATFORM_LINUX || BX_PLATFORM_RPI
+#elif BX_PLATFORM_LINUX || BX_PLATFORM_RPI || BX_PLATFORM_STEAMLINK
return (pid_t)::syscall(SYS_gettid);
#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
return (mach_port_t)::pthread_mach_thread_np(pthread_self() );
diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h
index c41ae0d11be..3f245d5dff9 100644
--- a/3rdparty/bx/include/bx/platform.h
+++ b/3rdparty/bx/include/bx/platform.h
@@ -22,6 +22,7 @@
#define BX_PLATFORM_PS4 0
#define BX_PLATFORM_QNX 0
#define BX_PLATFORM_RPI 0
+#define BX_PLATFORM_STEAMLINK 0
#define BX_PLATFORM_WINDOWS 0
#define BX_PLATFORM_WINRT 0
#define BX_PLATFORM_XBOX360 0
@@ -152,20 +153,24 @@
# undef BX_PLATFORM_WINRT
# define BX_PLATFORM_WINRT 1
# endif
-#elif defined(__VCCOREVER__)
-// RaspberryPi compiler defines __linux__
-# undef BX_PLATFORM_RPI
-# define BX_PLATFORM_RPI 1
-#elif defined(__native_client__)
-// NaCl compiler defines __linux__
-# include <ppapi/c/pp_macros.h>
-# undef BX_PLATFORM_NACL
-# define BX_PLATFORM_NACL PPAPI_RELEASE
#elif defined(__ANDROID__)
// Android compiler defines __linux__
# include <android/api-level.h>
# undef BX_PLATFORM_ANDROID
# define BX_PLATFORM_ANDROID __ANDROID_API__
+#elif defined(__native_client__)
+// NaCl compiler defines __linux__
+# include <ppapi/c/pp_macros.h>
+# undef BX_PLATFORM_NACL
+# define BX_PLATFORM_NACL PPAPI_RELEASE
+#elif defined(__STEAMLINK__)
+// SteamLink compiler defines __linux__
+# undef BX_PLATFORM_STEAMLINK
+# define BX_PLATFORM_STEAMLINK 1
+#elif defined(__VCCOREVER__)
+// RaspberryPi compiler defines __linux__
+# undef BX_PLATFORM_RPI
+# define BX_PLATFORM_RPI 1
#elif defined(__linux__)
# undef BX_PLATFORM_LINUX
# define BX_PLATFORM_LINUX 1
@@ -204,6 +209,7 @@
|| BX_PLATFORM_NACL \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_QNX \
+ || BX_PLATFORM_STEAMLINK \
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_RPI \
)
@@ -223,15 +229,15 @@
BX_STRINGIZE(__clang_minor__) "." \
BX_STRINGIZE(__clang_patchlevel__)
#elif BX_COMPILER_MSVC
-# if BX_COMPILER_MSVC >= 1900
+# if BX_COMPILER_MSVC >= 1900 // Visual Studio 2015
# define BX_COMPILER_NAME "MSVC 14.0"
-# elif BX_COMPILER_MSVC >= 1800
+# elif BX_COMPILER_MSVC >= 1800 // Visual Studio 2013
# define BX_COMPILER_NAME "MSVC 12.0"
-# elif BX_COMPILER_MSVC >= 1700
+# elif BX_COMPILER_MSVC >= 1700 // Visual Studio 2012
# define BX_COMPILER_NAME "MSVC 11.0"
-# elif BX_COMPILER_MSVC >= 1600
+# elif BX_COMPILER_MSVC >= 1600 // Visual Studio 2010
# define BX_COMPILER_NAME "MSVC 10.0"
-# elif BX_COMPILER_MSVC >= 1500
+# elif BX_COMPILER_MSVC >= 1500 // Visual Studio 2008
# define BX_COMPILER_NAME "MSVC 9.0"
# else
# define BX_COMPILER_NAME "MSVC"
@@ -263,6 +269,8 @@
# define BX_PLATFORM_NAME "QNX"
#elif BX_PLATFORM_RPI
# define BX_PLATFORM_NAME "RaspberryPi"
+#elif BX_PLATFORM_STEAMLINK
+# define BX_PLATFORM_NAME "SteamLink"
#elif BX_PLATFORM_WINDOWS
# define BX_PLATFORM_NAME "Windows"
#elif BX_PLATFORM_WINRT
diff --git a/3rdparty/bx/include/bx/readerwriter.h b/3rdparty/bx/include/bx/readerwriter.h
index c673eed388a..ef8c810a870 100644
--- a/3rdparty/bx/include/bx/readerwriter.h
+++ b/3rdparty/bx/include/bx/readerwriter.h
@@ -12,6 +12,7 @@
#include "bx.h"
#include "allocator.h"
+#include "error.h"
#include "uint32_t.h"
#if BX_COMPILER_MSVC_COMPATIBLE
@@ -22,6 +23,10 @@
# define ftello64 ftello
#endif // BX_
+BX_ERROR_RESULT(BX_ERROR_READERWRITER_OPEN, BX_MAKEFOURCC('R', 'W', 0, 1) );
+BX_ERROR_RESULT(BX_ERROR_READERWRITER_READ, BX_MAKEFOURCC('R', 'W', 0, 2) );
+BX_ERROR_RESULT(BX_ERROR_READERWRITER_WRITE, BX_MAKEFOURCC('R', 'W', 0, 3) );
+
namespace bx
{
struct Whence
@@ -37,7 +42,7 @@ namespace bx
struct BX_NO_VTABLE ReaderI
{
virtual ~ReaderI() = 0;
- virtual int32_t read(void* _data, int32_t _size) = 0;
+ virtual int32_t read(void* _data, int32_t _size, Error* _err) = 0;
};
inline ReaderI::~ReaderI()
@@ -47,7 +52,7 @@ namespace bx
struct BX_NO_VTABLE WriterI
{
virtual ~WriterI() = 0;
- virtual int32_t write(const void* _data, int32_t _size) = 0;
+ virtual int32_t write(const void* _data, int32_t _size, Error* _err) = 0;
};
inline WriterI::~WriterI()
@@ -65,40 +70,46 @@ namespace bx
}
/// Read data.
- inline int32_t read(ReaderI* _reader, void* _data, int32_t _size)
+ inline int32_t read(ReaderI* _reader, void* _data, int32_t _size, Error* _err = NULL)
{
- return _reader->read(_data, _size);
+ BX_ERROR_SCOPE(_err);
+ return _reader->read(_data, _size, _err);
}
/// Write value.
template<typename Ty>
- inline int32_t read(ReaderI* _reader, Ty& _value)
+ inline int32_t read(ReaderI* _reader, Ty& _value, Error* _err = NULL)
{
+ BX_ERROR_SCOPE(_err);
BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
- return _reader->read(&_value, sizeof(Ty) );
+ return _reader->read(&_value, sizeof(Ty), _err);
}
/// Read value and converts it to host endianess. _fromLittleEndian specifies
/// underlying stream endianess.
template<typename Ty>
- inline int32_t readHE(ReaderI* _reader, Ty& _value, bool _fromLittleEndian)
+ inline int32_t readHE(ReaderI* _reader, Ty& _value, bool _fromLittleEndian, Error* _err = NULL)
{
+ BX_ERROR_SCOPE(_err);
BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
Ty value;
- int32_t result = _reader->read(&value, sizeof(Ty) );
+ int32_t result = _reader->read(&value, sizeof(Ty), _err);
_value = toHostEndian(value, _fromLittleEndian);
return result;
}
/// Write data.
- inline int32_t write(WriterI* _writer, const void* _data, int32_t _size)
+ inline int32_t write(WriterI* _writer, const void* _data, int32_t _size, Error* _err = NULL)
{
- return _writer->write(_data, _size);
+ BX_ERROR_SCOPE(_err);
+ return _writer->write(_data, _size, _err);
}
/// Write repeat the same value.
- inline int32_t writeRep(WriterI* _writer, uint8_t _byte, int32_t _size)
+ inline int32_t writeRep(WriterI* _writer, uint8_t _byte, int32_t _size, Error* _err = NULL)
{
+ BX_ERROR_SCOPE(_err);
+
const uint32_t tmp0 = uint32_sels(64 - _size, 64, _size);
const uint32_t tmp1 = uint32_sels(256 - _size, 256, tmp0);
const uint32_t blockSize = uint32_sels(1024 - _size, 1024, tmp1);
@@ -108,7 +119,7 @@ namespace bx
int32_t size = 0;
while (0 < _size)
{
- int32_t bytes = write(_writer, temp, uint32_min(blockSize, _size) );
+ int32_t bytes = write(_writer, temp, uint32_min(blockSize, _size), _err);
size += bytes;
_size -= bytes;
}
@@ -118,29 +129,32 @@ namespace bx
/// Write value.
template<typename Ty>
- inline int32_t write(WriterI* _writer, const Ty& _value)
+ inline int32_t write(WriterI* _writer, const Ty& _value, Error* _err = NULL)
{
+ BX_ERROR_SCOPE(_err);
BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
- return _writer->write(&_value, sizeof(Ty) );
+ return _writer->write(&_value, sizeof(Ty), _err);
}
/// Write value as little endian.
template<typename Ty>
- inline int32_t writeLE(WriterI* _writer, const Ty& _value)
+ inline int32_t writeLE(WriterI* _writer, const Ty& _value, Error* _err = NULL)
{
+ BX_ERROR_SCOPE(_err);
BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
Ty value = toLittleEndian(_value);
- int32_t result = _writer->write(&value, sizeof(Ty) );
+ int32_t result = _writer->write(&value, sizeof(Ty), _err);
return result;
}
/// Write value as big endian.
template<typename Ty>
- inline int32_t writeBE(WriterI* _writer, const Ty& _value)
+ inline int32_t writeBE(WriterI* _writer, const Ty& _value, Error* _err = NULL)
{
+ BX_ERROR_SCOPE(_err);
BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
Ty value = toBigEndian(_value);
- int32_t result = _writer->write(&value, sizeof(Ty) );
+ int32_t result = _writer->write(&value, sizeof(Ty), _err);
return result;
}
@@ -198,34 +212,36 @@ namespace bx
struct BX_NO_VTABLE FileReaderI : public ReaderSeekerI
{
- virtual int32_t open(const char* _filePath) = 0;
- virtual int32_t close() = 0;
+ virtual bool open(const char* _filePath, Error* _err) = 0;
+ virtual void close() = 0;
};
struct BX_NO_VTABLE FileWriterI : public WriterSeekerI
{
- virtual int32_t open(const char* _filePath, bool _append = false) = 0;
- virtual int32_t close() = 0;
+ virtual bool open(const char* _filePath, bool _append, Error* _err) = 0;
+ virtual void close() = 0;
};
- inline int32_t open(FileReaderI* _reader, const char* _filePath)
+ inline bool open(FileReaderI* _reader, const char* _filePath, Error* _err = NULL)
{
- return _reader->open(_filePath);
+ BX_ERROR_USE_TEMP_WHEN_NULL(_err);
+ return _reader->open(_filePath, _err);
}
- inline int32_t close(FileReaderI* _reader)
+ inline void close(FileReaderI* _reader)
{
- return _reader->close();
+ _reader->close();
}
- inline int32_t open(FileWriterI* _writer, const char* _filePath, bool _append = false)
+ inline bool open(FileWriterI* _writer, const char* _filePath, bool _append = false, Error* _err = NULL)
{
- return _writer->open(_filePath, _append);
+ BX_ERROR_USE_TEMP_WHEN_NULL(_err);
+ return _writer->open(_filePath, _append, _err);
}
- inline int32_t close(FileWriterI* _writer)
+ inline void close(FileWriterI* _writer)
{
- return _writer->close();
+ _writer->close();
}
struct BX_NO_VTABLE MemoryBlockI
@@ -332,8 +348,10 @@ namespace bx
return m_pos;
}
- virtual int32_t write(const void* /*_data*/, int32_t _size) BX_OVERRIDE
+ virtual int32_t write(const void* /*_data*/, int32_t _size, Error* _err) BX_OVERRIDE
{
+ BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
+
int32_t morecore = int32_t(m_pos - m_top) + _size;
if (0 < morecore)
@@ -344,6 +362,10 @@ namespace bx
int64_t reminder = m_top-m_pos;
int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) );
m_pos += size;
+ if (size != _size)
+ {
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "SizerWriter: write truncated.");
+ }
return size;
}
@@ -386,12 +408,18 @@ namespace bx
return m_pos;
}
- virtual int32_t read(void* _data, int32_t _size) BX_OVERRIDE
+ virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE
{
+ BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
+
int64_t reminder = m_top-m_pos;
int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) );
memcpy(_data, &m_data[m_pos], size);
m_pos += size;
+ if (size != _size)
+ {
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "MemoryReader: read truncated.");
+ }
return size;
}
@@ -452,8 +480,10 @@ namespace bx
return m_pos;
}
- virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE
+ virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE
{
+ BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
+
int32_t morecore = int32_t(m_pos - m_size) + _size;
if (0 < morecore)
@@ -468,6 +498,10 @@ namespace bx
memcpy(&m_data[m_pos], _data, size);
m_pos += size;
m_top = int64_max(m_top, m_pos);
+ if (size != _size)
+ {
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "MemoryWriter: write truncated.");
+ }
return size;
}
@@ -509,16 +543,23 @@ namespace bx
{
}
- virtual int32_t open(const char* _filePath) BX_OVERRIDE
+ virtual bool open(const char* _filePath, Error* _err) BX_OVERRIDE
{
+ BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
+
m_file = fopen(_filePath, "rb");
- return NULL == m_file;
+ if (NULL == m_file)
+ {
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileReader: Failed to open file.");
+ return false;
+ }
+
+ return true;
}
- virtual int32_t close() BX_OVERRIDE
+ virtual void close() BX_OVERRIDE
{
fclose(m_file);
- return 0;
}
virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE
@@ -527,9 +568,18 @@ namespace bx
return ftello64(m_file);
}
- virtual int32_t read(void* _data, int32_t _size) BX_OVERRIDE
+ virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE
{
- return (int32_t)fread(_data, 1, _size, m_file);
+ BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
+
+ int32_t size = (int32_t)fread(_data, 1, _size, m_file);
+ if (size != _size)
+ {
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileReader: read failed.");
+ return size >= 0 ? size : 0;
+ }
+
+ return size;
}
private:
@@ -548,24 +598,22 @@ namespace bx
{
}
- virtual int32_t open(const char* _filePath, bool _append = false) BX_OVERRIDE
+ virtual bool open(const char* _filePath, bool _append, Error* _err) BX_OVERRIDE
{
- if (_append)
- {
- m_file = fopen(_filePath, "ab");
- }
- else
+ m_file = fopen(_filePath, _append ? "ab" : "wb");
+
+ if (NULL == m_file)
{
- m_file = fopen(_filePath, "wb");
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileWriter: Failed to open file.");
+ return false;
}
- return NULL == m_file;
+ return true;
}
- virtual int32_t close() BX_OVERRIDE
+ virtual void close() BX_OVERRIDE
{
fclose(m_file);
- return 0;
}
virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE
@@ -574,9 +622,18 @@ namespace bx
return ftello64(m_file);
}
- virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE
+ virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE
{
- return (int32_t)fwrite(_data, 1, _size, m_file);
+ BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
+
+ int32_t size = (int32_t)fwrite(_data, 1, _size, m_file);
+ if (size != _size)
+ {
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "CrtFileWriter: write failed.");
+ return size >= 0 ? size : 0;
+ }
+
+ return size;
}
private:
diff --git a/3rdparty/bx/include/bx/thread.h b/3rdparty/bx/include/bx/thread.h
index fb9e07df6f8..015bd57eff8 100644
--- a/3rdparty/bx/include/bx/thread.h
+++ b/3rdparty/bx/include/bx/thread.h
@@ -8,6 +8,9 @@
#if BX_PLATFORM_POSIX
# include <pthread.h>
+# if defined(__GLIBC__) && !( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12) ) )
+# include <sys/prctl.h>
+# endif // defined(__GLIBC__) ...
#elif BX_PLATFORM_WINRT
using namespace Platform;
using namespace Windows::Foundation;
@@ -149,7 +152,13 @@ namespace bx
{
#if BX_PLATFORM_OSX || BX_PLATFORM_IOS
pthread_setname_np(_name);
-#elif (BX_PLATFORM_LINUX && defined(__GLIBC__)) || BX_PLATFORM_BSD
+#elif BX_PLATFORM_LINUX
+# if defined(__GLIBC__) && (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12) )
+ pthread_setname_np(m_handle, _name);
+# else
+ prctl(PR_SET_NAME,_name, 0, 0, 0);
+# endif // defined(__GLIBC__) ...
+#elif BX_PLATFORM_BSD
pthread_setname_np(m_handle, _name);
#elif BX_PLATFORM_WINDOWS && BX_COMPILER_MSVC
# pragma pack(push, 8)
diff --git a/3rdparty/bx/makefile b/3rdparty/bx/makefile
index 5f3455bdbff..685479b05d8 100644
--- a/3rdparty/bx/makefile
+++ b/3rdparty/bx/makefile
@@ -220,3 +220,8 @@ tools/bin/$(OS)/bin2c$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/bin2cRelease$(EXE)
$(SILENT) cp $(<) $(@)
tools: tools/bin/$(OS)/bin2c$(EXE)
+
+.build/$(BUILD_OUTPUT_DIR)/bin/bx.testRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
+ $(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) bx.test config=$(BUILD_TOOLS_CONFIG)
+
+test: .build/$(BUILD_OUTPUT_DIR)/bin/bx.testRelease$(EXE)
diff --git a/3rdparty/bx/scripts/genie.lua b/3rdparty/bx/scripts/genie.lua
index 2399a70ce3d..580e3d66157 100644
--- a/3rdparty/bx/scripts/genie.lua
+++ b/3rdparty/bx/scripts/genie.lua
@@ -58,17 +58,18 @@ project "bx.test"
path.join(BX_DIR, "tests/**.H"),
}
- configuration { "vs*" }
+ configuration { "vs* or mingw*" }
+ links {
+ "psapi",
+ }
configuration { "android*" }
- kind "ConsoleApp"
targetextension ".so"
linkoptions {
"-shared",
}
configuration { "nacl or nacl-arm" }
- kind "ConsoleApp"
targetextension ".nexe"
links {
"ppapi",
@@ -76,7 +77,6 @@ project "bx.test"
}
configuration { "pnacl" }
- kind "ConsoleApp"
targetextension ".pexe"
links {
"ppapi",
diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua
index 4b616c24c2a..fc674de9570 100644
--- a/3rdparty/bx/scripts/toolchain.lua
+++ b/3rdparty/bx/scripts/toolchain.lua
@@ -13,29 +13,30 @@ function toolchain(_buildDir, _libDir)
value = "GCC",
description = "Choose GCC flavor",
allowed = {
- { "android-arm", "Android - ARM" },
- { "android-mips", "Android - MIPS" },
- { "android-x86", "Android - x86" },
- { "asmjs", "Emscripten/asm.js" },
- { "freebsd", "FreeBSD" },
- { "linux-gcc", "Linux (GCC compiler)" },
- { "linux-gcc-5", "Linux (GCC-5 compiler)" },
- { "linux-clang", "Linux (Clang compiler)" },
- { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" },
- { "linux-arm-gcc", "Linux (ARM, GCC compiler)" },
- { "ios-arm", "iOS - ARM" },
- { "ios-simulator", "iOS - Simulator" },
- { "tvos-arm64", "tvOS - ARM64" },
- { "tvos-simulator", "tvOS - Simulator" },
- { "mingw-gcc", "MinGW" },
- { "mingw-clang", "MinGW (clang compiler)" },
- { "nacl", "Native Client" },
- { "nacl-arm", "Native Client - ARM" },
- { "osx", "OSX" },
- { "pnacl", "Native Client - PNaCl" },
- { "ps4", "PS4" },
- { "qnx-arm", "QNX/Blackberry - ARM" },
- { "rpi", "RaspberryPi" },
+ { "android-arm", "Android - ARM" },
+ { "android-mips", "Android - MIPS" },
+ { "android-x86", "Android - x86" },
+ { "asmjs", "Emscripten/asm.js" },
+ { "freebsd", "FreeBSD" },
+ { "linux-gcc", "Linux (GCC compiler)" },
+ { "linux-gcc-5", "Linux (GCC-5 compiler)" },
+ { "linux-clang", "Linux (Clang compiler)" },
+ { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" },
+ { "linux-arm-gcc", "Linux (ARM, GCC compiler)" },
+ { "linux-steamlink", "Steam Link" },
+ { "ios-arm", "iOS - ARM" },
+ { "ios-simulator", "iOS - Simulator" },
+ { "tvos-arm64", "tvOS - ARM64" },
+ { "tvos-simulator", "tvOS - Simulator" },
+ { "mingw-gcc", "MinGW" },
+ { "mingw-clang", "MinGW (clang compiler)" },
+ { "nacl", "Native Client" },
+ { "nacl-arm", "Native Client - ARM" },
+ { "osx", "OSX" },
+ { "pnacl", "Native Client - PNaCl" },
+ { "ps4", "PS4" },
+ { "qnx-arm", "QNX/Blackberry - ARM" },
+ { "rpi", "RaspberryPi" },
},
}
@@ -86,6 +87,11 @@ function toolchain(_buildDir, _libDir)
description = "Set tvOS target version (default: 9.0).",
}
+ newoption {
+ trigger = "with-dynamic-runtime",
+ description = "Dynamically link with the runtime rather than statically",
+ }
+
-- Avoid error when invoking genie --help.
if (_ACTION == nil) then return false end
@@ -157,7 +163,7 @@ function toolchain(_buildDir, _libDir)
elseif "asmjs" == _OPTIONS["gcc"] then
if not os.getenv("EMSCRIPTEN") then
- print("Set EMSCRIPTEN enviroment variables.")
+ print("Set EMSCRIPTEN enviroment variable.")
end
premake.gcc.cc = "$(EMSCRIPTEN)/emcc"
@@ -214,6 +220,16 @@ function toolchain(_buildDir, _libDir)
elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
+ elseif "linux-steamlink" == _OPTIONS["gcc"] then
+ if not os.getenv("MARVELL_SDK_PATH") then
+ print("Set MARVELL_SDK_PATH enviroment variable.")
+ end
+
+ premake.gcc.cc = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-gcc"
+ premake.gcc.cxx = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-g++"
+ premake.gcc.ar = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-ar"
+ location (path.join(_buildDir, "projects", _ACTION .. "-linux-steamlink"))
+
elseif "mingw-gcc" == _OPTIONS["gcc"] then
premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
@@ -231,7 +247,7 @@ function toolchain(_buildDir, _libDir)
elseif "nacl" == _OPTIONS["gcc"] then
if not os.getenv("NACL_SDK_ROOT") then
- print("Set NACL_SDK_ROOT enviroment variables.")
+ print("Set NACL_SDK_ROOT enviroment variable.")
end
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/x86_64-nacl-"
@@ -249,7 +265,7 @@ function toolchain(_buildDir, _libDir)
elseif "nacl-arm" == _OPTIONS["gcc"] then
if not os.getenv("NACL_SDK_ROOT") then
- print("Set NACL_SDK_ROOT enviroment variables.")
+ print("Set NACL_SDK_ROOT enviroment variable.")
end
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_newlib/bin/arm-nacl-"
@@ -277,7 +293,7 @@ function toolchain(_buildDir, _libDir)
elseif "pnacl" == _OPTIONS["gcc"] then
if not os.getenv("NACL_SDK_ROOT") then
- print("Set NACL_SDK_ROOT enviroment variables.")
+ print("Set NACL_SDK_ROOT enviroment variable.")
end
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_pnacl/bin/pnacl-"
@@ -295,7 +311,7 @@ function toolchain(_buildDir, _libDir)
elseif "ps4" == _OPTIONS["gcc"] then
if not os.getenv("PS4_SDK_ROOT") then
- print("Set PS4_SDK_ROOT enviroment variables.")
+ print("Set PS4_SDK_ROOT enviroment variable.")
end
ps4Toolchain = "$(PS4_SDK_ROOT)/host_tools/bin/orbis-"
@@ -308,7 +324,7 @@ function toolchain(_buildDir, _libDir)
elseif "qnx-arm" == _OPTIONS["gcc"] then
if not os.getenv("QNX_HOST") then
- print("Set QNX_HOST enviroment variables.")
+ print("Set QNX_HOST enviroment variable.")
end
premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc"
@@ -376,8 +392,11 @@ function toolchain(_buildDir, _libDir)
end
end
+ if not _OPTIONS["with-dynamic-runtime"] then
+ flags { "StaticRuntime" }
+ end
+
flags {
- "StaticRuntime",
"NoPCH",
"NativeWChar",
"NoRTTI",
@@ -686,6 +705,30 @@ function toolchain(_buildDir, _libDir)
"-Wl,-z,now",
}
+ configuration { "linux-steamlink" }
+ targetdir (path.join(_buildDir, "steamlink/bin"))
+ objdir (path.join(_buildDir, "steamlink/obj"))
+ libdirs { path.join(_libDir, "lib/steamlink") }
+ includedirs { path.join(bxDir, "include/compat/linux") }
+ defines {
+ "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
+ }
+ buildoptions {
+ "-std=c++0x",
+ "-Wfatal-errors",
+ "-Wunused-value",
+ "-Wundef",
+ "-pthread",
+ "-marm",
+ "-mfloat-abi=hard",
+ "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
+ }
+ linkoptions {
+ "-static-libgcc",
+ "-static-libstdc++",
+ "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
+ }
+
configuration { "android-arm" }
targetdir (path.join(_buildDir, "android-arm/bin"))
objdir (path.join(_buildDir, "android-arm/obj"))
@@ -1083,7 +1126,13 @@ function strip()
"$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
}
- configuration { "linux-* or rpi", "Release" }
+ configuration { "linux-steamlink", "Release" }
+ postbuildcommands {
+ "$(SILENT) echo Stripping symbols.",
+ "$(SILENT) $(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-strip -s \"$(TARGET)\""
+ }
+
+ configuration { "linux-* or rpi", "not linux-steamlink", "Release" }
postbuildcommands {
"$(SILENT) echo Stripping symbols.",
"$(SILENT) strip -s \"$(TARGET)\""
diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie
index f7df2742735..a7c61b7300e 100644
--- a/3rdparty/bx/tools/bin/darwin/genie
+++ b/3rdparty/bx/tools/bin/darwin/genie
Binary files differ
diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie
index d22c9e96473..223ef23852e 100644
--- a/3rdparty/bx/tools/bin/linux/genie
+++ b/3rdparty/bx/tools/bin/linux/genie
Binary files differ
diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe
index cb0d3e7d3df..59575ce272e 100644
--- a/3rdparty/bx/tools/bin/windows/genie.exe
+++ b/3rdparty/bx/tools/bin/windows/genie.exe
Binary files differ
diff --git a/3rdparty/bx/tools/bin2c/bin2c.cpp b/3rdparty/bx/tools/bin2c/bin2c.cpp
index afdcaa65cdc..bdb92a4c04f 100644
--- a/3rdparty/bx/tools/bin2c/bin2c.cpp
+++ b/3rdparty/bx/tools/bin2c/bin2c.cpp
@@ -23,7 +23,7 @@ public:
{
}
- virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE
+ virtual int32_t write(const void* _data, int32_t _size, bx::Error* /*_err*/ = NULL) BX_OVERRIDE
{
const char* data = (const char*)_data;
m_buffer.insert(m_buffer.end(), data, data+_size);
@@ -148,14 +148,14 @@ int main(int _argc, const char* _argv[])
size_t size = 0;
bx::CrtFileReader fr;
- if (0 == bx::open(&fr, filePath) )
+ if (bx::open(&fr, filePath) )
{
size = (size_t)bx::getSize(&fr);
data = malloc(size);
bx::read(&fr, data, size);
bx::CrtFileWriter fw;
- if (0 == bx::open(&fw, outFilePath) )
+ if (bx::open(&fw, outFilePath) )
{
Bin2cWriter writer(&fw, name);
bx::write(&writer, data, size);
diff --git a/3rdparty/http-parser/.gitignore b/3rdparty/http-parser/.gitignore
new file mode 100644
index 00000000000..32cb51b2d3f
--- /dev/null
+++ b/3rdparty/http-parser/.gitignore
@@ -0,0 +1,28 @@
+/out/
+core
+tags
+*.o
+test
+test_g
+test_fast
+bench
+url_parser
+parsertrace
+parsertrace_g
+*.mk
+*.Makefile
+*.so.*
+*.a
+
+
+# Visual Studio uglies
+*.suo
+*.sln
+*.vcxproj
+*.vcxproj.filters
+*.vcxproj.user
+*.opensdf
+*.ncrunchsolution*
+*.sdf
+*.vsp
+*.psess
diff --git a/3rdparty/http-parser/.mailmap b/3rdparty/http-parser/.mailmap
new file mode 100644
index 00000000000..278d1412637
--- /dev/null
+++ b/3rdparty/http-parser/.mailmap
@@ -0,0 +1,8 @@
+# update AUTHORS with:
+# git log --all --reverse --format='%aN <%aE>' | perl -ne 'BEGIN{print "# Authors ordered by first contribution.\n"} print unless $h{$_}; $h{$_} = 1' > AUTHORS
+Ryan Dahl <ry@tinyclouds.org>
+Salman Haq <salman.haq@asti-usa.com>
+Simon Zimmermann <simonz05@gmail.com>
+Thomas LE ROUX <thomas@november-eleven.fr> LE ROUX Thomas <thomas@procheo.fr>
+Thomas LE ROUX <thomas@november-eleven.fr> Thomas LE ROUX <thomas@procheo.fr>
+Fedor Indutny <fedor@indutny.com>
diff --git a/3rdparty/http-parser/.travis.yml b/3rdparty/http-parser/.travis.yml
new file mode 100644
index 00000000000..4b038e6e62d
--- /dev/null
+++ b/3rdparty/http-parser/.travis.yml
@@ -0,0 +1,13 @@
+language: c
+
+compiler:
+ - clang
+ - gcc
+
+script:
+ - "make"
+
+notifications:
+ email: false
+ irc:
+ - "irc.freenode.net#node-ci"
diff --git a/3rdparty/http-parser/AUTHORS b/3rdparty/http-parser/AUTHORS
new file mode 100644
index 00000000000..8e2df1d06e6
--- /dev/null
+++ b/3rdparty/http-parser/AUTHORS
@@ -0,0 +1,67 @@
+# Authors ordered by first contribution.
+Ryan Dahl <ry@tinyclouds.org>
+Jeremy Hinegardner <jeremy@hinegardner.org>
+Sergey Shepelev <temotor@gmail.com>
+Joe Damato <ice799@gmail.com>
+tomika <tomika_nospam@freemail.hu>
+Phoenix Sol <phoenix@burninglabs.com>
+Cliff Frey <cliff@meraki.com>
+Ewen Cheslack-Postava <ewencp@cs.stanford.edu>
+Santiago Gala <sgala@apache.org>
+Tim Becker <tim.becker@syngenio.de>
+Jeff Terrace <jterrace@gmail.com>
+Ben Noordhuis <info@bnoordhuis.nl>
+Nathan Rajlich <nathan@tootallnate.net>
+Mark Nottingham <mnot@mnot.net>
+Aman Gupta <aman@tmm1.net>
+Tim Becker <tim.becker@kuriositaet.de>
+Sean Cunningham <sean.cunningham@mandiant.com>
+Peter Griess <pg@std.in>
+Salman Haq <salman.haq@asti-usa.com>
+Cliff Frey <clifffrey@gmail.com>
+Jon Kolb <jon@b0g.us>
+Fouad Mardini <f.mardini@gmail.com>
+Paul Querna <pquerna@apache.org>
+Felix Geisendörfer <felix@debuggable.com>
+koichik <koichik@improvement.jp>
+Andre Caron <andre.l.caron@gmail.com>
+Ivo Raisr <ivosh@ivosh.net>
+James McLaughlin <jamie@lacewing-project.org>
+David Gwynne <loki@animata.net>
+Thomas LE ROUX <thomas@november-eleven.fr>
+Randy Rizun <rrizun@ortivawireless.com>
+Andre Louis Caron <andre.louis.caron@usherbrooke.ca>
+Simon Zimmermann <simonz05@gmail.com>
+Erik Dubbelboer <erik@dubbelboer.com>
+Martell Malone <martellmalone@gmail.com>
+Bertrand Paquet <bpaquet@octo.com>
+BogDan Vatra <bogdan@kde.org>
+Peter Faiman <peter@thepicard.org>
+Corey Richardson <corey@octayn.net>
+Tóth Tamás <tomika_nospam@freemail.hu>
+Cam Swords <cam.swords@gmail.com>
+Chris Dickinson <christopher.s.dickinson@gmail.com>
+Uli Köhler <ukoehler@btronik.de>
+Charlie Somerville <charlie@charliesomerville.com>
+Patrik Stutz <patrik.stutz@gmail.com>
+Fedor Indutny <fedor.indutny@gmail.com>
+runner <runner.mei@gmail.com>
+Alexis Campailla <alexis@janeasystems.com>
+David Wragg <david@wragg.org>
+Vinnie Falco <vinnie.falco@gmail.com>
+Alex Butum <alexbutum@linux.com>
+Rex Feng <rexfeng@gmail.com>
+Alex Kocharin <alex@kocharin.ru>
+Mark Koopman <markmontymark@yahoo.com>
+Helge Heß <me@helgehess.eu>
+Alexis La Goutte <alexis.lagoutte@gmail.com>
+George Miroshnykov <george.miroshnykov@gmail.com>
+Maciej Małecki <me@mmalecki.com>
+Marc O'Morain <github.com@marcomorain.com>
+Jeff Pinner <jpinner@twitter.com>
+Timothy J Fontaine <tjfontaine@gmail.com>
+Akagi201 <akagi201@gmail.com>
+Romain Giraud <giraud.romain@gmail.com>
+Jay Satiro <raysatiro@yahoo.com>
+Arne Steen <Arne.Steen@gmx.de>
+Kjell Schubert <kjell.schubert@gmail.com>
diff --git a/3rdparty/http-parser/LICENSE-MIT b/3rdparty/http-parser/LICENSE-MIT
new file mode 100644
index 00000000000..58010b38894
--- /dev/null
+++ b/3rdparty/http-parser/LICENSE-MIT
@@ -0,0 +1,23 @@
+http_parser.c is based on src/http/ngx_http_parse.c from NGINX copyright
+Igor Sysoev.
+
+Additional changes are licensed under the same terms as NGINX and
+copyright Joyent, Inc. and other Node contributors. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/3rdparty/http-parser/Makefile b/3rdparty/http-parser/Makefile
new file mode 100644
index 00000000000..373709c6672
--- /dev/null
+++ b/3rdparty/http-parser/Makefile
@@ -0,0 +1,136 @@
+# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
+SONAME ?= libhttp_parser.so.2.5.0
+
+CC?=gcc
+AR?=ar
+
+CPPFLAGS ?=
+LDFLAGS ?=
+
+CPPFLAGS += -I.
+CPPFLAGS_DEBUG = $(CPPFLAGS) -DHTTP_PARSER_STRICT=1
+CPPFLAGS_DEBUG += $(CPPFLAGS_DEBUG_EXTRA)
+CPPFLAGS_FAST = $(CPPFLAGS) -DHTTP_PARSER_STRICT=0
+CPPFLAGS_FAST += $(CPPFLAGS_FAST_EXTRA)
+CPPFLAGS_BENCH = $(CPPFLAGS_FAST)
+
+CFLAGS += -Wall -Wextra -Werror
+CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
+CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
+CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter
+CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
+
+LDFLAGS_LIB = $(LDFLAGS) -shared
+
+INSTALL ?= install
+PREFIX ?= $(DESTDIR)/usr/local
+LIBDIR = $(PREFIX)/lib
+INCLUDEDIR = $(PREFIX)/include
+
+ifneq (darwin,$(PLATFORM))
+# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
+LDFLAGS_LIB += -Wl,-soname=$(SONAME)
+endif
+
+test: test_g test_fast
+ ./test_g
+ ./test_fast
+
+test_g: http_parser_g.o test_g.o
+ $(CC) $(CFLAGS_DEBUG) $(LDFLAGS) http_parser_g.o test_g.o -o $@
+
+test_g.o: test.c http_parser.h Makefile
+ $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c test.c -o $@
+
+http_parser_g.o: http_parser.c http_parser.h Makefile
+ $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c http_parser.c -o $@
+
+test_fast: http_parser.o test.o http_parser.h
+ $(CC) $(CFLAGS_FAST) $(LDFLAGS) http_parser.o test.o -o $@
+
+test.o: test.c http_parser.h Makefile
+ $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c test.c -o $@
+
+bench: http_parser.o bench.o
+ $(CC) $(CFLAGS_BENCH) $(LDFLAGS) http_parser.o bench.o -o $@
+
+bench.o: bench.c http_parser.h Makefile
+ $(CC) $(CPPFLAGS_BENCH) $(CFLAGS_BENCH) -c bench.c -o $@
+
+http_parser.o: http_parser.c http_parser.h Makefile
+ $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c
+
+test-run-timed: test_fast
+ while(true) do time ./test_fast > /dev/null; done
+
+test-valgrind: test_g
+ valgrind ./test_g
+
+libhttp_parser.o: http_parser.c http_parser.h Makefile
+ $(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
+
+library: libhttp_parser.o
+ $(CC) $(LDFLAGS_LIB) -o $(SONAME) $<
+
+package: http_parser.o
+ $(AR) rcs libhttp_parser.a http_parser.o
+
+url_parser: http_parser.o contrib/url_parser.c
+ $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o $@
+
+url_parser_g: http_parser_g.o contrib/url_parser.c
+ $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o $@
+
+parsertrace: http_parser.o contrib/parsertrace.c
+ $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace
+
+parsertrace_g: http_parser_g.o contrib/parsertrace.c
+ $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g
+
+tags: http_parser.c http_parser.h test.c
+ ctags $^
+
+install: library
+ $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
+ $(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME)
+ ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so
+
+install-strip: library
+ $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
+ $(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME)
+ ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so
+
+uninstall:
+ rm $(INCLUDEDIR)/http_parser.h
+ rm $(LIBDIR)/$(SONAME)
+ rm $(LIBDIR)/libhttp_parser.so
+
+clean:
+ rm -f *.o *.a tags test test_fast test_g \
+ http_parser.tar libhttp_parser.so.* \
+ url_parser url_parser_g parsertrace parsertrace_g
+
+contrib/url_parser.c: http_parser.h
+contrib/parsertrace.c: http_parser.h
+
+.PHONY: clean package test-run test-run-timed test-valgrind install install-strip uninstall
diff --git a/3rdparty/http-parser/README.md b/3rdparty/http-parser/README.md
new file mode 100644
index 00000000000..7c54dd42d08
--- /dev/null
+++ b/3rdparty/http-parser/README.md
@@ -0,0 +1,183 @@
+HTTP Parser
+===========
+
+[![Build Status](https://travis-ci.org/joyent/http-parser.png?branch=master)](https://travis-ci.org/joyent/http-parser)
+
+This is a parser for HTTP messages written in C. It parses both requests and
+responses. The parser is designed to be used in performance HTTP
+applications. It does not make any syscalls nor allocations, it does not
+buffer data, it can be interrupted at anytime. Depending on your
+architecture, it only requires about 40 bytes of data per message
+stream (in a web server that is per connection).
+
+Features:
+
+ * No dependencies
+ * Handles persistent streams (keep-alive).
+ * Decodes chunked encoding.
+ * Upgrade support
+ * Defends against buffer overflow attacks.
+
+The parser extracts the following information from HTTP messages:
+
+ * Header fields and values
+ * Content-Length
+ * Request method
+ * Response status code
+ * Transfer-Encoding
+ * HTTP version
+ * Request URL
+ * Message body
+
+
+Usage
+-----
+
+One `http_parser` object is used per TCP connection. Initialize the struct
+using `http_parser_init()` and set the callbacks. That might look something
+like this for a request parser:
+```c
+http_parser_settings settings;
+settings.on_url = my_url_callback;
+settings.on_header_field = my_header_field_callback;
+/* ... */
+
+http_parser *parser = malloc(sizeof(http_parser));
+http_parser_init(parser, HTTP_REQUEST);
+parser->data = my_socket;
+```
+
+When data is received on the socket execute the parser and check for errors.
+
+```c
+size_t len = 80*1024, nparsed;
+char buf[len];
+ssize_t recved;
+
+recved = recv(fd, buf, len, 0);
+
+if (recved < 0) {
+ /* Handle error. */
+}
+
+/* Start up / continue the parser.
+ * Note we pass recved==0 to signal that EOF has been received.
+ */
+nparsed = http_parser_execute(parser, &settings, buf, recved);
+
+if (parser->upgrade) {
+ /* handle new protocol */
+} else if (nparsed != recved) {
+ /* Handle error. Usually just close the connection. */
+}
+```
+
+HTTP needs to know where the end of the stream is. For example, sometimes
+servers send responses without Content-Length and expect the client to
+consume input (for the body) until EOF. To tell http_parser about EOF, give
+`0` as the fourth parameter to `http_parser_execute()`. Callbacks and errors
+can still be encountered during an EOF, so one must still be prepared
+to receive them.
+
+Scalar valued message information such as `status_code`, `method`, and the
+HTTP version are stored in the parser structure. This data is only
+temporally stored in `http_parser` and gets reset on each new message. If
+this information is needed later, copy it out of the structure during the
+`headers_complete` callback.
+
+The parser decodes the transfer-encoding for both requests and responses
+transparently. That is, a chunked encoding is decoded before being sent to
+the on_body callback.
+
+
+The Special Problem of Upgrade
+------------------------------
+
+HTTP supports upgrading the connection to a different protocol. An
+increasingly common example of this is the Web Socket protocol which sends
+a request like
+
+ GET /demo HTTP/1.1
+ Upgrade: WebSocket
+ Connection: Upgrade
+ Host: example.com
+ Origin: http://example.com
+ WebSocket-Protocol: sample
+
+followed by non-HTTP data.
+
+(See http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75 for more
+information the Web Socket protocol.)
+
+To support this, the parser will treat this as a normal HTTP message without a
+body, issuing both on_headers_complete and on_message_complete callbacks. However
+http_parser_execute() will stop parsing at the end of the headers and return.
+
+The user is expected to check if `parser->upgrade` has been set to 1 after
+`http_parser_execute()` returns. Non-HTTP data begins at the buffer supplied
+offset by the return value of `http_parser_execute()`.
+
+
+Callbacks
+---------
+
+During the `http_parser_execute()` call, the callbacks set in
+`http_parser_settings` will be executed. The parser maintains state and
+never looks behind, so buffering the data is not necessary. If you need to
+save certain data for later usage, you can do that from the callbacks.
+
+There are two types of callbacks:
+
+* notification `typedef int (*http_cb) (http_parser*);`
+ Callbacks: on_message_begin, on_headers_complete, on_message_complete.
+* data `typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);`
+ Callbacks: (requests only) on_url,
+ (common) on_header_field, on_header_value, on_body;
+
+Callbacks must return 0 on success. Returning a non-zero value indicates
+error to the parser, making it exit immediately.
+
+In case you parse HTTP message in chunks (i.e. `read()` request line
+from socket, parse, read half headers, parse, etc) your data callbacks
+may be called more than once. Http-parser guarantees that data pointer is only
+valid for the lifetime of callback. You can also `read()` into a heap allocated
+buffer to avoid copying memory around if this fits your application.
+
+Reading headers may be a tricky task if you read/parse headers partially.
+Basically, you need to remember whether last header callback was field or value
+and apply the following logic:
+
+ (on_header_field and on_header_value shortened to on_h_*)
+ ------------------------ ------------ --------------------------------------------
+ | State (prev. callback) | Callback | Description/action |
+ ------------------------ ------------ --------------------------------------------
+ | nothing (first call) | on_h_field | Allocate new buffer and copy callback data |
+ | | | into it |
+ ------------------------ ------------ --------------------------------------------
+ | value | on_h_field | New header started. |
+ | | | Copy current name,value buffers to headers |
+ | | | list and allocate new buffer for new name |
+ ------------------------ ------------ --------------------------------------------
+ | field | on_h_field | Previous name continues. Reallocate name |
+ | | | buffer and append callback data to it |
+ ------------------------ ------------ --------------------------------------------
+ | field | on_h_value | Value for current header started. Allocate |
+ | | | new buffer and copy callback data to it |
+ ------------------------ ------------ --------------------------------------------
+ | value | on_h_value | Value continues. Reallocate value buffer |
+ | | | and append callback data to it |
+ ------------------------ ------------ --------------------------------------------
+
+
+Parsing URLs
+------------
+
+A simplistic zero-copy URL parser is provided as `http_parser_parse_url()`.
+Users of this library may wish to use it to parse URLs constructed from
+consecutive `on_url` callbacks.
+
+See examples of reading in headers:
+
+* [partial example](http://gist.github.com/155877) in C
+* [from http-parser tests](http://github.com/joyent/http-parser/blob/37a0ff8/test.c#L403) in C
+* [from Node library](http://github.com/joyent/node/blob/842eaf4/src/http.js#L284) in Javascript
diff --git a/3rdparty/http-parser/bench.c b/3rdparty/http-parser/bench.c
new file mode 100644
index 00000000000..5b452fa1cdb
--- /dev/null
+++ b/3rdparty/http-parser/bench.c
@@ -0,0 +1,111 @@
+/* Copyright Fedor Indutny. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+#include "http_parser.h"
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+
+static const char data[] =
+ "POST /joyent/http-parser HTTP/1.1\r\n"
+ "Host: github.com\r\n"
+ "DNT: 1\r\n"
+ "Accept-Encoding: gzip, deflate, sdch\r\n"
+ "Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4\r\n"
+ "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) "
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
+ "Chrome/39.0.2171.65 Safari/537.36\r\n"
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,"
+ "image/webp,*/*;q=0.8\r\n"
+ "Referer: https://github.com/joyent/http-parser\r\n"
+ "Connection: keep-alive\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "Cache-Control: max-age=0\r\n\r\nb\r\nhello world\r\n0\r\n\r\n";
+static const size_t data_len = sizeof(data) - 1;
+
+static int on_info(http_parser* p) {
+ return 0;
+}
+
+
+static int on_data(http_parser* p, const char *at, size_t length) {
+ return 0;
+}
+
+static http_parser_settings settings = {
+ .on_message_begin = on_info,
+ .on_headers_complete = on_info,
+ .on_message_complete = on_info,
+ .on_header_field = on_data,
+ .on_header_value = on_data,
+ .on_url = on_data,
+ .on_status = on_data,
+ .on_body = on_data
+};
+
+int bench(int iter_count, int silent) {
+ struct http_parser parser;
+ int i;
+ int err;
+ struct timeval start;
+ struct timeval end;
+ float rps;
+
+ if (!silent) {
+ err = gettimeofday(&start, NULL);
+ assert(err == 0);
+ }
+
+ for (i = 0; i < iter_count; i++) {
+ size_t parsed;
+ http_parser_init(&parser, HTTP_REQUEST);
+
+ parsed = http_parser_execute(&parser, &settings, data, data_len);
+ assert(parsed == data_len);
+ }
+
+ if (!silent) {
+ err = gettimeofday(&end, NULL);
+ assert(err == 0);
+
+ fprintf(stdout, "Benchmark result:\n");
+
+ rps = (float) (end.tv_sec - start.tv_sec) +
+ (end.tv_usec - start.tv_usec) * 1e-6f;
+ fprintf(stdout, "Took %f seconds to run\n", rps);
+
+ rps = (float) iter_count / rps;
+ fprintf(stdout, "%f req/sec\n", rps);
+ fflush(stdout);
+ }
+
+ return 0;
+}
+
+int main(int argc, char** argv) {
+ if (argc == 2 && strcmp(argv[1], "infinite") == 0) {
+ for (;;)
+ bench(5000000, 1);
+ return 0;
+ } else {
+ return bench(5000000, 0);
+ }
+}
diff --git a/3rdparty/http-parser/contrib/parsertrace.c b/3rdparty/http-parser/contrib/parsertrace.c
new file mode 100644
index 00000000000..e7153680f46
--- /dev/null
+++ b/3rdparty/http-parser/contrib/parsertrace.c
@@ -0,0 +1,160 @@
+/* Based on src/http/ngx_http_parse.c from NGINX copyright Igor Sysoev
+ *
+ * Additional changes are licensed under the same terms as NGINX and
+ * copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/* Dump what the parser finds to stdout as it happen */
+
+#include "http_parser.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int on_message_begin(http_parser* _) {
+ (void)_;
+ printf("\n***MESSAGE BEGIN***\n\n");
+ return 0;
+}
+
+int on_headers_complete(http_parser* _) {
+ (void)_;
+ printf("\n***HEADERS COMPLETE***\n\n");
+ return 0;
+}
+
+int on_message_complete(http_parser* _) {
+ (void)_;
+ printf("\n***MESSAGE COMPLETE***\n\n");
+ return 0;
+}
+
+int on_url(http_parser* _, const char* at, size_t length) {
+ (void)_;
+ printf("Url: %.*s\n", (int)length, at);
+ return 0;
+}
+
+int on_header_field(http_parser* _, const char* at, size_t length) {
+ (void)_;
+ printf("Header field: %.*s\n", (int)length, at);
+ return 0;
+}
+
+int on_header_value(http_parser* _, const char* at, size_t length) {
+ (void)_;
+ printf("Header value: %.*s\n", (int)length, at);
+ return 0;
+}
+
+int on_body(http_parser* _, const char* at, size_t length) {
+ (void)_;
+ printf("Body: %.*s\n", (int)length, at);
+ return 0;
+}
+
+void usage(const char* name) {
+ fprintf(stderr,
+ "Usage: %s $type $filename\n"
+ " type: -x, where x is one of {r,b,q}\n"
+ " parses file as a Response, reQuest, or Both\n",
+ name);
+ exit(EXIT_FAILURE);
+}
+
+int main(int argc, char* argv[]) {
+ enum http_parser_type file_type;
+
+ if (argc != 3) {
+ usage(argv[0]);
+ }
+
+ char* type = argv[1];
+ if (type[0] != '-') {
+ usage(argv[0]);
+ }
+
+ switch (type[1]) {
+ /* in the case of "-", type[1] will be NUL */
+ case 'r':
+ file_type = HTTP_RESPONSE;
+ break;
+ case 'q':
+ file_type = HTTP_REQUEST;
+ break;
+ case 'b':
+ file_type = HTTP_BOTH;
+ break;
+ default:
+ usage(argv[0]);
+ }
+
+ char* filename = argv[2];
+ FILE* file = fopen(filename, "r");
+ if (file == NULL) {
+ perror("fopen");
+ goto fail;
+ }
+
+ fseek(file, 0, SEEK_END);
+ long file_length = ftell(file);
+ if (file_length == -1) {
+ perror("ftell");
+ goto fail;
+ }
+ fseek(file, 0, SEEK_SET);
+
+ char* data = malloc(file_length);
+ if (fread(data, 1, file_length, file) != (size_t)file_length) {
+ fprintf(stderr, "couldn't read entire file\n");
+ free(data);
+ goto fail;
+ }
+
+ http_parser_settings settings;
+ memset(&settings, 0, sizeof(settings));
+ settings.on_message_begin = on_message_begin;
+ settings.on_url = on_url;
+ settings.on_header_field = on_header_field;
+ settings.on_header_value = on_header_value;
+ settings.on_headers_complete = on_headers_complete;
+ settings.on_body = on_body;
+ settings.on_message_complete = on_message_complete;
+
+ http_parser parser;
+ http_parser_init(&parser, file_type);
+ size_t nparsed = http_parser_execute(&parser, &settings, data, file_length);
+ free(data);
+
+ if (nparsed != (size_t)file_length) {
+ fprintf(stderr,
+ "Error: %s (%s)\n",
+ http_errno_description(HTTP_PARSER_ERRNO(&parser)),
+ http_errno_name(HTTP_PARSER_ERRNO(&parser)));
+ goto fail;
+ }
+
+ return EXIT_SUCCESS;
+
+fail:
+ fclose(file);
+ return EXIT_FAILURE;
+}
diff --git a/3rdparty/http-parser/contrib/url_parser.c b/3rdparty/http-parser/contrib/url_parser.c
new file mode 100644
index 00000000000..6650b414af9
--- /dev/null
+++ b/3rdparty/http-parser/contrib/url_parser.c
@@ -0,0 +1,46 @@
+#include "http_parser.h"
+#include <stdio.h>
+#include <string.h>
+
+void
+dump_url (const char *url, const struct http_parser_url *u)
+{
+ unsigned int i;
+
+ printf("\tfield_set: 0x%x, port: %u\n", u->field_set, u->port);
+ for (i = 0; i < UF_MAX; i++) {
+ if ((u->field_set & (1 << i)) == 0) {
+ printf("\tfield_data[%u]: unset\n", i);
+ continue;
+ }
+
+ printf("\tfield_data[%u]: off: %u, len: %u, part: %.*s\n",
+ i,
+ u->field_data[i].off,
+ u->field_data[i].len,
+ u->field_data[i].len,
+ url + u->field_data[i].off);
+ }
+}
+
+int main(int argc, char ** argv) {
+ struct http_parser_url u;
+ int len, connect, result;
+
+ if (argc != 3) {
+ printf("Syntax : %s connect|get url\n", argv[0]);
+ return 1;
+ }
+ len = strlen(argv[2]);
+ connect = strcmp("connect", argv[1]) == 0 ? 1 : 0;
+ printf("Parsing %s, connect %d\n", argv[2], connect);
+
+ result = http_parser_parse_url(argv[2], len, connect, &u);
+ if (result != 0) {
+ printf("Parse error : %d\n", result);
+ return result;
+ }
+ printf("Parse ok, result : \n");
+ dump_url(argv[2], &u);
+ return 0;
+} \ No newline at end of file
diff --git a/3rdparty/http-parser/http_parser.c b/3rdparty/http-parser/http_parser.c
new file mode 100644
index 00000000000..0fa1c362729
--- /dev/null
+++ b/3rdparty/http-parser/http_parser.c
@@ -0,0 +1,2429 @@
+/* Based on src/http/ngx_http_parse.c from NGINX copyright Igor Sysoev
+ *
+ * Additional changes are licensed under the same terms as NGINX and
+ * copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+#include "http_parser.h"
+#include <assert.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#ifndef ULLONG_MAX
+# define ULLONG_MAX ((uint64_t) -1) /* 2^64-1 */
+#endif
+
+#ifndef MIN
+# define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef ARRAY_SIZE
+# define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#endif
+
+#ifndef BIT_AT
+# define BIT_AT(a, i) \
+ (!!((unsigned int) (a)[(unsigned int) (i) >> 3] & \
+ (1 << ((unsigned int) (i) & 7))))
+#endif
+
+#ifndef ELEM_AT
+# define ELEM_AT(a, i, v) ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v))
+#endif
+
+#define SET_ERRNO(e) \
+do { \
+ parser->http_errno = (e); \
+} while(0)
+
+#define CURRENT_STATE() p_state
+#define UPDATE_STATE(V) p_state = (enum state) (V);
+#define RETURN(V) \
+do { \
+ parser->state = CURRENT_STATE(); \
+ return (V); \
+} while (0);
+#define REEXECUTE() \
+ goto reexecute; \
+
+
+#ifdef __GNUC__
+# define LIKELY(X) __builtin_expect(!!(X), 1)
+# define UNLIKELY(X) __builtin_expect(!!(X), 0)
+#else
+# define LIKELY(X) (X)
+# define UNLIKELY(X) (X)
+#endif
+
+
+/* Run the notify callback FOR, returning ER if it fails */
+#define CALLBACK_NOTIFY_(FOR, ER) \
+do { \
+ assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \
+ \
+ if (LIKELY(settings->on_##FOR)) { \
+ parser->state = CURRENT_STATE(); \
+ if (UNLIKELY(0 != settings->on_##FOR(parser))) { \
+ SET_ERRNO(HPE_CB_##FOR); \
+ } \
+ UPDATE_STATE(parser->state); \
+ \
+ /* We either errored above or got paused; get out */ \
+ if (UNLIKELY(HTTP_PARSER_ERRNO(parser) != HPE_OK)) { \
+ return (ER); \
+ } \
+ } \
+} while (0)
+
+/* Run the notify callback FOR and consume the current byte */
+#define CALLBACK_NOTIFY(FOR) CALLBACK_NOTIFY_(FOR, p - data + 1)
+
+/* Run the notify callback FOR and don't consume the current byte */
+#define CALLBACK_NOTIFY_NOADVANCE(FOR) CALLBACK_NOTIFY_(FOR, p - data)
+
+/* Run data callback FOR with LEN bytes, returning ER if it fails */
+#define CALLBACK_DATA_(FOR, LEN, ER) \
+do { \
+ assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \
+ \
+ if (FOR##_mark) { \
+ if (LIKELY(settings->on_##FOR)) { \
+ parser->state = CURRENT_STATE(); \
+ if (UNLIKELY(0 != \
+ settings->on_##FOR(parser, FOR##_mark, (LEN)))) { \
+ SET_ERRNO(HPE_CB_##FOR); \
+ } \
+ UPDATE_STATE(parser->state); \
+ \
+ /* We either errored above or got paused; get out */ \
+ if (UNLIKELY(HTTP_PARSER_ERRNO(parser) != HPE_OK)) { \
+ return (ER); \
+ } \
+ } \
+ FOR##_mark = NULL; \
+ } \
+} while (0)
+
+/* Run the data callback FOR and consume the current byte */
+#define CALLBACK_DATA(FOR) \
+ CALLBACK_DATA_(FOR, p - FOR##_mark, p - data + 1)
+
+/* Run the data callback FOR and don't consume the current byte */
+#define CALLBACK_DATA_NOADVANCE(FOR) \
+ CALLBACK_DATA_(FOR, p - FOR##_mark, p - data)
+
+/* Set the mark FOR; non-destructive if mark is already set */
+#define MARK(FOR) \
+do { \
+ if (!FOR##_mark) { \
+ FOR##_mark = p; \
+ } \
+} while (0)
+
+/* Don't allow the total size of the HTTP headers (including the status
+ * line) to exceed HTTP_MAX_HEADER_SIZE. This check is here to protect
+ * embedders against denial-of-service attacks where the attacker feeds
+ * us a never-ending header that the embedder keeps buffering.
+ *
+ * This check is arguably the responsibility of embedders but we're doing
+ * it on the embedder's behalf because most won't bother and this way we
+ * make the web a little safer. HTTP_MAX_HEADER_SIZE is still far bigger
+ * than any reasonable request or response so this should never affect
+ * day-to-day operation.
+ */
+#define COUNT_HEADER_SIZE(V) \
+do { \
+ parser->nread += (V); \
+ if (UNLIKELY(parser->nread > (HTTP_MAX_HEADER_SIZE))) { \
+ SET_ERRNO(HPE_HEADER_OVERFLOW); \
+ goto error; \
+ } \
+} while (0)
+
+
+#define PROXY_CONNECTION "proxy-connection"
+#define CONNECTION "connection"
+#define CONTENT_LENGTH "content-length"
+#define TRANSFER_ENCODING "transfer-encoding"
+#define UPGRADE "upgrade"
+#define CHUNKED "chunked"
+#define KEEP_ALIVE "keep-alive"
+#define CLOSE "close"
+
+
+static const char *method_strings[] =
+ {
+#define XX(num, name, string) #string,
+ HTTP_METHOD_MAP(XX)
+#undef XX
+ };
+
+
+/* Tokens as defined by rfc 2616. Also lowercases them.
+ * token = 1*<any CHAR except CTLs or separators>
+ * separators = "(" | ")" | "<" | ">" | "@"
+ * | "," | ";" | ":" | "\" | <">
+ * | "/" | "[" | "]" | "?" | "="
+ * | "{" | "}" | SP | HT
+ */
+static const char tokens[256] = {
+/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */
+ 0, '!', 0, '#', '$', '%', '&', '\'',
+/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */
+ 0, 0, '*', '+', 0, '-', '.', 0,
+/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */
+ '0', '1', '2', '3', '4', '5', '6', '7',
+/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */
+ '8', '9', 0, 0, 0, 0, 0, 0,
+/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */
+ 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */
+ 'x', 'y', 'z', 0, 0, 0, '^', '_',
+/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */
+ 'x', 'y', 'z', 0, '|', 0, '~', 0 };
+
+
+static const int8_t unhex[256] =
+ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1
+ ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ };
+
+
+#if HTTP_PARSER_STRICT
+# define T(v) 0
+#else
+# define T(v) v
+#endif
+
+
+static const uint8_t normal_url_char[32] = {
+/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
+ 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0,
+/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */
+ 0 | T(2) | 0 | 0 | T(16) | 0 | 0 | 0,
+/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */
+ 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0,
+/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */
+ 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0,
+/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */
+ 0 | 2 | 4 | 0 | 16 | 32 | 64 | 128,
+/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0,
+/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
+/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */
+ 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0, };
+
+#undef T
+
+enum state
+ { s_dead = 1 /* important that this is > 0 */
+
+ , s_start_req_or_res
+ , s_res_or_resp_H
+ , s_start_res
+ , s_res_H
+ , s_res_HT
+ , s_res_HTT
+ , s_res_HTTP
+ , s_res_first_http_major
+ , s_res_http_major
+ , s_res_first_http_minor
+ , s_res_http_minor
+ , s_res_first_status_code
+ , s_res_status_code
+ , s_res_status_start
+ , s_res_status
+ , s_res_line_almost_done
+
+ , s_start_req
+
+ , s_req_method
+ , s_req_spaces_before_url
+ , s_req_schema
+ , s_req_schema_slash
+ , s_req_schema_slash_slash
+ , s_req_server_start
+ , s_req_server
+ , s_req_server_with_at
+ , s_req_path
+ , s_req_query_string_start
+ , s_req_query_string
+ , s_req_fragment_start
+ , s_req_fragment
+ , s_req_http_start
+ , s_req_http_H
+ , s_req_http_HT
+ , s_req_http_HTT
+ , s_req_http_HTTP
+ , s_req_first_http_major
+ , s_req_http_major
+ , s_req_first_http_minor
+ , s_req_http_minor
+ , s_req_line_almost_done
+
+ , s_header_field_start
+ , s_header_field
+ , s_header_value_discard_ws
+ , s_header_value_discard_ws_almost_done
+ , s_header_value_discard_lws
+ , s_header_value_start
+ , s_header_value
+ , s_header_value_lws
+
+ , s_header_almost_done
+
+ , s_chunk_size_start
+ , s_chunk_size
+ , s_chunk_parameters
+ , s_chunk_size_almost_done
+
+ , s_headers_almost_done
+ , s_headers_done
+
+ /* Important: 's_headers_done' must be the last 'header' state. All
+ * states beyond this must be 'body' states. It is used for overflow
+ * checking. See the PARSING_HEADER() macro.
+ */
+
+ , s_chunk_data
+ , s_chunk_data_almost_done
+ , s_chunk_data_done
+
+ , s_body_identity
+ , s_body_identity_eof
+
+ , s_message_done
+ };
+
+
+#define PARSING_HEADER(state) (state <= s_headers_done)
+
+
+enum header_states
+ { h_general = 0
+ , h_C
+ , h_CO
+ , h_CON
+
+ , h_matching_connection
+ , h_matching_proxy_connection
+ , h_matching_content_length
+ , h_matching_transfer_encoding
+ , h_matching_upgrade
+
+ , h_connection
+ , h_content_length
+ , h_transfer_encoding
+ , h_upgrade
+
+ , h_matching_transfer_encoding_chunked
+ , h_matching_connection_token_start
+ , h_matching_connection_keep_alive
+ , h_matching_connection_close
+ , h_matching_connection_upgrade
+ , h_matching_connection_token
+
+ , h_transfer_encoding_chunked
+ , h_connection_keep_alive
+ , h_connection_close
+ , h_connection_upgrade
+ };
+
+enum http_host_state
+ {
+ s_http_host_dead = 1
+ , s_http_userinfo_start
+ , s_http_userinfo
+ , s_http_host_start
+ , s_http_host_v6_start
+ , s_http_host
+ , s_http_host_v6
+ , s_http_host_v6_end
+ , s_http_host_port_start
+ , s_http_host_port
+};
+
+/* Macros for character classes; depends on strict-mode */
+#define CR '\r'
+#define LF '\n'
+#define LOWER(c) (unsigned char)(c | 0x20)
+#define IS_ALPHA(c) (LOWER(c) >= 'a' && LOWER(c) <= 'z')
+#define IS_NUM(c) ((c) >= '0' && (c) <= '9')
+#define IS_ALPHANUM(c) (IS_ALPHA(c) || IS_NUM(c))
+#define IS_HEX(c) (IS_NUM(c) || (LOWER(c) >= 'a' && LOWER(c) <= 'f'))
+#define IS_MARK(c) ((c) == '-' || (c) == '_' || (c) == '.' || \
+ (c) == '!' || (c) == '~' || (c) == '*' || (c) == '\'' || (c) == '(' || \
+ (c) == ')')
+#define IS_USERINFO_CHAR(c) (IS_ALPHANUM(c) || IS_MARK(c) || (c) == '%' || \
+ (c) == ';' || (c) == ':' || (c) == '&' || (c) == '=' || (c) == '+' || \
+ (c) == '$' || (c) == ',')
+
+#define STRICT_TOKEN(c) (tokens[(unsigned char)c])
+
+#if HTTP_PARSER_STRICT
+#define TOKEN(c) (tokens[(unsigned char)c])
+#define IS_URL_CHAR(c) (BIT_AT(normal_url_char, (unsigned char)c))
+#define IS_HOST_CHAR(c) (IS_ALPHANUM(c) || (c) == '.' || (c) == '-')
+#else
+#define TOKEN(c) ((c == ' ') ? ' ' : tokens[(unsigned char)c])
+#define IS_URL_CHAR(c) \
+ (BIT_AT(normal_url_char, (unsigned char)c) || ((c) & 0x80))
+#define IS_HOST_CHAR(c) \
+ (IS_ALPHANUM(c) || (c) == '.' || (c) == '-' || (c) == '_')
+#endif
+
+
+#define start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res)
+
+
+#if HTTP_PARSER_STRICT
+# define STRICT_CHECK(cond) \
+do { \
+ if (cond) { \
+ SET_ERRNO(HPE_STRICT); \
+ goto error; \
+ } \
+} while (0)
+# define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead)
+#else
+# define STRICT_CHECK(cond)
+# define NEW_MESSAGE() start_state
+#endif
+
+
+/* Map errno values to strings for human-readable output */
+#define HTTP_STRERROR_GEN(n, s) { "HPE_" #n, s },
+static struct {
+ const char *name;
+ const char *description;
+} http_strerror_tab[] = {
+ HTTP_ERRNO_MAP(HTTP_STRERROR_GEN)
+};
+#undef HTTP_STRERROR_GEN
+
+int http_message_needs_eof(const http_parser *parser);
+
+/* Our URL parser.
+ *
+ * This is designed to be shared by http_parser_execute() for URL validation,
+ * hence it has a state transition + byte-for-byte interface. In addition, it
+ * is meant to be embedded in http_parser_parse_url(), which does the dirty
+ * work of turning state transitions URL components for its API.
+ *
+ * This function should only be invoked with non-space characters. It is
+ * assumed that the caller cares about (and can detect) the transition between
+ * URL and non-URL states by looking for these.
+ */
+static enum state
+parse_url_char(enum state s, const char ch)
+{
+ if (ch == ' ' || ch == '\r' || ch == '\n') {
+ return s_dead;
+ }
+
+#if HTTP_PARSER_STRICT
+ if (ch == '\t' || ch == '\f') {
+ return s_dead;
+ }
+#endif
+
+ switch (s) {
+ case s_req_spaces_before_url:
+ /* Proxied requests are followed by scheme of an absolute URI (alpha).
+ * All methods except CONNECT are followed by '/' or '*'.
+ */
+
+ if (ch == '/' || ch == '*') {
+ return s_req_path;
+ }
+
+ if (IS_ALPHA(ch)) {
+ return s_req_schema;
+ }
+
+ break;
+
+ case s_req_schema:
+ if (IS_ALPHA(ch)) {
+ return s;
+ }
+
+ if (ch == ':') {
+ return s_req_schema_slash;
+ }
+
+ break;
+
+ case s_req_schema_slash:
+ if (ch == '/') {
+ return s_req_schema_slash_slash;
+ }
+
+ break;
+
+ case s_req_schema_slash_slash:
+ if (ch == '/') {
+ return s_req_server_start;
+ }
+
+ break;
+
+ case s_req_server_with_at:
+ if (ch == '@') {
+ return s_dead;
+ }
+
+ /* FALLTHROUGH */
+ case s_req_server_start:
+ case s_req_server:
+ if (ch == '/') {
+ return s_req_path;
+ }
+
+ if (ch == '?') {
+ return s_req_query_string_start;
+ }
+
+ if (ch == '@') {
+ return s_req_server_with_at;
+ }
+
+ if (IS_USERINFO_CHAR(ch) || ch == '[' || ch == ']') {
+ return s_req_server;
+ }
+
+ break;
+
+ case s_req_path:
+ if (IS_URL_CHAR(ch)) {
+ return s;
+ }
+
+ switch (ch) {
+ case '?':
+ return s_req_query_string_start;
+
+ case '#':
+ return s_req_fragment_start;
+ }
+
+ break;
+
+ case s_req_query_string_start:
+ case s_req_query_string:
+ if (IS_URL_CHAR(ch)) {
+ return s_req_query_string;
+ }
+
+ switch (ch) {
+ case '?':
+ /* allow extra '?' in query string */
+ return s_req_query_string;
+
+ case '#':
+ return s_req_fragment_start;
+ }
+
+ break;
+
+ case s_req_fragment_start:
+ if (IS_URL_CHAR(ch)) {
+ return s_req_fragment;
+ }
+
+ switch (ch) {
+ case '?':
+ return s_req_fragment;
+
+ case '#':
+ return s;
+ }
+
+ break;
+
+ case s_req_fragment:
+ if (IS_URL_CHAR(ch)) {
+ return s;
+ }
+
+ switch (ch) {
+ case '?':
+ case '#':
+ return s;
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+ /* We should never fall out of the switch above unless there's an error */
+ return s_dead;
+}
+
+size_t http_parser_execute (http_parser *parser,
+ const http_parser_settings *settings,
+ const char *data,
+ size_t len)
+{
+ char c, ch;
+ int8_t unhex_val;
+ const char *p = data;
+ const char *header_field_mark = 0;
+ const char *header_value_mark = 0;
+ const char *url_mark = 0;
+ const char *body_mark = 0;
+ const char *status_mark = 0;
+ enum state p_state = (enum state) parser->state;
+
+ /* We're in an error state. Don't bother doing anything. */
+ if (HTTP_PARSER_ERRNO(parser) != HPE_OK) {
+ return 0;
+ }
+
+ if (len == 0) {
+ switch (CURRENT_STATE()) {
+ case s_body_identity_eof:
+ /* Use of CALLBACK_NOTIFY() here would erroneously return 1 byte read if
+ * we got paused.
+ */
+ CALLBACK_NOTIFY_NOADVANCE(message_complete);
+ return 0;
+
+ case s_dead:
+ case s_start_req_or_res:
+ case s_start_res:
+ case s_start_req:
+ return 0;
+
+ default:
+ SET_ERRNO(HPE_INVALID_EOF_STATE);
+ return 1;
+ }
+ }
+
+
+ if (CURRENT_STATE() == s_header_field)
+ header_field_mark = data;
+ if (CURRENT_STATE() == s_header_value)
+ header_value_mark = data;
+ switch (CURRENT_STATE()) {
+ case s_req_path:
+ case s_req_schema:
+ case s_req_schema_slash:
+ case s_req_schema_slash_slash:
+ case s_req_server_start:
+ case s_req_server:
+ case s_req_server_with_at:
+ case s_req_query_string_start:
+ case s_req_query_string:
+ case s_req_fragment_start:
+ case s_req_fragment:
+ url_mark = data;
+ break;
+ case s_res_status:
+ status_mark = data;
+ break;
+ default:
+ break;
+ }
+
+ for (p=data; p != data + len; p++) {
+ ch = *p;
+
+ if (PARSING_HEADER(CURRENT_STATE()))
+ COUNT_HEADER_SIZE(1);
+
+reexecute:
+ switch (CURRENT_STATE()) {
+
+ case s_dead:
+ /* this state is used after a 'Connection: close' message
+ * the parser will error out if it reads another message
+ */
+ if (LIKELY(ch == CR || ch == LF))
+ break;
+
+ SET_ERRNO(HPE_CLOSED_CONNECTION);
+ goto error;
+
+ case s_start_req_or_res:
+ {
+ if (ch == CR || ch == LF)
+ break;
+ parser->flags = 0;
+ parser->content_length = ULLONG_MAX;
+
+ if (ch == 'H') {
+ UPDATE_STATE(s_res_or_resp_H);
+
+ CALLBACK_NOTIFY(message_begin);
+ } else {
+ parser->type = HTTP_REQUEST;
+ UPDATE_STATE(s_start_req);
+ REEXECUTE();
+ }
+
+ break;
+ }
+
+ case s_res_or_resp_H:
+ if (ch == 'T') {
+ parser->type = HTTP_RESPONSE;
+ UPDATE_STATE(s_res_HT);
+ } else {
+ if (UNLIKELY(ch != 'E')) {
+ SET_ERRNO(HPE_INVALID_CONSTANT);
+ goto error;
+ }
+
+ parser->type = HTTP_REQUEST;
+ parser->method = HTTP_HEAD;
+ parser->index = 2;
+ UPDATE_STATE(s_req_method);
+ }
+ break;
+
+ case s_start_res:
+ {
+ parser->flags = 0;
+ parser->content_length = ULLONG_MAX;
+
+ switch (ch) {
+ case 'H':
+ UPDATE_STATE(s_res_H);
+ break;
+
+ case CR:
+ case LF:
+ break;
+
+ default:
+ SET_ERRNO(HPE_INVALID_CONSTANT);
+ goto error;
+ }
+
+ CALLBACK_NOTIFY(message_begin);
+ break;
+ }
+
+ case s_res_H:
+ STRICT_CHECK(ch != 'T');
+ UPDATE_STATE(s_res_HT);
+ break;
+
+ case s_res_HT:
+ STRICT_CHECK(ch != 'T');
+ UPDATE_STATE(s_res_HTT);
+ break;
+
+ case s_res_HTT:
+ STRICT_CHECK(ch != 'P');
+ UPDATE_STATE(s_res_HTTP);
+ break;
+
+ case s_res_HTTP:
+ STRICT_CHECK(ch != '/');
+ UPDATE_STATE(s_res_first_http_major);
+ break;
+
+ case s_res_first_http_major:
+ if (UNLIKELY(ch < '0' || ch > '9')) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ parser->http_major = ch - '0';
+ UPDATE_STATE(s_res_http_major);
+ break;
+
+ /* major HTTP version or dot */
+ case s_res_http_major:
+ {
+ if (ch == '.') {
+ UPDATE_STATE(s_res_first_http_minor);
+ break;
+ }
+
+ if (!IS_NUM(ch)) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ parser->http_major *= 10;
+ parser->http_major += ch - '0';
+
+ if (UNLIKELY(parser->http_major > 999)) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ break;
+ }
+
+ /* first digit of minor HTTP version */
+ case s_res_first_http_minor:
+ if (UNLIKELY(!IS_NUM(ch))) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ parser->http_minor = ch - '0';
+ UPDATE_STATE(s_res_http_minor);
+ break;
+
+ /* minor HTTP version or end of request line */
+ case s_res_http_minor:
+ {
+ if (ch == ' ') {
+ UPDATE_STATE(s_res_first_status_code);
+ break;
+ }
+
+ if (UNLIKELY(!IS_NUM(ch))) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ parser->http_minor *= 10;
+ parser->http_minor += ch - '0';
+
+ if (UNLIKELY(parser->http_minor > 999)) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ break;
+ }
+
+ case s_res_first_status_code:
+ {
+ if (!IS_NUM(ch)) {
+ if (ch == ' ') {
+ break;
+ }
+
+ SET_ERRNO(HPE_INVALID_STATUS);
+ goto error;
+ }
+ parser->status_code = ch - '0';
+ UPDATE_STATE(s_res_status_code);
+ break;
+ }
+
+ case s_res_status_code:
+ {
+ if (!IS_NUM(ch)) {
+ switch (ch) {
+ case ' ':
+ UPDATE_STATE(s_res_status_start);
+ break;
+ case CR:
+ UPDATE_STATE(s_res_line_almost_done);
+ break;
+ case LF:
+ UPDATE_STATE(s_header_field_start);
+ break;
+ default:
+ SET_ERRNO(HPE_INVALID_STATUS);
+ goto error;
+ }
+ break;
+ }
+
+ parser->status_code *= 10;
+ parser->status_code += ch - '0';
+
+ if (UNLIKELY(parser->status_code > 999)) {
+ SET_ERRNO(HPE_INVALID_STATUS);
+ goto error;
+ }
+
+ break;
+ }
+
+ case s_res_status_start:
+ {
+ if (ch == CR) {
+ UPDATE_STATE(s_res_line_almost_done);
+ break;
+ }
+
+ if (ch == LF) {
+ UPDATE_STATE(s_header_field_start);
+ break;
+ }
+
+ MARK(status);
+ UPDATE_STATE(s_res_status);
+ parser->index = 0;
+ break;
+ }
+
+ case s_res_status:
+ if (ch == CR) {
+ UPDATE_STATE(s_res_line_almost_done);
+ CALLBACK_DATA(status);
+ break;
+ }
+
+ if (ch == LF) {
+ UPDATE_STATE(s_header_field_start);
+ CALLBACK_DATA(status);
+ break;
+ }
+
+ break;
+
+ case s_res_line_almost_done:
+ STRICT_CHECK(ch != LF);
+ UPDATE_STATE(s_header_field_start);
+ break;
+
+ case s_start_req:
+ {
+ if (ch == CR || ch == LF)
+ break;
+ parser->flags = 0;
+ parser->content_length = ULLONG_MAX;
+
+ if (UNLIKELY(!IS_ALPHA(ch))) {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+
+ parser->method = (enum http_method) 0;
+ parser->index = 1;
+ switch (ch) {
+ case 'C': parser->method = HTTP_CONNECT; /* or COPY, CHECKOUT */ break;
+ case 'D': parser->method = HTTP_DELETE; break;
+ case 'G': parser->method = HTTP_GET; break;
+ case 'H': parser->method = HTTP_HEAD; break;
+ case 'L': parser->method = HTTP_LOCK; break;
+ case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH, MKCALENDAR */ break;
+ case 'N': parser->method = HTTP_NOTIFY; break;
+ case 'O': parser->method = HTTP_OPTIONS; break;
+ case 'P': parser->method = HTTP_POST;
+ /* or PROPFIND|PROPPATCH|PUT|PATCH|PURGE */
+ break;
+ case 'R': parser->method = HTTP_REPORT; break;
+ case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH */ break;
+ case 'T': parser->method = HTTP_TRACE; break;
+ case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE */ break;
+ default:
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+ UPDATE_STATE(s_req_method);
+
+ CALLBACK_NOTIFY(message_begin);
+
+ break;
+ }
+
+ case s_req_method:
+ {
+ const char *matcher;
+ if (UNLIKELY(ch == '\0')) {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+
+ matcher = method_strings[parser->method];
+ if (ch == ' ' && matcher[parser->index] == '\0') {
+ UPDATE_STATE(s_req_spaces_before_url);
+ } else if (ch == matcher[parser->index]) {
+ ; /* nada */
+ } else if (parser->method == HTTP_CONNECT) {
+ if (parser->index == 1 && ch == 'H') {
+ parser->method = HTTP_CHECKOUT;
+ } else if (parser->index == 2 && ch == 'P') {
+ parser->method = HTTP_COPY;
+ } else {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+ } else if (parser->method == HTTP_MKCOL) {
+ if (parser->index == 1 && ch == 'O') {
+ parser->method = HTTP_MOVE;
+ } else if (parser->index == 1 && ch == 'E') {
+ parser->method = HTTP_MERGE;
+ } else if (parser->index == 1 && ch == '-') {
+ parser->method = HTTP_MSEARCH;
+ } else if (parser->index == 2 && ch == 'A') {
+ parser->method = HTTP_MKACTIVITY;
+ } else if (parser->index == 3 && ch == 'A') {
+ parser->method = HTTP_MKCALENDAR;
+ } else {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+ } else if (parser->method == HTTP_SUBSCRIBE) {
+ if (parser->index == 1 && ch == 'E') {
+ parser->method = HTTP_SEARCH;
+ } else {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+ } else if (parser->index == 1 && parser->method == HTTP_POST) {
+ if (ch == 'R') {
+ parser->method = HTTP_PROPFIND; /* or HTTP_PROPPATCH */
+ } else if (ch == 'U') {
+ parser->method = HTTP_PUT; /* or HTTP_PURGE */
+ } else if (ch == 'A') {
+ parser->method = HTTP_PATCH;
+ } else {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+ } else if (parser->index == 2) {
+ if (parser->method == HTTP_PUT) {
+ if (ch == 'R') {
+ parser->method = HTTP_PURGE;
+ } else {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+ } else if (parser->method == HTTP_UNLOCK) {
+ if (ch == 'S') {
+ parser->method = HTTP_UNSUBSCRIBE;
+ } else {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+ } else {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+ } else if (parser->index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') {
+ parser->method = HTTP_PROPPATCH;
+ } else {
+ SET_ERRNO(HPE_INVALID_METHOD);
+ goto error;
+ }
+
+ ++parser->index;
+ break;
+ }
+
+ case s_req_spaces_before_url:
+ {
+ if (ch == ' ') break;
+
+ MARK(url);
+ if (parser->method == HTTP_CONNECT) {
+ UPDATE_STATE(s_req_server_start);
+ }
+
+ UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch));
+ if (UNLIKELY(CURRENT_STATE() == s_dead)) {
+ SET_ERRNO(HPE_INVALID_URL);
+ goto error;
+ }
+
+ break;
+ }
+
+ case s_req_schema:
+ case s_req_schema_slash:
+ case s_req_schema_slash_slash:
+ case s_req_server_start:
+ {
+ switch (ch) {
+ /* No whitespace allowed here */
+ case ' ':
+ case CR:
+ case LF:
+ SET_ERRNO(HPE_INVALID_URL);
+ goto error;
+ default:
+ UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch));
+ if (UNLIKELY(CURRENT_STATE() == s_dead)) {
+ SET_ERRNO(HPE_INVALID_URL);
+ goto error;
+ }
+ }
+
+ break;
+ }
+
+ case s_req_server:
+ case s_req_server_with_at:
+ case s_req_path:
+ case s_req_query_string_start:
+ case s_req_query_string:
+ case s_req_fragment_start:
+ case s_req_fragment:
+ {
+ switch (ch) {
+ case ' ':
+ UPDATE_STATE(s_req_http_start);
+ CALLBACK_DATA(url);
+ break;
+ case CR:
+ case LF:
+ parser->http_major = 0;
+ parser->http_minor = 9;
+ UPDATE_STATE((ch == CR) ?
+ s_req_line_almost_done :
+ s_header_field_start);
+ CALLBACK_DATA(url);
+ break;
+ default:
+ UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch));
+ if (UNLIKELY(CURRENT_STATE() == s_dead)) {
+ SET_ERRNO(HPE_INVALID_URL);
+ goto error;
+ }
+ }
+ break;
+ }
+
+ case s_req_http_start:
+ switch (ch) {
+ case 'H':
+ UPDATE_STATE(s_req_http_H);
+ break;
+ case ' ':
+ break;
+ default:
+ SET_ERRNO(HPE_INVALID_CONSTANT);
+ goto error;
+ }
+ break;
+
+ case s_req_http_H:
+ STRICT_CHECK(ch != 'T');
+ UPDATE_STATE(s_req_http_HT);
+ break;
+
+ case s_req_http_HT:
+ STRICT_CHECK(ch != 'T');
+ UPDATE_STATE(s_req_http_HTT);
+ break;
+
+ case s_req_http_HTT:
+ STRICT_CHECK(ch != 'P');
+ UPDATE_STATE(s_req_http_HTTP);
+ break;
+
+ case s_req_http_HTTP:
+ STRICT_CHECK(ch != '/');
+ UPDATE_STATE(s_req_first_http_major);
+ break;
+
+ /* first digit of major HTTP version */
+ case s_req_first_http_major:
+ if (UNLIKELY(ch < '1' || ch > '9')) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ parser->http_major = ch - '0';
+ UPDATE_STATE(s_req_http_major);
+ break;
+
+ /* major HTTP version or dot */
+ case s_req_http_major:
+ {
+ if (ch == '.') {
+ UPDATE_STATE(s_req_first_http_minor);
+ break;
+ }
+
+ if (UNLIKELY(!IS_NUM(ch))) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ parser->http_major *= 10;
+ parser->http_major += ch - '0';
+
+ if (UNLIKELY(parser->http_major > 999)) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ break;
+ }
+
+ /* first digit of minor HTTP version */
+ case s_req_first_http_minor:
+ if (UNLIKELY(!IS_NUM(ch))) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ parser->http_minor = ch - '0';
+ UPDATE_STATE(s_req_http_minor);
+ break;
+
+ /* minor HTTP version or end of request line */
+ case s_req_http_minor:
+ {
+ if (ch == CR) {
+ UPDATE_STATE(s_req_line_almost_done);
+ break;
+ }
+
+ if (ch == LF) {
+ UPDATE_STATE(s_header_field_start);
+ break;
+ }
+
+ /* XXX allow spaces after digit? */
+
+ if (UNLIKELY(!IS_NUM(ch))) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ parser->http_minor *= 10;
+ parser->http_minor += ch - '0';
+
+ if (UNLIKELY(parser->http_minor > 999)) {
+ SET_ERRNO(HPE_INVALID_VERSION);
+ goto error;
+ }
+
+ break;
+ }
+
+ /* end of request line */
+ case s_req_line_almost_done:
+ {
+ if (UNLIKELY(ch != LF)) {
+ SET_ERRNO(HPE_LF_EXPECTED);
+ goto error;
+ }
+
+ UPDATE_STATE(s_header_field_start);
+ break;
+ }
+
+ case s_header_field_start:
+ {
+ if (ch == CR) {
+ UPDATE_STATE(s_headers_almost_done);
+ break;
+ }
+
+ if (ch == LF) {
+ /* they might be just sending \n instead of \r\n so this would be
+ * the second \n to denote the end of headers*/
+ UPDATE_STATE(s_headers_almost_done);
+ REEXECUTE();
+ }
+
+ c = TOKEN(ch);
+
+ if (UNLIKELY(!c)) {
+ SET_ERRNO(HPE_INVALID_HEADER_TOKEN);
+ goto error;
+ }
+
+ MARK(header_field);
+
+ parser->index = 0;
+ UPDATE_STATE(s_header_field);
+
+ switch (c) {
+ case 'c':
+ parser->header_state = h_C;
+ break;
+
+ case 'p':
+ parser->header_state = h_matching_proxy_connection;
+ break;
+
+ case 't':
+ parser->header_state = h_matching_transfer_encoding;
+ break;
+
+ case 'u':
+ parser->header_state = h_matching_upgrade;
+ break;
+
+ default:
+ parser->header_state = h_general;
+ break;
+ }
+ break;
+ }
+
+ case s_header_field:
+ {
+ const char* start = p;
+ for (; p != data + len; p++) {
+ ch = *p;
+ c = TOKEN(ch);
+
+ if (!c)
+ break;
+
+ switch (parser->header_state) {
+ case h_general:
+ break;
+
+ case h_C:
+ parser->index++;
+ parser->header_state = (c == 'o' ? h_CO : h_general);
+ break;
+
+ case h_CO:
+ parser->index++;
+ parser->header_state = (c == 'n' ? h_CON : h_general);
+ break;
+
+ case h_CON:
+ parser->index++;
+ switch (c) {
+ case 'n':
+ parser->header_state = h_matching_connection;
+ break;
+ case 't':
+ parser->header_state = h_matching_content_length;
+ break;
+ default:
+ parser->header_state = h_general;
+ break;
+ }
+ break;
+
+ /* connection */
+
+ case h_matching_connection:
+ parser->index++;
+ if (parser->index > sizeof(CONNECTION)-1
+ || c != CONNECTION[parser->index]) {
+ parser->header_state = h_general;
+ } else if (parser->index == sizeof(CONNECTION)-2) {
+ parser->header_state = h_connection;
+ }
+ break;
+
+ /* proxy-connection */
+
+ case h_matching_proxy_connection:
+ parser->index++;
+ if (parser->index > sizeof(PROXY_CONNECTION)-1
+ || c != PROXY_CONNECTION[parser->index]) {
+ parser->header_state = h_general;
+ } else if (parser->index == sizeof(PROXY_CONNECTION)-2) {
+ parser->header_state = h_connection;
+ }
+ break;
+
+ /* content-length */
+
+ case h_matching_content_length:
+ parser->index++;
+ if (parser->index > sizeof(CONTENT_LENGTH)-1
+ || c != CONTENT_LENGTH[parser->index]) {
+ parser->header_state = h_general;
+ } else if (parser->index == sizeof(CONTENT_LENGTH)-2) {
+ parser->header_state = h_content_length;
+ }
+ break;
+
+ /* transfer-encoding */
+
+ case h_matching_transfer_encoding:
+ parser->index++;
+ if (parser->index > sizeof(TRANSFER_ENCODING)-1
+ || c != TRANSFER_ENCODING[parser->index]) {
+ parser->header_state = h_general;
+ } else if (parser->index == sizeof(TRANSFER_ENCODING)-2) {
+ parser->header_state = h_transfer_encoding;
+ }
+ break;
+
+ /* upgrade */
+
+ case h_matching_upgrade:
+ parser->index++;
+ if (parser->index > sizeof(UPGRADE)-1
+ || c != UPGRADE[parser->index]) {
+ parser->header_state = h_general;
+ } else if (parser->index == sizeof(UPGRADE)-2) {
+ parser->header_state = h_upgrade;
+ }
+ break;
+
+ case h_connection:
+ case h_content_length:
+ case h_transfer_encoding:
+ case h_upgrade:
+ if (ch != ' ') parser->header_state = h_general;
+ break;
+
+ default:
+ assert(0 && "Unknown header_state");
+ break;
+ }
+ }
+
+ COUNT_HEADER_SIZE(p - start);
+
+ if (p == data + len) {
+ --p;
+ break;
+ }
+
+ if (ch == ':') {
+ UPDATE_STATE(s_header_value_discard_ws);
+ CALLBACK_DATA(header_field);
+ break;
+ }
+
+ SET_ERRNO(HPE_INVALID_HEADER_TOKEN);
+ goto error;
+ }
+
+ case s_header_value_discard_ws:
+ if (ch == ' ' || ch == '\t') break;
+
+ if (ch == CR) {
+ UPDATE_STATE(s_header_value_discard_ws_almost_done);
+ break;
+ }
+
+ if (ch == LF) {
+ UPDATE_STATE(s_header_value_discard_lws);
+ break;
+ }
+
+ /* FALLTHROUGH */
+
+ case s_header_value_start:
+ {
+ MARK(header_value);
+
+ UPDATE_STATE(s_header_value);
+ parser->index = 0;
+
+ c = LOWER(ch);
+
+ switch (parser->header_state) {
+ case h_upgrade:
+ parser->flags |= F_UPGRADE;
+ parser->header_state = h_general;
+ break;
+
+ case h_transfer_encoding:
+ /* looking for 'Transfer-Encoding: chunked' */
+ if ('c' == c) {
+ parser->header_state = h_matching_transfer_encoding_chunked;
+ } else {
+ parser->header_state = h_general;
+ }
+ break;
+
+ case h_content_length:
+ if (UNLIKELY(!IS_NUM(ch))) {
+ SET_ERRNO(HPE_INVALID_CONTENT_LENGTH);
+ goto error;
+ }
+
+ parser->content_length = ch - '0';
+ break;
+
+ case h_connection:
+ /* looking for 'Connection: keep-alive' */
+ if (c == 'k') {
+ parser->header_state = h_matching_connection_keep_alive;
+ /* looking for 'Connection: close' */
+ } else if (c == 'c') {
+ parser->header_state = h_matching_connection_close;
+ } else if (c == 'u') {
+ parser->header_state = h_matching_connection_upgrade;
+ } else {
+ parser->header_state = h_matching_connection_token;
+ }
+ break;
+
+ /* Multi-value `Connection` header */
+ case h_matching_connection_token_start:
+ break;
+
+ default:
+ parser->header_state = h_general;
+ break;
+ }
+ break;
+ }
+
+ case s_header_value:
+ {
+ const char* start = p;
+ enum header_states h_state = (enum header_states) parser->header_state;
+ for (; p != data + len; p++) {
+ ch = *p;
+ if (ch == CR) {
+ UPDATE_STATE(s_header_almost_done);
+ parser->header_state = h_state;
+ CALLBACK_DATA(header_value);
+ break;
+ }
+
+ if (ch == LF) {
+ UPDATE_STATE(s_header_almost_done);
+ COUNT_HEADER_SIZE(p - start);
+ parser->header_state = h_state;
+ CALLBACK_DATA_NOADVANCE(header_value);
+ REEXECUTE();
+ }
+
+ c = LOWER(ch);
+
+ switch (h_state) {
+ case h_general:
+ {
+ const char* p_cr;
+ const char* p_lf;
+ size_t limit = data + len - p;
+
+ limit = MIN(limit, HTTP_MAX_HEADER_SIZE);
+
+ p_cr = (const char*) memchr(p, CR, limit);
+ p_lf = (const char*) memchr(p, LF, limit);
+ if (p_cr != NULL) {
+ if (p_lf != NULL && p_cr >= p_lf)
+ p = p_lf;
+ else
+ p = p_cr;
+ } else if (UNLIKELY(p_lf != NULL)) {
+ p = p_lf;
+ } else {
+ p = data + len;
+ }
+ --p;
+
+ break;
+ }
+
+ case h_connection:
+ case h_transfer_encoding:
+ assert(0 && "Shouldn't get here.");
+ break;
+
+ case h_content_length:
+ {
+ uint64_t t;
+
+ if (ch == ' ') break;
+
+ if (UNLIKELY(!IS_NUM(ch))) {
+ SET_ERRNO(HPE_INVALID_CONTENT_LENGTH);
+ parser->header_state = h_state;
+ goto error;
+ }
+
+ t = parser->content_length;
+ t *= 10;
+ t += ch - '0';
+
+ /* Overflow? Test against a conservative limit for simplicity. */
+ if (UNLIKELY((ULLONG_MAX - 10) / 10 < parser->content_length)) {
+ SET_ERRNO(HPE_INVALID_CONTENT_LENGTH);
+ parser->header_state = h_state;
+ goto error;
+ }
+
+ parser->content_length = t;
+ break;
+ }
+
+ /* Transfer-Encoding: chunked */
+ case h_matching_transfer_encoding_chunked:
+ parser->index++;
+ if (parser->index > sizeof(CHUNKED)-1
+ || c != CHUNKED[parser->index]) {
+ h_state = h_general;
+ } else if (parser->index == sizeof(CHUNKED)-2) {
+ h_state = h_transfer_encoding_chunked;
+ }
+ break;
+
+ case h_matching_connection_token_start:
+ /* looking for 'Connection: keep-alive' */
+ if (c == 'k') {
+ h_state = h_matching_connection_keep_alive;
+ /* looking for 'Connection: close' */
+ } else if (c == 'c') {
+ h_state = h_matching_connection_close;
+ } else if (c == 'u') {
+ h_state = h_matching_connection_upgrade;
+ } else if (STRICT_TOKEN(c)) {
+ h_state = h_matching_connection_token;
+ } else if (c == ' ' || c == '\t') {
+ /* Skip lws */
+ } else {
+ h_state = h_general;
+ }
+ break;
+
+ /* looking for 'Connection: keep-alive' */
+ case h_matching_connection_keep_alive:
+ parser->index++;
+ if (parser->index > sizeof(KEEP_ALIVE)-1
+ || c != KEEP_ALIVE[parser->index]) {
+ h_state = h_matching_connection_token;
+ } else if (parser->index == sizeof(KEEP_ALIVE)-2) {
+ h_state = h_connection_keep_alive;
+ }
+ break;
+
+ /* looking for 'Connection: close' */
+ case h_matching_connection_close:
+ parser->index++;
+ if (parser->index > sizeof(CLOSE)-1 || c != CLOSE[parser->index]) {
+ h_state = h_matching_connection_token;
+ } else if (parser->index == sizeof(CLOSE)-2) {
+ h_state = h_connection_close;
+ }
+ break;
+
+ /* looking for 'Connection: upgrade' */
+ case h_matching_connection_upgrade:
+ parser->index++;
+ if (parser->index > sizeof(UPGRADE) - 1 ||
+ c != UPGRADE[parser->index]) {
+ h_state = h_matching_connection_token;
+ } else if (parser->index == sizeof(UPGRADE)-2) {
+ h_state = h_connection_upgrade;
+ }
+ break;
+
+ case h_matching_connection_token:
+ if (ch == ',') {
+ h_state = h_matching_connection_token_start;
+ parser->index = 0;
+ }
+ break;
+
+ case h_transfer_encoding_chunked:
+ if (ch != ' ') h_state = h_general;
+ break;
+
+ case h_connection_keep_alive:
+ case h_connection_close:
+ case h_connection_upgrade:
+ if (ch == ',') {
+ if (h_state == h_connection_keep_alive) {
+ parser->flags |= F_CONNECTION_KEEP_ALIVE;
+ } else if (h_state == h_connection_close) {
+ parser->flags |= F_CONNECTION_CLOSE;
+ } else if (h_state == h_connection_upgrade) {
+ parser->flags |= F_CONNECTION_UPGRADE;
+ }
+ h_state = h_matching_connection_token_start;
+ parser->index = 0;
+ } else if (ch != ' ') {
+ h_state = h_matching_connection_token;
+ }
+ break;
+
+ default:
+ UPDATE_STATE(s_header_value);
+ h_state = h_general;
+ break;
+ }
+ }
+ parser->header_state = h_state;
+
+ COUNT_HEADER_SIZE(p - start);
+
+ if (p == data + len)
+ --p;
+ break;
+ }
+
+ case s_header_almost_done:
+ {
+ STRICT_CHECK(ch != LF);
+
+ UPDATE_STATE(s_header_value_lws);
+ break;
+ }
+
+ case s_header_value_lws:
+ {
+ if (ch == ' ' || ch == '\t') {
+ UPDATE_STATE(s_header_value_start);
+ REEXECUTE();
+ }
+
+ /* finished the header */
+ switch (parser->header_state) {
+ case h_connection_keep_alive:
+ parser->flags |= F_CONNECTION_KEEP_ALIVE;
+ break;
+ case h_connection_close:
+ parser->flags |= F_CONNECTION_CLOSE;
+ break;
+ case h_transfer_encoding_chunked:
+ parser->flags |= F_CHUNKED;
+ break;
+ case h_connection_upgrade:
+ parser->flags |= F_CONNECTION_UPGRADE;
+ break;
+ default:
+ break;
+ }
+
+ UPDATE_STATE(s_header_field_start);
+ REEXECUTE();
+ }
+
+ case s_header_value_discard_ws_almost_done:
+ {
+ STRICT_CHECK(ch != LF);
+ UPDATE_STATE(s_header_value_discard_lws);
+ break;
+ }
+
+ case s_header_value_discard_lws:
+ {
+ if (ch == ' ' || ch == '\t') {
+ UPDATE_STATE(s_header_value_discard_ws);
+ break;
+ } else {
+ switch (parser->header_state) {
+ case h_connection_keep_alive:
+ parser->flags |= F_CONNECTION_KEEP_ALIVE;
+ break;
+ case h_connection_close:
+ parser->flags |= F_CONNECTION_CLOSE;
+ break;
+ case h_connection_upgrade:
+ parser->flags |= F_CONNECTION_UPGRADE;
+ break;
+ case h_transfer_encoding_chunked:
+ parser->flags |= F_CHUNKED;
+ break;
+ default:
+ break;
+ }
+
+ /* header value was empty */
+ MARK(header_value);
+ UPDATE_STATE(s_header_field_start);
+ CALLBACK_DATA_NOADVANCE(header_value);
+ REEXECUTE();
+ }
+ }
+
+ case s_headers_almost_done:
+ {
+ STRICT_CHECK(ch != LF);
+
+ if (parser->flags & F_TRAILING) {
+ /* End of a chunked request */
+ UPDATE_STATE(s_message_done);
+ CALLBACK_NOTIFY_NOADVANCE(chunk_complete);
+ REEXECUTE();
+ }
+
+ UPDATE_STATE(s_headers_done);
+
+ /* Set this here so that on_headers_complete() callbacks can see it */
+ parser->upgrade =
+ ((parser->flags & (F_UPGRADE | F_CONNECTION_UPGRADE)) ==
+ (F_UPGRADE | F_CONNECTION_UPGRADE) ||
+ parser->method == HTTP_CONNECT);
+
+ /* Here we call the headers_complete callback. This is somewhat
+ * different than other callbacks because if the user returns 1, we
+ * will interpret that as saying that this message has no body. This
+ * is needed for the annoying case of recieving a response to a HEAD
+ * request.
+ *
+ * We'd like to use CALLBACK_NOTIFY_NOADVANCE() here but we cannot, so
+ * we have to simulate it by handling a change in errno below.
+ */
+ if (settings->on_headers_complete) {
+ switch (settings->on_headers_complete(parser)) {
+ case 0:
+ break;
+
+ case 1:
+ parser->flags |= F_SKIPBODY;
+ break;
+
+ default:
+ SET_ERRNO(HPE_CB_headers_complete);
+ RETURN(p - data); /* Error */
+ }
+ }
+
+ if (HTTP_PARSER_ERRNO(parser) != HPE_OK) {
+ RETURN(p - data);
+ }
+
+ REEXECUTE();
+ }
+
+ case s_headers_done:
+ {
+ STRICT_CHECK(ch != LF);
+
+ parser->nread = 0;
+
+ int hasBody = parser->flags & F_CHUNKED ||
+ (parser->content_length > 0 && parser->content_length != ULLONG_MAX);
+ if (parser->upgrade && (parser->method == HTTP_CONNECT ||
+ (parser->flags & F_SKIPBODY) || !hasBody)) {
+ /* Exit, the rest of the message is in a different protocol. */
+ UPDATE_STATE(NEW_MESSAGE());
+ CALLBACK_NOTIFY(message_complete);
+ RETURN((p - data) + 1);
+ }
+
+ if (parser->flags & F_SKIPBODY) {
+ UPDATE_STATE(NEW_MESSAGE());
+ CALLBACK_NOTIFY(message_complete);
+ } else if (parser->flags & F_CHUNKED) {
+ /* chunked encoding - ignore Content-Length header */
+ UPDATE_STATE(s_chunk_size_start);
+ } else {
+ if (parser->content_length == 0) {
+ /* Content-Length header given but zero: Content-Length: 0\r\n */
+ UPDATE_STATE(NEW_MESSAGE());
+ CALLBACK_NOTIFY(message_complete);
+ } else if (parser->content_length != ULLONG_MAX) {
+ /* Content-Length header given and non-zero */
+ UPDATE_STATE(s_body_identity);
+ } else {
+ if (parser->type == HTTP_REQUEST ||
+ !http_message_needs_eof(parser)) {
+ /* Assume content-length 0 - read the next */
+ UPDATE_STATE(NEW_MESSAGE());
+ CALLBACK_NOTIFY(message_complete);
+ } else {
+ /* Read body until EOF */
+ UPDATE_STATE(s_body_identity_eof);
+ }
+ }
+ }
+
+ break;
+ }
+
+ case s_body_identity:
+ {
+ uint64_t to_read = MIN(parser->content_length,
+ (uint64_t) ((data + len) - p));
+
+ assert(parser->content_length != 0
+ && parser->content_length != ULLONG_MAX);
+
+ /* The difference between advancing content_length and p is because
+ * the latter will automaticaly advance on the next loop iteration.
+ * Further, if content_length ends up at 0, we want to see the last
+ * byte again for our message complete callback.
+ */
+ MARK(body);
+ parser->content_length -= to_read;
+ p += to_read - 1;
+
+ if (parser->content_length == 0) {
+ UPDATE_STATE(s_message_done);
+
+ /* Mimic CALLBACK_DATA_NOADVANCE() but with one extra byte.
+ *
+ * The alternative to doing this is to wait for the next byte to
+ * trigger the data callback, just as in every other case. The
+ * problem with this is that this makes it difficult for the test
+ * harness to distinguish between complete-on-EOF and
+ * complete-on-length. It's not clear that this distinction is
+ * important for applications, but let's keep it for now.
+ */
+ CALLBACK_DATA_(body, p - body_mark + 1, p - data);
+ REEXECUTE();
+ }
+
+ break;
+ }
+
+ /* read until EOF */
+ case s_body_identity_eof:
+ MARK(body);
+ p = data + len - 1;
+
+ break;
+
+ case s_message_done:
+ UPDATE_STATE(NEW_MESSAGE());
+ CALLBACK_NOTIFY(message_complete);
+ if (parser->upgrade) {
+ /* Exit, the rest of the message is in a different protocol. */
+ RETURN((p - data) + 1);
+ }
+ break;
+
+ case s_chunk_size_start:
+ {
+ assert(parser->nread == 1);
+ assert(parser->flags & F_CHUNKED);
+
+ unhex_val = unhex[(unsigned char)ch];
+ if (UNLIKELY(unhex_val == -1)) {
+ SET_ERRNO(HPE_INVALID_CHUNK_SIZE);
+ goto error;
+ }
+
+ parser->content_length = unhex_val;
+ UPDATE_STATE(s_chunk_size);
+ break;
+ }
+
+ case s_chunk_size:
+ {
+ uint64_t t;
+
+ assert(parser->flags & F_CHUNKED);
+
+ if (ch == CR) {
+ UPDATE_STATE(s_chunk_size_almost_done);
+ break;
+ }
+
+ unhex_val = unhex[(unsigned char)ch];
+
+ if (unhex_val == -1) {
+ if (ch == ';' || ch == ' ') {
+ UPDATE_STATE(s_chunk_parameters);
+ break;
+ }
+
+ SET_ERRNO(HPE_INVALID_CHUNK_SIZE);
+ goto error;
+ }
+
+ t = parser->content_length;
+ t *= 16;
+ t += unhex_val;
+
+ /* Overflow? Test against a conservative limit for simplicity. */
+ if (UNLIKELY((ULLONG_MAX - 16) / 16 < parser->content_length)) {
+ SET_ERRNO(HPE_INVALID_CONTENT_LENGTH);
+ goto error;
+ }
+
+ parser->content_length = t;
+ break;
+ }
+
+ case s_chunk_parameters:
+ {
+ assert(parser->flags & F_CHUNKED);
+ /* just ignore this shit. TODO check for overflow */
+ if (ch == CR) {
+ UPDATE_STATE(s_chunk_size_almost_done);
+ break;
+ }
+ break;
+ }
+
+ case s_chunk_size_almost_done:
+ {
+ assert(parser->flags & F_CHUNKED);
+ STRICT_CHECK(ch != LF);
+
+ parser->nread = 0;
+
+ if (parser->content_length == 0) {
+ parser->flags |= F_TRAILING;
+ UPDATE_STATE(s_header_field_start);
+ } else {
+ UPDATE_STATE(s_chunk_data);
+ }
+ CALLBACK_NOTIFY(chunk_header);
+ break;
+ }
+
+ case s_chunk_data:
+ {
+ uint64_t to_read = MIN(parser->content_length,
+ (uint64_t) ((data + len) - p));
+
+ assert(parser->flags & F_CHUNKED);
+ assert(parser->content_length != 0
+ && parser->content_length != ULLONG_MAX);
+
+ /* See the explanation in s_body_identity for why the content
+ * length and data pointers are managed this way.
+ */
+ MARK(body);
+ parser->content_length -= to_read;
+ p += to_read - 1;
+
+ if (parser->content_length == 0) {
+ UPDATE_STATE(s_chunk_data_almost_done);
+ }
+
+ break;
+ }
+
+ case s_chunk_data_almost_done:
+ assert(parser->flags & F_CHUNKED);
+ assert(parser->content_length == 0);
+ STRICT_CHECK(ch != CR);
+ UPDATE_STATE(s_chunk_data_done);
+ CALLBACK_DATA(body);
+ break;
+
+ case s_chunk_data_done:
+ assert(parser->flags & F_CHUNKED);
+ STRICT_CHECK(ch != LF);
+ parser->nread = 0;
+ UPDATE_STATE(s_chunk_size_start);
+ CALLBACK_NOTIFY(chunk_complete);
+ break;
+
+ default:
+ assert(0 && "unhandled state");
+ SET_ERRNO(HPE_INVALID_INTERNAL_STATE);
+ goto error;
+ }
+ }
+
+ /* Run callbacks for any marks that we have leftover after we ran our of
+ * bytes. There should be at most one of these set, so it's OK to invoke
+ * them in series (unset marks will not result in callbacks).
+ *
+ * We use the NOADVANCE() variety of callbacks here because 'p' has already
+ * overflowed 'data' and this allows us to correct for the off-by-one that
+ * we'd otherwise have (since CALLBACK_DATA() is meant to be run with a 'p'
+ * value that's in-bounds).
+ */
+
+ assert(((header_field_mark ? 1 : 0) +
+ (header_value_mark ? 1 : 0) +
+ (url_mark ? 1 : 0) +
+ (body_mark ? 1 : 0) +
+ (status_mark ? 1 : 0)) <= 1);
+
+ CALLBACK_DATA_NOADVANCE(header_field);
+ CALLBACK_DATA_NOADVANCE(header_value);
+ CALLBACK_DATA_NOADVANCE(url);
+ CALLBACK_DATA_NOADVANCE(body);
+ CALLBACK_DATA_NOADVANCE(status);
+
+ RETURN(len);
+
+error:
+ if (HTTP_PARSER_ERRNO(parser) == HPE_OK) {
+ SET_ERRNO(HPE_UNKNOWN);
+ }
+
+ RETURN(p - data);
+}
+
+
+/* Does the parser need to see an EOF to find the end of the message? */
+int
+http_message_needs_eof (const http_parser *parser)
+{
+ if (parser->type == HTTP_REQUEST) {
+ return 0;
+ }
+
+ /* See RFC 2616 section 4.4 */
+ if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */
+ parser->status_code == 204 || /* No Content */
+ parser->status_code == 304 || /* Not Modified */
+ parser->flags & F_SKIPBODY) { /* response to a HEAD request */
+ return 0;
+ }
+
+ if ((parser->flags & F_CHUNKED) || parser->content_length != ULLONG_MAX) {
+ return 0;
+ }
+
+ return 1;
+}
+
+
+int
+http_should_keep_alive (const http_parser *parser)
+{
+ if (parser->http_major > 0 && parser->http_minor > 0) {
+ /* HTTP/1.1 */
+ if (parser->flags & F_CONNECTION_CLOSE) {
+ return 0;
+ }
+ } else {
+ /* HTTP/1.0 or earlier */
+ if (!(parser->flags & F_CONNECTION_KEEP_ALIVE)) {
+ return 0;
+ }
+ }
+
+ return !http_message_needs_eof(parser);
+}
+
+
+const char *
+http_method_str (enum http_method m)
+{
+ return ELEM_AT(method_strings, m, "<unknown>");
+}
+
+
+void
+http_parser_init (http_parser *parser, enum http_parser_type t)
+{
+ void *data = parser->data; /* preserve application data */
+ memset(parser, 0, sizeof(*parser));
+ parser->data = data;
+ parser->type = t;
+ parser->state = (t == HTTP_REQUEST ? s_start_req : (t == HTTP_RESPONSE ? s_start_res : s_start_req_or_res));
+ parser->http_errno = HPE_OK;
+}
+
+void
+http_parser_settings_init(http_parser_settings *settings)
+{
+ memset(settings, 0, sizeof(*settings));
+}
+
+const char *
+http_errno_name(enum http_errno err) {
+ assert(((size_t) err) <
+ (sizeof(http_strerror_tab) / sizeof(http_strerror_tab[0])));
+ return http_strerror_tab[err].name;
+}
+
+const char *
+http_errno_description(enum http_errno err) {
+ assert(((size_t) err) <
+ (sizeof(http_strerror_tab) / sizeof(http_strerror_tab[0])));
+ return http_strerror_tab[err].description;
+}
+
+static enum http_host_state
+http_parse_host_char(enum http_host_state s, const char ch) {
+ switch(s) {
+ case s_http_userinfo:
+ case s_http_userinfo_start:
+ if (ch == '@') {
+ return s_http_host_start;
+ }
+
+ if (IS_USERINFO_CHAR(ch)) {
+ return s_http_userinfo;
+ }
+ break;
+
+ case s_http_host_start:
+ if (ch == '[') {
+ return s_http_host_v6_start;
+ }
+
+ if (IS_HOST_CHAR(ch)) {
+ return s_http_host;
+ }
+
+ break;
+
+ case s_http_host:
+ if (IS_HOST_CHAR(ch)) {
+ return s_http_host;
+ }
+
+ /* FALLTHROUGH */
+ case s_http_host_v6_end:
+ if (ch == ':') {
+ return s_http_host_port_start;
+ }
+
+ break;
+
+ case s_http_host_v6:
+ if (ch == ']') {
+ return s_http_host_v6_end;
+ }
+
+ /* FALLTHROUGH */
+ case s_http_host_v6_start:
+ if (IS_HEX(ch) || ch == ':' || ch == '.') {
+ return s_http_host_v6;
+ }
+
+ break;
+
+ case s_http_host_port:
+ case s_http_host_port_start:
+ if (IS_NUM(ch)) {
+ return s_http_host_port;
+ }
+
+ break;
+
+ default:
+ break;
+ }
+ return s_http_host_dead;
+}
+
+static int
+http_parse_host(const char * buf, struct http_parser_url *u, int found_at) {
+ enum http_host_state s;
+
+ const char *p;
+ size_t buflen = u->field_data[UF_HOST].off + u->field_data[UF_HOST].len;
+
+ u->field_data[UF_HOST].len = 0;
+
+ s = found_at ? s_http_userinfo_start : s_http_host_start;
+
+ for (p = buf + u->field_data[UF_HOST].off; p < buf + buflen; p++) {
+ enum http_host_state new_s = http_parse_host_char(s, *p);
+
+ if (new_s == s_http_host_dead) {
+ return 1;
+ }
+
+ switch(new_s) {
+ case s_http_host:
+ if (s != s_http_host) {
+ u->field_data[UF_HOST].off = p - buf;
+ }
+ u->field_data[UF_HOST].len++;
+ break;
+
+ case s_http_host_v6:
+ if (s != s_http_host_v6) {
+ u->field_data[UF_HOST].off = p - buf;
+ }
+ u->field_data[UF_HOST].len++;
+ break;
+
+ case s_http_host_port:
+ if (s != s_http_host_port) {
+ u->field_data[UF_PORT].off = p - buf;
+ u->field_data[UF_PORT].len = 0;
+ u->field_set |= (1 << UF_PORT);
+ }
+ u->field_data[UF_PORT].len++;
+ break;
+
+ case s_http_userinfo:
+ if (s != s_http_userinfo) {
+ u->field_data[UF_USERINFO].off = p - buf ;
+ u->field_data[UF_USERINFO].len = 0;
+ u->field_set |= (1 << UF_USERINFO);
+ }
+ u->field_data[UF_USERINFO].len++;
+ break;
+
+ default:
+ break;
+ }
+ s = new_s;
+ }
+
+ /* Make sure we don't end somewhere unexpected */
+ switch (s) {
+ case s_http_host_start:
+ case s_http_host_v6_start:
+ case s_http_host_v6:
+ case s_http_host_port_start:
+ case s_http_userinfo:
+ case s_http_userinfo_start:
+ return 1;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+int
+http_parser_parse_url(const char *buf, size_t buflen, int is_connect,
+ struct http_parser_url *u)
+{
+ enum state s;
+ const char *p;
+ enum http_parser_url_fields uf, old_uf;
+ int found_at = 0;
+
+ u->port = u->field_set = 0;
+ s = is_connect ? s_req_server_start : s_req_spaces_before_url;
+ old_uf = UF_MAX;
+
+ for (p = buf; p < buf + buflen; p++) {
+ s = parse_url_char(s, *p);
+
+ /* Figure out the next field that we're operating on */
+ switch (s) {
+ case s_dead:
+ return 1;
+
+ /* Skip delimeters */
+ case s_req_schema_slash:
+ case s_req_schema_slash_slash:
+ case s_req_server_start:
+ case s_req_query_string_start:
+ case s_req_fragment_start:
+ continue;
+
+ case s_req_schema:
+ uf = UF_SCHEMA;
+ break;
+
+ case s_req_server_with_at:
+ found_at = 1;
+
+ /* FALLTROUGH */
+ case s_req_server:
+ uf = UF_HOST;
+ break;
+
+ case s_req_path:
+ uf = UF_PATH;
+ break;
+
+ case s_req_query_string:
+ uf = UF_QUERY;
+ break;
+
+ case s_req_fragment:
+ uf = UF_FRAGMENT;
+ break;
+
+ default:
+ assert(!"Unexpected state");
+ return 1;
+ }
+
+ /* Nothing's changed; soldier on */
+ if (uf == old_uf) {
+ u->field_data[uf].len++;
+ continue;
+ }
+
+ u->field_data[uf].off = p - buf;
+ u->field_data[uf].len = 1;
+
+ u->field_set |= (1 << uf);
+ old_uf = uf;
+ }
+
+ /* host must be present if there is a schema */
+ /* parsing http:///toto will fail */
+ if ((u->field_set & ((1 << UF_SCHEMA) | (1 << UF_HOST))) != 0) {
+ if (http_parse_host(buf, u, found_at) != 0) {
+ return 1;
+ }
+ }
+
+ /* CONNECT requests can only contain "hostname:port" */
+ if (is_connect && u->field_set != ((1 << UF_HOST)|(1 << UF_PORT))) {
+ return 1;
+ }
+
+ if (u->field_set & (1 << UF_PORT)) {
+ /* Don't bother with endp; we've already validated the string */
+ unsigned long v = strtoul(buf + u->field_data[UF_PORT].off, NULL, 10);
+
+ /* Ports have a max value of 2^16 */
+ if (v > 0xffff) {
+ return 1;
+ }
+
+ u->port = (uint16_t) v;
+ }
+
+ return 0;
+}
+
+void
+http_parser_pause(http_parser *parser, int paused) {
+ /* Users should only be pausing/unpausing a parser that is not in an error
+ * state. In non-debug builds, there's not much that we can do about this
+ * other than ignore it.
+ */
+ if (HTTP_PARSER_ERRNO(parser) == HPE_OK ||
+ HTTP_PARSER_ERRNO(parser) == HPE_PAUSED) {
+ SET_ERRNO((paused) ? HPE_PAUSED : HPE_OK);
+ } else {
+ assert(0 && "Attempting to pause parser in error state");
+ }
+}
+
+int
+http_body_is_final(const struct http_parser *parser) {
+ return parser->state == s_message_done;
+}
+
+unsigned long
+http_parser_version(void) {
+ return HTTP_PARSER_VERSION_MAJOR * 0x10000 |
+ HTTP_PARSER_VERSION_MINOR * 0x00100 |
+ HTTP_PARSER_VERSION_PATCH * 0x00001;
+}
diff --git a/3rdparty/http-parser/http_parser.gyp b/3rdparty/http-parser/http_parser.gyp
new file mode 100644
index 00000000000..ef34ecaeaea
--- /dev/null
+++ b/3rdparty/http-parser/http_parser.gyp
@@ -0,0 +1,111 @@
+# This file is used with the GYP meta build system.
+# http://code.google.com/p/gyp/
+# To build try this:
+# svn co http://gyp.googlecode.com/svn/trunk gyp
+# ./gyp/gyp -f make --depth=`pwd` http_parser.gyp
+# ./out/Debug/test
+{
+ 'target_defaults': {
+ 'default_configuration': 'Debug',
+ 'configurations': {
+ # TODO: hoist these out and put them somewhere common, because
+ # RuntimeLibrary MUST MATCH across the entire project
+ 'Debug': {
+ 'defines': [ 'DEBUG', '_DEBUG' ],
+ 'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'RuntimeLibrary': 1, # static debug
+ },
+ },
+ },
+ 'Release': {
+ 'defines': [ 'NDEBUG' ],
+ 'cflags': [ '-Wall', '-Wextra', '-O3' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'RuntimeLibrary': 0, # static release
+ },
+ },
+ }
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ },
+ 'VCLibrarianTool': {
+ },
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ },
+ },
+ 'conditions': [
+ ['OS == "win"', {
+ 'defines': [
+ 'WIN32'
+ ],
+ }]
+ ],
+ },
+
+ 'targets': [
+ {
+ 'target_name': 'http_parser',
+ 'type': 'static_library',
+ 'include_dirs': [ '.' ],
+ 'direct_dependent_settings': {
+ 'defines': [ 'HTTP_PARSER_STRICT=0' ],
+ 'include_dirs': [ '.' ],
+ },
+ 'defines': [ 'HTTP_PARSER_STRICT=0' ],
+ 'sources': [ './http_parser.c', ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ # Compile as C++. http_parser.c is actually C99, but C++ is
+ # close enough in this case.
+ 'CompileAs': 2,
+ },
+ },
+ }]
+ ],
+ },
+
+ {
+ 'target_name': 'http_parser_strict',
+ 'type': 'static_library',
+ 'include_dirs': [ '.' ],
+ 'direct_dependent_settings': {
+ 'defines': [ 'HTTP_PARSER_STRICT=1' ],
+ 'include_dirs': [ '.' ],
+ },
+ 'defines': [ 'HTTP_PARSER_STRICT=1' ],
+ 'sources': [ './http_parser.c', ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ # Compile as C++. http_parser.c is actually C99, but C++ is
+ # close enough in this case.
+ 'CompileAs': 2,
+ },
+ },
+ }]
+ ],
+ },
+
+ {
+ 'target_name': 'test-nonstrict',
+ 'type': 'executable',
+ 'dependencies': [ 'http_parser' ],
+ 'sources': [ 'test.c' ]
+ },
+
+ {
+ 'target_name': 'test-strict',
+ 'type': 'executable',
+ 'dependencies': [ 'http_parser_strict' ],
+ 'sources': [ 'test.c' ]
+ }
+ ]
+}
diff --git a/3rdparty/http-parser/http_parser.h b/3rdparty/http-parser/http_parser.h
new file mode 100644
index 00000000000..eb71bf99219
--- /dev/null
+++ b/3rdparty/http-parser/http_parser.h
@@ -0,0 +1,342 @@
+/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+#ifndef http_parser_h
+#define http_parser_h
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Also update SONAME in the Makefile whenever you change these. */
+#define HTTP_PARSER_VERSION_MAJOR 2
+#define HTTP_PARSER_VERSION_MINOR 5
+#define HTTP_PARSER_VERSION_PATCH 0
+
+#include <sys/types.h>
+#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600)
+#include <BaseTsd.h>
+#include <stddef.h>
+typedef __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#else
+#include <stdint.h>
+#endif
+
+/* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run
+ * faster
+ */
+#ifndef HTTP_PARSER_STRICT
+# define HTTP_PARSER_STRICT 1
+#endif
+
+/* Maximium header size allowed. If the macro is not defined
+ * before including this header then the default is used. To
+ * change the maximum header size, define the macro in the build
+ * environment (e.g. -DHTTP_MAX_HEADER_SIZE=<value>). To remove
+ * the effective limit on the size of the header, define the macro
+ * to a very large number (e.g. -DHTTP_MAX_HEADER_SIZE=0x7fffffff)
+ */
+#ifndef HTTP_MAX_HEADER_SIZE
+# define HTTP_MAX_HEADER_SIZE (80*1024)
+#endif
+
+typedef struct http_parser http_parser;
+typedef struct http_parser_settings http_parser_settings;
+
+
+/* Callbacks should return non-zero to indicate an error. The parser will
+ * then halt execution.
+ *
+ * The one exception is on_headers_complete. In a HTTP_RESPONSE parser
+ * returning '1' from on_headers_complete will tell the parser that it
+ * should not expect a body. This is used when receiving a response to a
+ * HEAD request which may contain 'Content-Length' or 'Transfer-Encoding:
+ * chunked' headers that indicate the presence of a body.
+ *
+ * http_data_cb does not return data chunks. It will be called arbitrarily
+ * many times for each string. E.G. you might get 10 callbacks for "on_url"
+ * each providing just a few characters more data.
+ */
+typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);
+typedef int (*http_cb) (http_parser*);
+
+
+/* Request Methods */
+#define HTTP_METHOD_MAP(XX) \
+ XX(0, DELETE, DELETE) \
+ XX(1, GET, GET) \
+ XX(2, HEAD, HEAD) \
+ XX(3, POST, POST) \
+ XX(4, PUT, PUT) \
+ /* pathological */ \
+ XX(5, CONNECT, CONNECT) \
+ XX(6, OPTIONS, OPTIONS) \
+ XX(7, TRACE, TRACE) \
+ /* webdav */ \
+ XX(8, COPY, COPY) \
+ XX(9, LOCK, LOCK) \
+ XX(10, MKCOL, MKCOL) \
+ XX(11, MOVE, MOVE) \
+ XX(12, PROPFIND, PROPFIND) \
+ XX(13, PROPPATCH, PROPPATCH) \
+ XX(14, SEARCH, SEARCH) \
+ XX(15, UNLOCK, UNLOCK) \
+ /* subversion */ \
+ XX(16, REPORT, REPORT) \
+ XX(17, MKACTIVITY, MKACTIVITY) \
+ XX(18, CHECKOUT, CHECKOUT) \
+ XX(19, MERGE, MERGE) \
+ /* upnp */ \
+ XX(20, MSEARCH, M-SEARCH) \
+ XX(21, NOTIFY, NOTIFY) \
+ XX(22, SUBSCRIBE, SUBSCRIBE) \
+ XX(23, UNSUBSCRIBE, UNSUBSCRIBE) \
+ /* RFC-5789 */ \
+ XX(24, PATCH, PATCH) \
+ XX(25, PURGE, PURGE) \
+ /* CalDAV */ \
+ XX(26, MKCALENDAR, MKCALENDAR) \
+
+enum http_method
+ {
+#define XX(num, name, string) HTTP_##name = num,
+ HTTP_METHOD_MAP(XX)
+#undef XX
+ };
+
+
+enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH };
+
+
+/* Flag values for http_parser.flags field */
+enum flags
+ { F_CHUNKED = 1 << 0
+ , F_CONNECTION_KEEP_ALIVE = 1 << 1
+ , F_CONNECTION_CLOSE = 1 << 2
+ , F_CONNECTION_UPGRADE = 1 << 3
+ , F_TRAILING = 1 << 4
+ , F_UPGRADE = 1 << 5
+ , F_SKIPBODY = 1 << 6
+ };
+
+
+/* Map for errno-related constants
+ *
+ * The provided argument should be a macro that takes 2 arguments.
+ */
+#define HTTP_ERRNO_MAP(XX) \
+ /* No error */ \
+ XX(OK, "success") \
+ \
+ /* Callback-related errors */ \
+ XX(CB_message_begin, "the on_message_begin callback failed") \
+ XX(CB_url, "the on_url callback failed") \
+ XX(CB_header_field, "the on_header_field callback failed") \
+ XX(CB_header_value, "the on_header_value callback failed") \
+ XX(CB_headers_complete, "the on_headers_complete callback failed") \
+ XX(CB_body, "the on_body callback failed") \
+ XX(CB_message_complete, "the on_message_complete callback failed") \
+ XX(CB_status, "the on_status callback failed") \
+ XX(CB_chunk_header, "the on_chunk_header callback failed") \
+ XX(CB_chunk_complete, "the on_chunk_complete callback failed") \
+ \
+ /* Parsing-related errors */ \
+ XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \
+ XX(HEADER_OVERFLOW, \
+ "too many header bytes seen; overflow detected") \
+ XX(CLOSED_CONNECTION, \
+ "data received after completed connection: close message") \
+ XX(INVALID_VERSION, "invalid HTTP version") \
+ XX(INVALID_STATUS, "invalid HTTP status code") \
+ XX(INVALID_METHOD, "invalid HTTP method") \
+ XX(INVALID_URL, "invalid URL") \
+ XX(INVALID_HOST, "invalid host") \
+ XX(INVALID_PORT, "invalid port") \
+ XX(INVALID_PATH, "invalid path") \
+ XX(INVALID_QUERY_STRING, "invalid query string") \
+ XX(INVALID_FRAGMENT, "invalid fragment") \
+ XX(LF_EXPECTED, "LF character expected") \
+ XX(INVALID_HEADER_TOKEN, "invalid character in header") \
+ XX(INVALID_CONTENT_LENGTH, \
+ "invalid character in content-length header") \
+ XX(INVALID_CHUNK_SIZE, \
+ "invalid character in chunk size header") \
+ XX(INVALID_CONSTANT, "invalid constant string") \
+ XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\
+ XX(STRICT, "strict mode assertion failed") \
+ XX(PAUSED, "parser is paused") \
+ XX(UNKNOWN, "an unknown error occurred")
+
+
+/* Define HPE_* values for each errno value above */
+#define HTTP_ERRNO_GEN(n, s) HPE_##n,
+enum http_errno {
+ HTTP_ERRNO_MAP(HTTP_ERRNO_GEN)
+};
+#undef HTTP_ERRNO_GEN
+
+
+/* Get an http_errno value from an http_parser */
+#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno)
+
+
+struct http_parser {
+ /** PRIVATE **/
+ unsigned int type : 2; /* enum http_parser_type */
+ unsigned int flags : 7; /* F_* values from 'flags' enum; semi-public */
+ unsigned int state : 7; /* enum state from http_parser.c */
+ unsigned int header_state : 8; /* enum header_state from http_parser.c */
+ unsigned int index : 8; /* index into current matcher */
+
+ uint32_t nread; /* # bytes read in various scenarios */
+ uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */
+
+ /** READ-ONLY **/
+ unsigned short http_major;
+ unsigned short http_minor;
+ unsigned int status_code : 16; /* responses only */
+ unsigned int method : 8; /* requests only */
+ unsigned int http_errno : 7;
+
+ /* 1 = Upgrade header was present and the parser has exited because of that.
+ * 0 = No upgrade header present.
+ * Should be checked when http_parser_execute() returns in addition to
+ * error checking.
+ */
+ unsigned int upgrade : 1;
+
+ /** PUBLIC **/
+ void *data; /* A pointer to get hook to the "connection" or "socket" object */
+};
+
+
+struct http_parser_settings {
+ http_cb on_message_begin;
+ http_data_cb on_url;
+ http_data_cb on_status;
+ http_data_cb on_header_field;
+ http_data_cb on_header_value;
+ http_cb on_headers_complete;
+ http_data_cb on_body;
+ http_cb on_message_complete;
+ /* When on_chunk_header is called, the current chunk length is stored
+ * in parser->content_length.
+ */
+ http_cb on_chunk_header;
+ http_cb on_chunk_complete;
+};
+
+
+enum http_parser_url_fields
+ { UF_SCHEMA = 0
+ , UF_HOST = 1
+ , UF_PORT = 2
+ , UF_PATH = 3
+ , UF_QUERY = 4
+ , UF_FRAGMENT = 5
+ , UF_USERINFO = 6
+ , UF_MAX = 7
+ };
+
+
+/* Result structure for http_parser_parse_url().
+ *
+ * Callers should index into field_data[] with UF_* values iff field_set
+ * has the relevant (1 << UF_*) bit set. As a courtesy to clients (and
+ * because we probably have padding left over), we convert any port to
+ * a uint16_t.
+ */
+struct http_parser_url {
+ uint16_t field_set; /* Bitmask of (1 << UF_*) values */
+ uint16_t port; /* Converted UF_PORT string */
+
+ struct {
+ uint16_t off; /* Offset into buffer in which field starts */
+ uint16_t len; /* Length of run in buffer */
+ } field_data[UF_MAX];
+};
+
+
+/* Returns the library version. Bits 16-23 contain the major version number,
+ * bits 8-15 the minor version number and bits 0-7 the patch level.
+ * Usage example:
+ *
+ * unsigned long version = http_parser_version();
+ * unsigned major = (version >> 16) & 255;
+ * unsigned minor = (version >> 8) & 255;
+ * unsigned patch = version & 255;
+ * printf("http_parser v%u.%u.%u\n", major, minor, patch);
+ */
+unsigned long http_parser_version(void);
+
+void http_parser_init(http_parser *parser, enum http_parser_type type);
+
+
+/* Initialize http_parser_settings members to 0
+ */
+void http_parser_settings_init(http_parser_settings *settings);
+
+
+/* Executes the parser. Returns number of parsed bytes. Sets
+ * `parser->http_errno` on error. */
+size_t http_parser_execute(http_parser *parser,
+ const http_parser_settings *settings,
+ const char *data,
+ size_t len);
+
+
+/* If http_should_keep_alive() in the on_headers_complete or
+ * on_message_complete callback returns 0, then this should be
+ * the last message on the connection.
+ * If you are the server, respond with the "Connection: close" header.
+ * If you are the client, close the connection.
+ */
+int http_should_keep_alive(const http_parser *parser);
+
+/* Returns a string version of the HTTP method. */
+const char *http_method_str(enum http_method m);
+
+/* Return a string name of the given error */
+const char *http_errno_name(enum http_errno err);
+
+/* Return a string description of the given error */
+const char *http_errno_description(enum http_errno err);
+
+/* Parse a URL; return nonzero on failure */
+int http_parser_parse_url(const char *buf, size_t buflen,
+ int is_connect,
+ struct http_parser_url *u);
+
+/* Pause or un-pause the parser; a nonzero value pauses */
+void http_parser_pause(http_parser *parser, int paused);
+
+/* Checks if this is the final chunk of the body. */
+int http_body_is_final(const http_parser *parser);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/3rdparty/http-parser/test.c b/3rdparty/http-parser/test.c
new file mode 100644
index 00000000000..4c00571eba6
--- /dev/null
+++ b/3rdparty/http-parser/test.c
@@ -0,0 +1,3852 @@
+/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+#include "http_parser.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h> /* rand */
+#include <string.h>
+#include <stdarg.h>
+
+#if defined(__APPLE__)
+# undef strlcat
+# undef strlncpy
+# undef strlcpy
+#endif /* defined(__APPLE__) */
+
+#undef TRUE
+#define TRUE 1
+#undef FALSE
+#define FALSE 0
+
+#define MAX_HEADERS 13
+#define MAX_ELEMENT_SIZE 2048
+#define MAX_CHUNKS 16
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+static http_parser *parser;
+
+struct message {
+ const char *name; // for debugging purposes
+ const char *raw;
+ enum http_parser_type type;
+ enum http_method method;
+ int status_code;
+ char response_status[MAX_ELEMENT_SIZE];
+ char request_path[MAX_ELEMENT_SIZE];
+ char request_url[MAX_ELEMENT_SIZE];
+ char fragment[MAX_ELEMENT_SIZE];
+ char query_string[MAX_ELEMENT_SIZE];
+ char body[MAX_ELEMENT_SIZE];
+ size_t body_size;
+ const char *host;
+ const char *userinfo;
+ uint16_t port;
+ int num_headers;
+ enum { NONE=0, FIELD, VALUE } last_header_element;
+ char headers [MAX_HEADERS][2][MAX_ELEMENT_SIZE];
+ int should_keep_alive;
+
+ int num_chunks;
+ int num_chunks_complete;
+ int chunk_lengths[MAX_CHUNKS];
+
+ const char *upgrade; // upgraded body
+
+ unsigned short http_major;
+ unsigned short http_minor;
+
+ int message_begin_cb_called;
+ int headers_complete_cb_called;
+ int message_complete_cb_called;
+ int message_complete_on_eof;
+ int body_is_final;
+};
+
+static int currently_parsing_eof;
+
+static struct message messages[5];
+static int num_messages;
+static http_parser_settings *current_pause_parser;
+
+/* * R E Q U E S T S * */
+const struct message requests[] =
+#define CURL_GET 0
+{ {.name= "curl get"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /test HTTP/1.1\r\n"
+ "User-Agent: curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1\r\n"
+ "Host: 0.0.0.0=5000\r\n"
+ "Accept: */*\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/test"
+ ,.request_url= "/test"
+ ,.num_headers= 3
+ ,.headers=
+ { { "User-Agent", "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1" }
+ , { "Host", "0.0.0.0=5000" }
+ , { "Accept", "*/*" }
+ }
+ ,.body= ""
+ }
+
+#define FIREFOX_GET 1
+, {.name= "firefox get"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /favicon.ico HTTP/1.1\r\n"
+ "Host: 0.0.0.0=5000\r\n"
+ "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008061015 Firefox/3.0\r\n"
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
+ "Accept-Language: en-us,en;q=0.5\r\n"
+ "Accept-Encoding: gzip,deflate\r\n"
+ "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"
+ "Keep-Alive: 300\r\n"
+ "Connection: keep-alive\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/favicon.ico"
+ ,.request_url= "/favicon.ico"
+ ,.num_headers= 8
+ ,.headers=
+ { { "Host", "0.0.0.0=5000" }
+ , { "User-Agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008061015 Firefox/3.0" }
+ , { "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" }
+ , { "Accept-Language", "en-us,en;q=0.5" }
+ , { "Accept-Encoding", "gzip,deflate" }
+ , { "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7" }
+ , { "Keep-Alive", "300" }
+ , { "Connection", "keep-alive" }
+ }
+ ,.body= ""
+ }
+
+#define DUMBFUCK 2
+, {.name= "dumbfuck"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /dumbfuck HTTP/1.1\r\n"
+ "aaaaaaaaaaaaa:++++++++++\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/dumbfuck"
+ ,.request_url= "/dumbfuck"
+ ,.num_headers= 1
+ ,.headers=
+ { { "aaaaaaaaaaaaa", "++++++++++" }
+ }
+ ,.body= ""
+ }
+
+#define FRAGMENT_IN_URI 3
+, {.name= "fragment in url"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /forums/1/topics/2375?page=1#posts-17408 HTTP/1.1\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= "page=1"
+ ,.fragment= "posts-17408"
+ ,.request_path= "/forums/1/topics/2375"
+ /* XXX request url does include fragment? */
+ ,.request_url= "/forums/1/topics/2375?page=1#posts-17408"
+ ,.num_headers= 0
+ ,.body= ""
+ }
+
+#define GET_NO_HEADERS_NO_BODY 4
+, {.name= "get no headers no body"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /get_no_headers_no_body/world HTTP/1.1\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE /* would need Connection: close */
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/get_no_headers_no_body/world"
+ ,.request_url= "/get_no_headers_no_body/world"
+ ,.num_headers= 0
+ ,.body= ""
+ }
+
+#define GET_ONE_HEADER_NO_BODY 5
+, {.name= "get one header no body"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /get_one_header_no_body HTTP/1.1\r\n"
+ "Accept: */*\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE /* would need Connection: close */
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/get_one_header_no_body"
+ ,.request_url= "/get_one_header_no_body"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Accept" , "*/*" }
+ }
+ ,.body= ""
+ }
+
+#define GET_FUNKY_CONTENT_LENGTH 6
+, {.name= "get funky content length body hello"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /get_funky_content_length_body_hello HTTP/1.0\r\n"
+ "conTENT-Length: 5\r\n"
+ "\r\n"
+ "HELLO"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/get_funky_content_length_body_hello"
+ ,.request_url= "/get_funky_content_length_body_hello"
+ ,.num_headers= 1
+ ,.headers=
+ { { "conTENT-Length" , "5" }
+ }
+ ,.body= "HELLO"
+ }
+
+#define POST_IDENTITY_BODY_WORLD 7
+, {.name= "post identity body world"
+ ,.type= HTTP_REQUEST
+ ,.raw= "POST /post_identity_body_world?q=search#hey HTTP/1.1\r\n"
+ "Accept: */*\r\n"
+ "Transfer-Encoding: identity\r\n"
+ "Content-Length: 5\r\n"
+ "\r\n"
+ "World"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_POST
+ ,.query_string= "q=search"
+ ,.fragment= "hey"
+ ,.request_path= "/post_identity_body_world"
+ ,.request_url= "/post_identity_body_world?q=search#hey"
+ ,.num_headers= 3
+ ,.headers=
+ { { "Accept", "*/*" }
+ , { "Transfer-Encoding", "identity" }
+ , { "Content-Length", "5" }
+ }
+ ,.body= "World"
+ }
+
+#define POST_CHUNKED_ALL_YOUR_BASE 8
+, {.name= "post - chunked body: all your base are belong to us"
+ ,.type= HTTP_REQUEST
+ ,.raw= "POST /post_chunked_all_your_base HTTP/1.1\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "1e\r\nall your base are belong to us\r\n"
+ "0\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_POST
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/post_chunked_all_your_base"
+ ,.request_url= "/post_chunked_all_your_base"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Transfer-Encoding" , "chunked" }
+ }
+ ,.body= "all your base are belong to us"
+ ,.num_chunks_complete= 2
+ ,.chunk_lengths= { 0x1e }
+ }
+
+#define TWO_CHUNKS_MULT_ZERO_END 9
+, {.name= "two chunks ; triple zero ending"
+ ,.type= HTTP_REQUEST
+ ,.raw= "POST /two_chunks_mult_zero_end HTTP/1.1\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "5\r\nhello\r\n"
+ "6\r\n world\r\n"
+ "000\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_POST
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/two_chunks_mult_zero_end"
+ ,.request_url= "/two_chunks_mult_zero_end"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Transfer-Encoding", "chunked" }
+ }
+ ,.body= "hello world"
+ ,.num_chunks_complete= 3
+ ,.chunk_lengths= { 5, 6 }
+ }
+
+#define CHUNKED_W_TRAILING_HEADERS 10
+, {.name= "chunked with trailing headers. blech."
+ ,.type= HTTP_REQUEST
+ ,.raw= "POST /chunked_w_trailing_headers HTTP/1.1\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "5\r\nhello\r\n"
+ "6\r\n world\r\n"
+ "0\r\n"
+ "Vary: *\r\n"
+ "Content-Type: text/plain\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_POST
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/chunked_w_trailing_headers"
+ ,.request_url= "/chunked_w_trailing_headers"
+ ,.num_headers= 3
+ ,.headers=
+ { { "Transfer-Encoding", "chunked" }
+ , { "Vary", "*" }
+ , { "Content-Type", "text/plain" }
+ }
+ ,.body= "hello world"
+ ,.num_chunks_complete= 3
+ ,.chunk_lengths= { 5, 6 }
+ }
+
+#define CHUNKED_W_BULLSHIT_AFTER_LENGTH 11
+, {.name= "with bullshit after the length"
+ ,.type= HTTP_REQUEST
+ ,.raw= "POST /chunked_w_bullshit_after_length HTTP/1.1\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "5; ihatew3;whatthefuck=aretheseparametersfor\r\nhello\r\n"
+ "6; blahblah; blah\r\n world\r\n"
+ "0\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_POST
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/chunked_w_bullshit_after_length"
+ ,.request_url= "/chunked_w_bullshit_after_length"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Transfer-Encoding", "chunked" }
+ }
+ ,.body= "hello world"
+ ,.num_chunks_complete= 3
+ ,.chunk_lengths= { 5, 6 }
+ }
+
+#define WITH_QUOTES 12
+, {.name= "with quotes"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /with_\"stupid\"_quotes?foo=\"bar\" HTTP/1.1\r\n\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= "foo=\"bar\""
+ ,.fragment= ""
+ ,.request_path= "/with_\"stupid\"_quotes"
+ ,.request_url= "/with_\"stupid\"_quotes?foo=\"bar\""
+ ,.num_headers= 0
+ ,.headers= { }
+ ,.body= ""
+ }
+
+#define APACHEBENCH_GET 13
+/* The server receiving this request SHOULD NOT wait for EOF
+ * to know that content-length == 0.
+ * How to represent this in a unit test? message_complete_on_eof
+ * Compare with NO_CONTENT_LENGTH_RESPONSE.
+ */
+, {.name = "apachebench get"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /test HTTP/1.0\r\n"
+ "Host: 0.0.0.0:5000\r\n"
+ "User-Agent: ApacheBench/2.3\r\n"
+ "Accept: */*\r\n\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/test"
+ ,.request_url= "/test"
+ ,.num_headers= 3
+ ,.headers= { { "Host", "0.0.0.0:5000" }
+ , { "User-Agent", "ApacheBench/2.3" }
+ , { "Accept", "*/*" }
+ }
+ ,.body= ""
+ }
+
+#define QUERY_URL_WITH_QUESTION_MARK_GET 14
+/* Some clients include '?' characters in query strings.
+ */
+, {.name = "query url with question mark"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /test.cgi?foo=bar?baz HTTP/1.1\r\n\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= "foo=bar?baz"
+ ,.fragment= ""
+ ,.request_path= "/test.cgi"
+ ,.request_url= "/test.cgi?foo=bar?baz"
+ ,.num_headers= 0
+ ,.headers= {}
+ ,.body= ""
+ }
+
+#define PREFIX_NEWLINE_GET 15
+/* Some clients, especially after a POST in a keep-alive connection,
+ * will send an extra CRLF before the next request
+ */
+, {.name = "newline prefix get"
+ ,.type= HTTP_REQUEST
+ ,.raw= "\r\nGET /test HTTP/1.1\r\n\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/test"
+ ,.request_url= "/test"
+ ,.num_headers= 0
+ ,.headers= { }
+ ,.body= ""
+ }
+
+#define UPGRADE_REQUEST 16
+, {.name = "upgrade request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /demo HTTP/1.1\r\n"
+ "Host: example.com\r\n"
+ "Connection: Upgrade\r\n"
+ "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n"
+ "Sec-WebSocket-Protocol: sample\r\n"
+ "Upgrade: WebSocket\r\n"
+ "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n"
+ "Origin: http://example.com\r\n"
+ "\r\n"
+ "Hot diggity dogg"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/demo"
+ ,.request_url= "/demo"
+ ,.num_headers= 7
+ ,.upgrade="Hot diggity dogg"
+ ,.headers= { { "Host", "example.com" }
+ , { "Connection", "Upgrade" }
+ , { "Sec-WebSocket-Key2", "12998 5 Y3 1 .P00" }
+ , { "Sec-WebSocket-Protocol", "sample" }
+ , { "Upgrade", "WebSocket" }
+ , { "Sec-WebSocket-Key1", "4 @1 46546xW%0l 1 5" }
+ , { "Origin", "http://example.com" }
+ }
+ ,.body= ""
+ }
+
+#define CONNECT_REQUEST 17
+, {.name = "connect request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "CONNECT 0-home0.netscape.com:443 HTTP/1.0\r\n"
+ "User-agent: Mozilla/1.1N\r\n"
+ "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
+ "\r\n"
+ "some data\r\n"
+ "and yet even more data"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.method= HTTP_CONNECT
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= ""
+ ,.request_url= "0-home0.netscape.com:443"
+ ,.num_headers= 2
+ ,.upgrade="some data\r\nand yet even more data"
+ ,.headers= { { "User-agent", "Mozilla/1.1N" }
+ , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
+ }
+ ,.body= ""
+ }
+
+#define REPORT_REQ 18
+, {.name= "report request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "REPORT /test HTTP/1.1\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_REPORT
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/test"
+ ,.request_url= "/test"
+ ,.num_headers= 0
+ ,.headers= {}
+ ,.body= ""
+ }
+
+#define NO_HTTP_VERSION 19
+, {.name= "request with no http version"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 0
+ ,.http_minor= 9
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/"
+ ,.request_url= "/"
+ ,.num_headers= 0
+ ,.headers= {}
+ ,.body= ""
+ }
+
+#define MSEARCH_REQ 20
+, {.name= "m-search request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "M-SEARCH * HTTP/1.1\r\n"
+ "HOST: 239.255.255.250:1900\r\n"
+ "MAN: \"ssdp:discover\"\r\n"
+ "ST: \"ssdp:all\"\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_MSEARCH
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "*"
+ ,.request_url= "*"
+ ,.num_headers= 3
+ ,.headers= { { "HOST", "239.255.255.250:1900" }
+ , { "MAN", "\"ssdp:discover\"" }
+ , { "ST", "\"ssdp:all\"" }
+ }
+ ,.body= ""
+ }
+
+#define LINE_FOLDING_IN_HEADER 21
+, {.name= "line folding in header value"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET / HTTP/1.1\r\n"
+ "Line1: abc\r\n"
+ "\tdef\r\n"
+ " ghi\r\n"
+ "\t\tjkl\r\n"
+ " mno \r\n"
+ "\t \tqrs\r\n"
+ "Line2: \t line2\t\r\n"
+ "Line3:\r\n"
+ " line3\r\n"
+ "Line4: \r\n"
+ " \r\n"
+ "Connection:\r\n"
+ " close\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/"
+ ,.request_url= "/"
+ ,.num_headers= 5
+ ,.headers= { { "Line1", "abc\tdef ghi\t\tjkl mno \t \tqrs" }
+ , { "Line2", "line2\t" }
+ , { "Line3", "line3" }
+ , { "Line4", "" }
+ , { "Connection", "close" },
+ }
+ ,.body= ""
+ }
+
+
+#define QUERY_TERMINATED_HOST 22
+, {.name= "host terminated by a query string"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET http://hypnotoad.org?hail=all HTTP/1.1\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= "hail=all"
+ ,.fragment= ""
+ ,.request_path= ""
+ ,.request_url= "http://hypnotoad.org?hail=all"
+ ,.host= "hypnotoad.org"
+ ,.num_headers= 0
+ ,.headers= { }
+ ,.body= ""
+ }
+
+#define QUERY_TERMINATED_HOSTPORT 23
+, {.name= "host:port terminated by a query string"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET http://hypnotoad.org:1234?hail=all HTTP/1.1\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= "hail=all"
+ ,.fragment= ""
+ ,.request_path= ""
+ ,.request_url= "http://hypnotoad.org:1234?hail=all"
+ ,.host= "hypnotoad.org"
+ ,.port= 1234
+ ,.num_headers= 0
+ ,.headers= { }
+ ,.body= ""
+ }
+
+#define SPACE_TERMINATED_HOSTPORT 24
+, {.name= "host:port terminated by a space"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET http://hypnotoad.org:1234 HTTP/1.1\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= ""
+ ,.request_url= "http://hypnotoad.org:1234"
+ ,.host= "hypnotoad.org"
+ ,.port= 1234
+ ,.num_headers= 0
+ ,.headers= { }
+ ,.body= ""
+ }
+
+#define PATCH_REQ 25
+, {.name = "PATCH request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "PATCH /file.txt HTTP/1.1\r\n"
+ "Host: www.example.com\r\n"
+ "Content-Type: application/example\r\n"
+ "If-Match: \"e0023aa4e\"\r\n"
+ "Content-Length: 10\r\n"
+ "\r\n"
+ "cccccccccc"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_PATCH
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/file.txt"
+ ,.request_url= "/file.txt"
+ ,.num_headers= 4
+ ,.headers= { { "Host", "www.example.com" }
+ , { "Content-Type", "application/example" }
+ , { "If-Match", "\"e0023aa4e\"" }
+ , { "Content-Length", "10" }
+ }
+ ,.body= "cccccccccc"
+ }
+
+#define CONNECT_CAPS_REQUEST 26
+, {.name = "connect caps request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "CONNECT HOME0.NETSCAPE.COM:443 HTTP/1.0\r\n"
+ "User-agent: Mozilla/1.1N\r\n"
+ "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.method= HTTP_CONNECT
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= ""
+ ,.request_url= "HOME0.NETSCAPE.COM:443"
+ ,.num_headers= 2
+ ,.upgrade=""
+ ,.headers= { { "User-agent", "Mozilla/1.1N" }
+ , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
+ }
+ ,.body= ""
+ }
+
+#if !HTTP_PARSER_STRICT
+#define UTF8_PATH_REQ 27
+, {.name= "utf-8 path request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /δ¶/δt/pope?q=1#narf HTTP/1.1\r\n"
+ "Host: github.com\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= "q=1"
+ ,.fragment= "narf"
+ ,.request_path= "/δ¶/δt/pope"
+ ,.request_url= "/δ¶/δt/pope?q=1#narf"
+ ,.num_headers= 1
+ ,.headers= { {"Host", "github.com" }
+ }
+ ,.body= ""
+ }
+
+#define HOSTNAME_UNDERSCORE 28
+, {.name = "hostname underscore"
+ ,.type= HTTP_REQUEST
+ ,.raw= "CONNECT home_0.netscape.com:443 HTTP/1.0\r\n"
+ "User-agent: Mozilla/1.1N\r\n"
+ "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.method= HTTP_CONNECT
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= ""
+ ,.request_url= "home_0.netscape.com:443"
+ ,.num_headers= 2
+ ,.upgrade=""
+ ,.headers= { { "User-agent", "Mozilla/1.1N" }
+ , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
+ }
+ ,.body= ""
+ }
+#endif /* !HTTP_PARSER_STRICT */
+
+/* see https://github.com/ry/http-parser/issues/47 */
+#define EAT_TRAILING_CRLF_NO_CONNECTION_CLOSE 29
+, {.name = "eat CRLF between requests, no \"Connection: close\" header"
+ ,.raw= "POST / HTTP/1.1\r\n"
+ "Host: www.example.com\r\n"
+ "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: 4\r\n"
+ "\r\n"
+ "q=42\r\n" /* note the trailing CRLF */
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_POST
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/"
+ ,.request_url= "/"
+ ,.num_headers= 3
+ ,.upgrade= 0
+ ,.headers= { { "Host", "www.example.com" }
+ , { "Content-Type", "application/x-www-form-urlencoded" }
+ , { "Content-Length", "4" }
+ }
+ ,.body= "q=42"
+ }
+
+/* see https://github.com/ry/http-parser/issues/47 */
+#define EAT_TRAILING_CRLF_WITH_CONNECTION_CLOSE 30
+, {.name = "eat CRLF between requests even if \"Connection: close\" is set"
+ ,.raw= "POST / HTTP/1.1\r\n"
+ "Host: www.example.com\r\n"
+ "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: 4\r\n"
+ "Connection: close\r\n"
+ "\r\n"
+ "q=42\r\n" /* note the trailing CRLF */
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE /* input buffer isn't empty when on_message_complete is called */
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_POST
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/"
+ ,.request_url= "/"
+ ,.num_headers= 4
+ ,.upgrade= 0
+ ,.headers= { { "Host", "www.example.com" }
+ , { "Content-Type", "application/x-www-form-urlencoded" }
+ , { "Content-Length", "4" }
+ , { "Connection", "close" }
+ }
+ ,.body= "q=42"
+ }
+
+#define PURGE_REQ 31
+, {.name = "PURGE request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "PURGE /file.txt HTTP/1.1\r\n"
+ "Host: www.example.com\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_PURGE
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/file.txt"
+ ,.request_url= "/file.txt"
+ ,.num_headers= 1
+ ,.headers= { { "Host", "www.example.com" } }
+ ,.body= ""
+ }
+
+#define SEARCH_REQ 32
+, {.name = "SEARCH request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "SEARCH / HTTP/1.1\r\n"
+ "Host: www.example.com\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_SEARCH
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/"
+ ,.request_url= "/"
+ ,.num_headers= 1
+ ,.headers= { { "Host", "www.example.com" } }
+ ,.body= ""
+ }
+
+#define PROXY_WITH_BASIC_AUTH 33
+, {.name= "host:port and basic_auth"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET http://a%12:b!&*$@hypnotoad.org:1234/toto HTTP/1.1\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.fragment= ""
+ ,.request_path= "/toto"
+ ,.request_url= "http://a%12:b!&*$@hypnotoad.org:1234/toto"
+ ,.host= "hypnotoad.org"
+ ,.userinfo= "a%12:b!&*$"
+ ,.port= 1234
+ ,.num_headers= 0
+ ,.headers= { }
+ ,.body= ""
+ }
+
+#define LINE_FOLDING_IN_HEADER_WITH_LF 34
+, {.name= "line folding in header value"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET / HTTP/1.1\n"
+ "Line1: abc\n"
+ "\tdef\n"
+ " ghi\n"
+ "\t\tjkl\n"
+ " mno \n"
+ "\t \tqrs\n"
+ "Line2: \t line2\t\n"
+ "Line3:\n"
+ " line3\n"
+ "Line4: \n"
+ " \n"
+ "Connection:\n"
+ " close\n"
+ "\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/"
+ ,.request_url= "/"
+ ,.num_headers= 5
+ ,.headers= { { "Line1", "abc\tdef ghi\t\tjkl mno \t \tqrs" }
+ , { "Line2", "line2\t" }
+ , { "Line3", "line3" }
+ , { "Line4", "" }
+ , { "Connection", "close" },
+ }
+ ,.body= ""
+ }
+
+#define CONNECTION_MULTI 35
+, {.name = "multiple connection header values with folding"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /demo HTTP/1.1\r\n"
+ "Host: example.com\r\n"
+ "Connection: Something,\r\n"
+ " Upgrade, ,Keep-Alive\r\n"
+ "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n"
+ "Sec-WebSocket-Protocol: sample\r\n"
+ "Upgrade: WebSocket\r\n"
+ "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n"
+ "Origin: http://example.com\r\n"
+ "\r\n"
+ "Hot diggity dogg"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/demo"
+ ,.request_url= "/demo"
+ ,.num_headers= 7
+ ,.upgrade="Hot diggity dogg"
+ ,.headers= { { "Host", "example.com" }
+ , { "Connection", "Something, Upgrade, ,Keep-Alive" }
+ , { "Sec-WebSocket-Key2", "12998 5 Y3 1 .P00" }
+ , { "Sec-WebSocket-Protocol", "sample" }
+ , { "Upgrade", "WebSocket" }
+ , { "Sec-WebSocket-Key1", "4 @1 46546xW%0l 1 5" }
+ , { "Origin", "http://example.com" }
+ }
+ ,.body= ""
+ }
+
+#define CONNECTION_MULTI_LWS 36
+, {.name = "multiple connection header values with folding and lws"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /demo HTTP/1.1\r\n"
+ "Connection: keep-alive, upgrade\r\n"
+ "Upgrade: WebSocket\r\n"
+ "\r\n"
+ "Hot diggity dogg"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/demo"
+ ,.request_url= "/demo"
+ ,.num_headers= 2
+ ,.upgrade="Hot diggity dogg"
+ ,.headers= { { "Connection", "keep-alive, upgrade" }
+ , { "Upgrade", "WebSocket" }
+ }
+ ,.body= ""
+ }
+
+#define CONNECTION_MULTI_LWS_CRLF 37
+, {.name = "multiple connection header values with folding and lws"
+ ,.type= HTTP_REQUEST
+ ,.raw= "GET /demo HTTP/1.1\r\n"
+ "Connection: keep-alive, \r\n upgrade\r\n"
+ "Upgrade: WebSocket\r\n"
+ "\r\n"
+ "Hot diggity dogg"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_GET
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "/demo"
+ ,.request_url= "/demo"
+ ,.num_headers= 2
+ ,.upgrade="Hot diggity dogg"
+ ,.headers= { { "Connection", "keep-alive, upgrade" }
+ , { "Upgrade", "WebSocket" }
+ }
+ ,.body= ""
+ }
+
+#define UPGRADE_POST_REQUEST 38
+, {.name = "upgrade post request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "POST /demo HTTP/1.1\r\n"
+ "Host: example.com\r\n"
+ "Connection: Upgrade\r\n"
+ "Upgrade: HTTP/2.0\r\n"
+ "Content-Length: 15\r\n"
+ "\r\n"
+ "sweet post body"
+ "Hot diggity dogg"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_POST
+ ,.request_path= "/demo"
+ ,.request_url= "/demo"
+ ,.num_headers= 4
+ ,.upgrade="Hot diggity dogg"
+ ,.headers= { { "Host", "example.com" }
+ , { "Connection", "Upgrade" }
+ , { "Upgrade", "HTTP/2.0" }
+ , { "Content-Length", "15" }
+ }
+ ,.body= "sweet post body"
+ }
+
+#define CONNECT_WITH_BODY_REQUEST 39
+, {.name = "connect with body request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "CONNECT foo.bar.com:443 HTTP/1.0\r\n"
+ "User-agent: Mozilla/1.1N\r\n"
+ "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
+ "Content-Length: 10\r\n"
+ "\r\n"
+ "blarfcicle"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.method= HTTP_CONNECT
+ ,.request_url= "foo.bar.com:443"
+ ,.num_headers= 3
+ ,.upgrade="blarfcicle"
+ ,.headers= { { "User-agent", "Mozilla/1.1N" }
+ , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
+ , { "Content-Length", "10" }
+ }
+ ,.body= ""
+ }
+
+, {.name= NULL } /* sentinel */
+};
+
+/* * R E S P O N S E S * */
+const struct message responses[] =
+#define GOOGLE_301 0
+{ {.name= "google 301"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 301 Moved Permanently\r\n"
+ "Location: http://www.google.com/\r\n"
+ "Content-Type: text/html; charset=UTF-8\r\n"
+ "Date: Sun, 26 Apr 2009 11:11:49 GMT\r\n"
+ "Expires: Tue, 26 May 2009 11:11:49 GMT\r\n"
+ "X-$PrototypeBI-Version: 1.6.0.3\r\n" /* $ char in header field */
+ "Cache-Control: public, max-age=2592000\r\n"
+ "Server: gws\r\n"
+ "Content-Length: 219 \r\n"
+ "\r\n"
+ "<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n"
+ "<TITLE>301 Moved</TITLE></HEAD><BODY>\n"
+ "<H1>301 Moved</H1>\n"
+ "The document has moved\n"
+ "<A HREF=\"http://www.google.com/\">here</A>.\r\n"
+ "</BODY></HTML>\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 301
+ ,.response_status= "Moved Permanently"
+ ,.num_headers= 8
+ ,.headers=
+ { { "Location", "http://www.google.com/" }
+ , { "Content-Type", "text/html; charset=UTF-8" }
+ , { "Date", "Sun, 26 Apr 2009 11:11:49 GMT" }
+ , { "Expires", "Tue, 26 May 2009 11:11:49 GMT" }
+ , { "X-$PrototypeBI-Version", "1.6.0.3" }
+ , { "Cache-Control", "public, max-age=2592000" }
+ , { "Server", "gws" }
+ , { "Content-Length", "219 " }
+ }
+ ,.body= "<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n"
+ "<TITLE>301 Moved</TITLE></HEAD><BODY>\n"
+ "<H1>301 Moved</H1>\n"
+ "The document has moved\n"
+ "<A HREF=\"http://www.google.com/\">here</A>.\r\n"
+ "</BODY></HTML>\r\n"
+ }
+
+#define NO_CONTENT_LENGTH_RESPONSE 1
+/* The client should wait for the server's EOF. That is, when content-length
+ * is not specified, and "Connection: close", the end of body is specified
+ * by the EOF.
+ * Compare with APACHEBENCH_GET
+ */
+, {.name= "no content-length response"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "Date: Tue, 04 Aug 2009 07:59:32 GMT\r\n"
+ "Server: Apache\r\n"
+ "X-Powered-By: Servlet/2.5 JSP/2.1\r\n"
+ "Content-Type: text/xml; charset=utf-8\r\n"
+ "Connection: close\r\n"
+ "\r\n"
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
+ " <SOAP-ENV:Body>\n"
+ " <SOAP-ENV:Fault>\n"
+ " <faultcode>SOAP-ENV:Client</faultcode>\n"
+ " <faultstring>Client Error</faultstring>\n"
+ " </SOAP-ENV:Fault>\n"
+ " </SOAP-ENV:Body>\n"
+ "</SOAP-ENV:Envelope>"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 5
+ ,.headers=
+ { { "Date", "Tue, 04 Aug 2009 07:59:32 GMT" }
+ , { "Server", "Apache" }
+ , { "X-Powered-By", "Servlet/2.5 JSP/2.1" }
+ , { "Content-Type", "text/xml; charset=utf-8" }
+ , { "Connection", "close" }
+ }
+ ,.body= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
+ " <SOAP-ENV:Body>\n"
+ " <SOAP-ENV:Fault>\n"
+ " <faultcode>SOAP-ENV:Client</faultcode>\n"
+ " <faultstring>Client Error</faultstring>\n"
+ " </SOAP-ENV:Fault>\n"
+ " </SOAP-ENV:Body>\n"
+ "</SOAP-ENV:Envelope>"
+ }
+
+#define NO_HEADERS_NO_BODY_404 2
+, {.name= "404 no headers no body"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 404 Not Found\r\n\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 404
+ ,.response_status= "Not Found"
+ ,.num_headers= 0
+ ,.headers= {}
+ ,.body_size= 0
+ ,.body= ""
+ }
+
+#define NO_REASON_PHRASE 3
+, {.name= "301 no response phrase"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 301\r\n\r\n"
+ ,.should_keep_alive = FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 301
+ ,.response_status= ""
+ ,.num_headers= 0
+ ,.headers= {}
+ ,.body= ""
+ }
+
+#define TRAILING_SPACE_ON_CHUNKED_BODY 4
+, {.name="200 trailing space on chunked body"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "Content-Type: text/plain\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "25 \r\n"
+ "This is the data in the first chunk\r\n"
+ "\r\n"
+ "1C\r\n"
+ "and this is the second one\r\n"
+ "\r\n"
+ "0 \r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 2
+ ,.headers=
+ { {"Content-Type", "text/plain" }
+ , {"Transfer-Encoding", "chunked" }
+ }
+ ,.body_size = 37+28
+ ,.body =
+ "This is the data in the first chunk\r\n"
+ "and this is the second one\r\n"
+ ,.num_chunks_complete= 3
+ ,.chunk_lengths= { 0x25, 0x1c }
+ }
+
+#define NO_CARRIAGE_RET 5
+, {.name="no carriage ret"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\n"
+ "Content-Type: text/html; charset=utf-8\n"
+ "Connection: close\n"
+ "\n"
+ "these headers are from http://news.ycombinator.com/"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 2
+ ,.headers=
+ { {"Content-Type", "text/html; charset=utf-8" }
+ , {"Connection", "close" }
+ }
+ ,.body= "these headers are from http://news.ycombinator.com/"
+ }
+
+#define PROXY_CONNECTION 6
+, {.name="proxy connection"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "Content-Type: text/html; charset=UTF-8\r\n"
+ "Content-Length: 11\r\n"
+ "Proxy-Connection: close\r\n"
+ "Date: Thu, 31 Dec 2009 20:55:48 +0000\r\n"
+ "\r\n"
+ "hello world"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 4
+ ,.headers=
+ { {"Content-Type", "text/html; charset=UTF-8" }
+ , {"Content-Length", "11" }
+ , {"Proxy-Connection", "close" }
+ , {"Date", "Thu, 31 Dec 2009 20:55:48 +0000"}
+ }
+ ,.body= "hello world"
+ }
+
+#define UNDERSTORE_HEADER_KEY 7
+ // shown by
+ // curl -o /dev/null -v "http://ad.doubleclick.net/pfadx/DARTSHELLCONFIGXML;dcmt=text/xml;"
+, {.name="underscore header key"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "Server: DCLK-AdSvr\r\n"
+ "Content-Type: text/xml\r\n"
+ "Content-Length: 0\r\n"
+ "DCLK_imp: v7;x;114750856;0-0;0;17820020;0/0;21603567/21621457/1;;~okv=;dcmt=text/xml;;~cs=o\r\n\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 4
+ ,.headers=
+ { {"Server", "DCLK-AdSvr" }
+ , {"Content-Type", "text/xml" }
+ , {"Content-Length", "0" }
+ , {"DCLK_imp", "v7;x;114750856;0-0;0;17820020;0/0;21603567/21621457/1;;~okv=;dcmt=text/xml;;~cs=o" }
+ }
+ ,.body= ""
+ }
+
+#define BONJOUR_MADAME_FR 8
+/* The client should not merge two headers fields when the first one doesn't
+ * have a value.
+ */
+, {.name= "bonjourmadame.fr"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.0 301 Moved Permanently\r\n"
+ "Date: Thu, 03 Jun 2010 09:56:32 GMT\r\n"
+ "Server: Apache/2.2.3 (Red Hat)\r\n"
+ "Cache-Control: public\r\n"
+ "Pragma: \r\n"
+ "Location: http://www.bonjourmadame.fr/\r\n"
+ "Vary: Accept-Encoding\r\n"
+ "Content-Length: 0\r\n"
+ "Content-Type: text/html; charset=UTF-8\r\n"
+ "Connection: keep-alive\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.status_code= 301
+ ,.response_status= "Moved Permanently"
+ ,.num_headers= 9
+ ,.headers=
+ { { "Date", "Thu, 03 Jun 2010 09:56:32 GMT" }
+ , { "Server", "Apache/2.2.3 (Red Hat)" }
+ , { "Cache-Control", "public" }
+ , { "Pragma", "" }
+ , { "Location", "http://www.bonjourmadame.fr/" }
+ , { "Vary", "Accept-Encoding" }
+ , { "Content-Length", "0" }
+ , { "Content-Type", "text/html; charset=UTF-8" }
+ , { "Connection", "keep-alive" }
+ }
+ ,.body= ""
+ }
+
+#define RES_FIELD_UNDERSCORE 9
+/* Should handle spaces in header fields */
+, {.name= "field underscore"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "Date: Tue, 28 Sep 2010 01:14:13 GMT\r\n"
+ "Server: Apache\r\n"
+ "Cache-Control: no-cache, must-revalidate\r\n"
+ "Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n"
+ ".et-Cookie: PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com\r\n"
+ "Vary: Accept-Encoding\r\n"
+ "_eep-Alive: timeout=45\r\n" /* semantic value ignored */
+ "_onnection: Keep-Alive\r\n" /* semantic value ignored */
+ "Transfer-Encoding: chunked\r\n"
+ "Content-Type: text/html\r\n"
+ "Connection: close\r\n"
+ "\r\n"
+ "0\r\n\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 11
+ ,.headers=
+ { { "Date", "Tue, 28 Sep 2010 01:14:13 GMT" }
+ , { "Server", "Apache" }
+ , { "Cache-Control", "no-cache, must-revalidate" }
+ , { "Expires", "Mon, 26 Jul 1997 05:00:00 GMT" }
+ , { ".et-Cookie", "PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com" }
+ , { "Vary", "Accept-Encoding" }
+ , { "_eep-Alive", "timeout=45" }
+ , { "_onnection", "Keep-Alive" }
+ , { "Transfer-Encoding", "chunked" }
+ , { "Content-Type", "text/html" }
+ , { "Connection", "close" }
+ }
+ ,.body= ""
+ ,.num_chunks_complete= 1
+ ,.chunk_lengths= {}
+ }
+
+#define NON_ASCII_IN_STATUS_LINE 10
+/* Should handle non-ASCII in status line */
+, {.name= "non-ASCII in status line"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 500 Oriëntatieprobleem\r\n"
+ "Date: Fri, 5 Nov 2010 23:07:12 GMT+2\r\n"
+ "Content-Length: 0\r\n"
+ "Connection: close\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 500
+ ,.response_status= "Oriëntatieprobleem"
+ ,.num_headers= 3
+ ,.headers=
+ { { "Date", "Fri, 5 Nov 2010 23:07:12 GMT+2" }
+ , { "Content-Length", "0" }
+ , { "Connection", "close" }
+ }
+ ,.body= ""
+ }
+
+#define HTTP_VERSION_0_9 11
+/* Should handle HTTP/0.9 */
+, {.name= "http version 0.9"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/0.9 200 OK\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 0
+ ,.http_minor= 9
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 0
+ ,.headers=
+ {}
+ ,.body= ""
+ }
+
+#define NO_CONTENT_LENGTH_NO_TRANSFER_ENCODING_RESPONSE 12
+/* The client should wait for the server's EOF. That is, when neither
+ * content-length nor transfer-encoding is specified, the end of body
+ * is specified by the EOF.
+ */
+, {.name= "neither content-length nor transfer-encoding response"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "Content-Type: text/plain\r\n"
+ "\r\n"
+ "hello world"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Content-Type", "text/plain" }
+ }
+ ,.body= "hello world"
+ }
+
+#define NO_BODY_HTTP10_KA_200 13
+, {.name= "HTTP/1.0 with keep-alive and EOF-terminated 200 status"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.0 200 OK\r\n"
+ "Connection: keep-alive\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Connection", "keep-alive" }
+ }
+ ,.body_size= 0
+ ,.body= ""
+ }
+
+#define NO_BODY_HTTP10_KA_204 14
+, {.name= "HTTP/1.0 with keep-alive and a 204 status"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.0 204 No content\r\n"
+ "Connection: keep-alive\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.status_code= 204
+ ,.response_status= "No content"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Connection", "keep-alive" }
+ }
+ ,.body_size= 0
+ ,.body= ""
+ }
+
+#define NO_BODY_HTTP11_KA_200 15
+, {.name= "HTTP/1.1 with an EOF-terminated 200 status"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 0
+ ,.headers={}
+ ,.body_size= 0
+ ,.body= ""
+ }
+
+#define NO_BODY_HTTP11_KA_204 16
+, {.name= "HTTP/1.1 with a 204 status"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 204 No content\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 204
+ ,.response_status= "No content"
+ ,.num_headers= 0
+ ,.headers={}
+ ,.body_size= 0
+ ,.body= ""
+ }
+
+#define NO_BODY_HTTP11_NOKA_204 17
+, {.name= "HTTP/1.1 with a 204 status and keep-alive disabled"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 204 No content\r\n"
+ "Connection: close\r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 204
+ ,.response_status= "No content"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Connection", "close" }
+ }
+ ,.body_size= 0
+ ,.body= ""
+ }
+
+#define NO_BODY_HTTP11_KA_CHUNKED_200 18
+, {.name= "HTTP/1.1 with chunked endocing and a 200 response"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "0\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 1
+ ,.headers=
+ { { "Transfer-Encoding", "chunked" }
+ }
+ ,.body_size= 0
+ ,.body= ""
+ ,.num_chunks_complete= 1
+ }
+
+#if !HTTP_PARSER_STRICT
+#define SPACE_IN_FIELD_RES 19
+/* Should handle spaces in header fields */
+, {.name= "field space"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 OK\r\n"
+ "Server: Microsoft-IIS/6.0\r\n"
+ "X-Powered-By: ASP.NET\r\n"
+ "en-US Content-Type: text/xml\r\n" /* this is the problem */
+ "Content-Type: text/xml\r\n"
+ "Content-Length: 16\r\n"
+ "Date: Fri, 23 Jul 2010 18:45:38 GMT\r\n"
+ "Connection: keep-alive\r\n"
+ "\r\n"
+ "<xml>hello</xml>" /* fake body */
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 7
+ ,.headers=
+ { { "Server", "Microsoft-IIS/6.0" }
+ , { "X-Powered-By", "ASP.NET" }
+ , { "en-US Content-Type", "text/xml" }
+ , { "Content-Type", "text/xml" }
+ , { "Content-Length", "16" }
+ , { "Date", "Fri, 23 Jul 2010 18:45:38 GMT" }
+ , { "Connection", "keep-alive" }
+ }
+ ,.body= "<xml>hello</xml>"
+ }
+#endif /* !HTTP_PARSER_STRICT */
+
+#define AMAZON_COM 20
+, {.name= "amazon.com"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 301 MovedPermanently\r\n"
+ "Date: Wed, 15 May 2013 17:06:33 GMT\r\n"
+ "Server: Server\r\n"
+ "x-amz-id-1: 0GPHKXSJQ826RK7GZEB2\r\n"
+ "p3p: policyref=\"http://www.amazon.com/w3c/p3p.xml\",CP=\"CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC \"\r\n"
+ "x-amz-id-2: STN69VZxIFSz9YJLbz1GDbxpbjG6Qjmmq5E3DxRhOUw+Et0p4hr7c/Q8qNcx4oAD\r\n"
+ "Location: http://www.amazon.com/Dan-Brown/e/B000AP9DSU/ref=s9_pop_gw_al1?_encoding=UTF8&refinementId=618073011&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SHYY5BZXN3KR20BNFAY&pf_rd_t=101&pf_rd_p=1263340922&pf_rd_i=507846\r\n"
+ "Vary: Accept-Encoding,User-Agent\r\n"
+ "Content-Type: text/html; charset=ISO-8859-1\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "1\r\n"
+ "\n\r\n"
+ "0\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 301
+ ,.response_status= "MovedPermanently"
+ ,.num_headers= 9
+ ,.headers= { { "Date", "Wed, 15 May 2013 17:06:33 GMT" }
+ , { "Server", "Server" }
+ , { "x-amz-id-1", "0GPHKXSJQ826RK7GZEB2" }
+ , { "p3p", "policyref=\"http://www.amazon.com/w3c/p3p.xml\",CP=\"CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC \"" }
+ , { "x-amz-id-2", "STN69VZxIFSz9YJLbz1GDbxpbjG6Qjmmq5E3DxRhOUw+Et0p4hr7c/Q8qNcx4oAD" }
+ , { "Location", "http://www.amazon.com/Dan-Brown/e/B000AP9DSU/ref=s9_pop_gw_al1?_encoding=UTF8&refinementId=618073011&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SHYY5BZXN3KR20BNFAY&pf_rd_t=101&pf_rd_p=1263340922&pf_rd_i=507846" }
+ , { "Vary", "Accept-Encoding,User-Agent" }
+ , { "Content-Type", "text/html; charset=ISO-8859-1" }
+ , { "Transfer-Encoding", "chunked" }
+ }
+ ,.body= "\n"
+ ,.num_chunks_complete= 2
+ ,.chunk_lengths= { 1 }
+ }
+
+#define EMPTY_REASON_PHRASE_AFTER_SPACE 20
+, {.name= "empty reason phrase after space"
+ ,.type= HTTP_RESPONSE
+ ,.raw= "HTTP/1.1 200 \r\n"
+ "\r\n"
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= TRUE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.status_code= 200
+ ,.response_status= ""
+ ,.num_headers= 0
+ ,.headers= {}
+ ,.body= ""
+ }
+
+, {.name= NULL } /* sentinel */
+};
+
+/* strnlen() is a POSIX.2008 addition. Can't rely on it being available so
+ * define it ourselves.
+ */
+size_t
+strnlen(const char *s, size_t maxlen)
+{
+ const char *p;
+
+ p = memchr(s, '\0', maxlen);
+ if (p == NULL)
+ return maxlen;
+
+ return p - s;
+}
+
+size_t
+strlncat(char *dst, size_t len, const char *src, size_t n)
+{
+ size_t slen;
+ size_t dlen;
+ size_t rlen;
+ size_t ncpy;
+
+ slen = strnlen(src, n);
+ dlen = strnlen(dst, len);
+
+ if (dlen < len) {
+ rlen = len - dlen;
+ ncpy = slen < rlen ? slen : (rlen - 1);
+ memcpy(dst + dlen, src, ncpy);
+ dst[dlen + ncpy] = '\0';
+ }
+
+ assert(len > slen + dlen);
+ return slen + dlen;
+}
+
+size_t
+strlcat(char *dst, const char *src, size_t len)
+{
+ return strlncat(dst, len, src, (size_t) -1);
+}
+
+size_t
+strlncpy(char *dst, size_t len, const char *src, size_t n)
+{
+ size_t slen;
+ size_t ncpy;
+
+ slen = strnlen(src, n);
+
+ if (len > 0) {
+ ncpy = slen < len ? slen : (len - 1);
+ memcpy(dst, src, ncpy);
+ dst[ncpy] = '\0';
+ }
+
+ assert(len > slen);
+ return slen;
+}
+
+size_t
+strlcpy(char *dst, const char *src, size_t len)
+{
+ return strlncpy(dst, len, src, (size_t) -1);
+}
+
+int
+request_url_cb (http_parser *p, const char *buf, size_t len)
+{
+ assert(p == parser);
+ strlncat(messages[num_messages].request_url,
+ sizeof(messages[num_messages].request_url),
+ buf,
+ len);
+ return 0;
+}
+
+int
+header_field_cb (http_parser *p, const char *buf, size_t len)
+{
+ assert(p == parser);
+ struct message *m = &messages[num_messages];
+
+ if (m->last_header_element != FIELD)
+ m->num_headers++;
+
+ strlncat(m->headers[m->num_headers-1][0],
+ sizeof(m->headers[m->num_headers-1][0]),
+ buf,
+ len);
+
+ m->last_header_element = FIELD;
+
+ return 0;
+}
+
+int
+header_value_cb (http_parser *p, const char *buf, size_t len)
+{
+ assert(p == parser);
+ struct message *m = &messages[num_messages];
+
+ strlncat(m->headers[m->num_headers-1][1],
+ sizeof(m->headers[m->num_headers-1][1]),
+ buf,
+ len);
+
+ m->last_header_element = VALUE;
+
+ return 0;
+}
+
+void
+check_body_is_final (const http_parser *p)
+{
+ if (messages[num_messages].body_is_final) {
+ fprintf(stderr, "\n\n *** Error http_body_is_final() should return 1 "
+ "on last on_body callback call "
+ "but it doesn't! ***\n\n");
+ assert(0);
+ abort();
+ }
+ messages[num_messages].body_is_final = http_body_is_final(p);
+}
+
+int
+body_cb (http_parser *p, const char *buf, size_t len)
+{
+ assert(p == parser);
+ strlncat(messages[num_messages].body,
+ sizeof(messages[num_messages].body),
+ buf,
+ len);
+ messages[num_messages].body_size += len;
+ check_body_is_final(p);
+ // printf("body_cb: '%s'\n", requests[num_messages].body);
+ return 0;
+}
+
+int
+count_body_cb (http_parser *p, const char *buf, size_t len)
+{
+ assert(p == parser);
+ assert(buf);
+ messages[num_messages].body_size += len;
+ check_body_is_final(p);
+ return 0;
+}
+
+int
+message_begin_cb (http_parser *p)
+{
+ assert(p == parser);
+ messages[num_messages].message_begin_cb_called = TRUE;
+ return 0;
+}
+
+int
+headers_complete_cb (http_parser *p)
+{
+ assert(p == parser);
+ messages[num_messages].method = parser->method;
+ messages[num_messages].status_code = parser->status_code;
+ messages[num_messages].http_major = parser->http_major;
+ messages[num_messages].http_minor = parser->http_minor;
+ messages[num_messages].headers_complete_cb_called = TRUE;
+ messages[num_messages].should_keep_alive = http_should_keep_alive(parser);
+ return 0;
+}
+
+int
+message_complete_cb (http_parser *p)
+{
+ assert(p == parser);
+ if (messages[num_messages].should_keep_alive != http_should_keep_alive(parser))
+ {
+ fprintf(stderr, "\n\n *** Error http_should_keep_alive() should have same "
+ "value in both on_message_complete and on_headers_complete "
+ "but it doesn't! ***\n\n");
+ assert(0);
+ abort();
+ }
+
+ if (messages[num_messages].body_size &&
+ http_body_is_final(p) &&
+ !messages[num_messages].body_is_final)
+ {
+ fprintf(stderr, "\n\n *** Error http_body_is_final() should return 1 "
+ "on last on_body callback call "
+ "but it doesn't! ***\n\n");
+ assert(0);
+ abort();
+ }
+
+ messages[num_messages].message_complete_cb_called = TRUE;
+
+ messages[num_messages].message_complete_on_eof = currently_parsing_eof;
+
+ num_messages++;
+ return 0;
+}
+
+int
+response_status_cb (http_parser *p, const char *buf, size_t len)
+{
+ assert(p == parser);
+ strlncat(messages[num_messages].response_status,
+ sizeof(messages[num_messages].response_status),
+ buf,
+ len);
+ return 0;
+}
+
+int
+chunk_header_cb (http_parser *p)
+{
+ assert(p == parser);
+ int chunk_idx = messages[num_messages].num_chunks;
+ messages[num_messages].num_chunks++;
+ if (chunk_idx < MAX_CHUNKS) {
+ messages[num_messages].chunk_lengths[chunk_idx] = p->content_length;
+ }
+
+ return 0;
+}
+
+int
+chunk_complete_cb (http_parser *p)
+{
+ assert(p == parser);
+
+ /* Here we want to verify that each chunk_header_cb is matched by a
+ * chunk_complete_cb, so not only should the total number of calls to
+ * both callbacks be the same, but they also should be interleaved
+ * properly */
+ assert(messages[num_messages].num_chunks ==
+ messages[num_messages].num_chunks_complete + 1);
+
+ messages[num_messages].num_chunks_complete++;
+ return 0;
+}
+
+/* These dontcall_* callbacks exist so that we can verify that when we're
+ * paused, no additional callbacks are invoked */
+int
+dontcall_message_begin_cb (http_parser *p)
+{
+ if (p) { } // gcc
+ fprintf(stderr, "\n\n*** on_message_begin() called on paused parser ***\n\n");
+ abort();
+}
+
+int
+dontcall_header_field_cb (http_parser *p, const char *buf, size_t len)
+{
+ if (p || buf || len) { } // gcc
+ fprintf(stderr, "\n\n*** on_header_field() called on paused parser ***\n\n");
+ abort();
+}
+
+int
+dontcall_header_value_cb (http_parser *p, const char *buf, size_t len)
+{
+ if (p || buf || len) { } // gcc
+ fprintf(stderr, "\n\n*** on_header_value() called on paused parser ***\n\n");
+ abort();
+}
+
+int
+dontcall_request_url_cb (http_parser *p, const char *buf, size_t len)
+{
+ if (p || buf || len) { } // gcc
+ fprintf(stderr, "\n\n*** on_request_url() called on paused parser ***\n\n");
+ abort();
+}
+
+int
+dontcall_body_cb (http_parser *p, const char *buf, size_t len)
+{
+ if (p || buf || len) { } // gcc
+ fprintf(stderr, "\n\n*** on_body_cb() called on paused parser ***\n\n");
+ abort();
+}
+
+int
+dontcall_headers_complete_cb (http_parser *p)
+{
+ if (p) { } // gcc
+ fprintf(stderr, "\n\n*** on_headers_complete() called on paused "
+ "parser ***\n\n");
+ abort();
+}
+
+int
+dontcall_message_complete_cb (http_parser *p)
+{
+ if (p) { } // gcc
+ fprintf(stderr, "\n\n*** on_message_complete() called on paused "
+ "parser ***\n\n");
+ abort();
+}
+
+int
+dontcall_response_status_cb (http_parser *p, const char *buf, size_t len)
+{
+ if (p || buf || len) { } // gcc
+ fprintf(stderr, "\n\n*** on_status() called on paused parser ***\n\n");
+ abort();
+}
+
+int
+dontcall_chunk_header_cb (http_parser *p)
+{
+ if (p) { } // gcc
+ fprintf(stderr, "\n\n*** on_chunk_header() called on paused parser ***\n\n");
+ exit(1);
+}
+
+int
+dontcall_chunk_complete_cb (http_parser *p)
+{
+ if (p) { } // gcc
+ fprintf(stderr, "\n\n*** on_chunk_complete() "
+ "called on paused parser ***\n\n");
+ exit(1);
+}
+
+static http_parser_settings settings_dontcall =
+ {.on_message_begin = dontcall_message_begin_cb
+ ,.on_header_field = dontcall_header_field_cb
+ ,.on_header_value = dontcall_header_value_cb
+ ,.on_url = dontcall_request_url_cb
+ ,.on_status = dontcall_response_status_cb
+ ,.on_body = dontcall_body_cb
+ ,.on_headers_complete = dontcall_headers_complete_cb
+ ,.on_message_complete = dontcall_message_complete_cb
+ ,.on_chunk_header = dontcall_chunk_header_cb
+ ,.on_chunk_complete = dontcall_chunk_complete_cb
+ };
+
+/* These pause_* callbacks always pause the parser and just invoke the regular
+ * callback that tracks content. Before returning, we overwrite the parser
+ * settings to point to the _dontcall variety so that we can verify that
+ * the pause actually did, you know, pause. */
+int
+pause_message_begin_cb (http_parser *p)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return message_begin_cb(p);
+}
+
+int
+pause_header_field_cb (http_parser *p, const char *buf, size_t len)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return header_field_cb(p, buf, len);
+}
+
+int
+pause_header_value_cb (http_parser *p, const char *buf, size_t len)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return header_value_cb(p, buf, len);
+}
+
+int
+pause_request_url_cb (http_parser *p, const char *buf, size_t len)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return request_url_cb(p, buf, len);
+}
+
+int
+pause_body_cb (http_parser *p, const char *buf, size_t len)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return body_cb(p, buf, len);
+}
+
+int
+pause_headers_complete_cb (http_parser *p)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return headers_complete_cb(p);
+}
+
+int
+pause_message_complete_cb (http_parser *p)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return message_complete_cb(p);
+}
+
+int
+pause_response_status_cb (http_parser *p, const char *buf, size_t len)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return response_status_cb(p, buf, len);
+}
+
+int
+pause_chunk_header_cb (http_parser *p)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return chunk_header_cb(p);
+}
+
+int
+pause_chunk_complete_cb (http_parser *p)
+{
+ http_parser_pause(p, 1);
+ *current_pause_parser = settings_dontcall;
+ return chunk_complete_cb(p);
+}
+
+static http_parser_settings settings_pause =
+ {.on_message_begin = pause_message_begin_cb
+ ,.on_header_field = pause_header_field_cb
+ ,.on_header_value = pause_header_value_cb
+ ,.on_url = pause_request_url_cb
+ ,.on_status = pause_response_status_cb
+ ,.on_body = pause_body_cb
+ ,.on_headers_complete = pause_headers_complete_cb
+ ,.on_message_complete = pause_message_complete_cb
+ ,.on_chunk_header = pause_chunk_header_cb
+ ,.on_chunk_complete = pause_chunk_complete_cb
+ };
+
+static http_parser_settings settings =
+ {.on_message_begin = message_begin_cb
+ ,.on_header_field = header_field_cb
+ ,.on_header_value = header_value_cb
+ ,.on_url = request_url_cb
+ ,.on_status = response_status_cb
+ ,.on_body = body_cb
+ ,.on_headers_complete = headers_complete_cb
+ ,.on_message_complete = message_complete_cb
+ ,.on_chunk_header = chunk_header_cb
+ ,.on_chunk_complete = chunk_complete_cb
+ };
+
+static http_parser_settings settings_count_body =
+ {.on_message_begin = message_begin_cb
+ ,.on_header_field = header_field_cb
+ ,.on_header_value = header_value_cb
+ ,.on_url = request_url_cb
+ ,.on_status = response_status_cb
+ ,.on_body = count_body_cb
+ ,.on_headers_complete = headers_complete_cb
+ ,.on_message_complete = message_complete_cb
+ ,.on_chunk_header = chunk_header_cb
+ ,.on_chunk_complete = chunk_complete_cb
+ };
+
+static http_parser_settings settings_null =
+ {.on_message_begin = 0
+ ,.on_header_field = 0
+ ,.on_header_value = 0
+ ,.on_url = 0
+ ,.on_status = 0
+ ,.on_body = 0
+ ,.on_headers_complete = 0
+ ,.on_message_complete = 0
+ ,.on_chunk_header = 0
+ ,.on_chunk_complete = 0
+ };
+
+void
+parser_init (enum http_parser_type type)
+{
+ num_messages = 0;
+
+ assert(parser == NULL);
+
+ parser = malloc(sizeof(http_parser));
+
+ http_parser_init(parser, type);
+
+ memset(&messages, 0, sizeof messages);
+
+}
+
+void
+parser_free ()
+{
+ assert(parser);
+ free(parser);
+ parser = NULL;
+}
+
+size_t parse (const char *buf, size_t len)
+{
+ size_t nparsed;
+ currently_parsing_eof = (len == 0);
+ nparsed = http_parser_execute(parser, &settings, buf, len);
+ return nparsed;
+}
+
+size_t parse_count_body (const char *buf, size_t len)
+{
+ size_t nparsed;
+ currently_parsing_eof = (len == 0);
+ nparsed = http_parser_execute(parser, &settings_count_body, buf, len);
+ return nparsed;
+}
+
+size_t parse_pause (const char *buf, size_t len)
+{
+ size_t nparsed;
+ http_parser_settings s = settings_pause;
+
+ currently_parsing_eof = (len == 0);
+ current_pause_parser = &s;
+ nparsed = http_parser_execute(parser, current_pause_parser, buf, len);
+ return nparsed;
+}
+
+static inline int
+check_str_eq (const struct message *m,
+ const char *prop,
+ const char *expected,
+ const char *found) {
+ if ((expected == NULL) != (found == NULL)) {
+ printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name);
+ printf("expected %s\n", (expected == NULL) ? "NULL" : expected);
+ printf(" found %s\n", (found == NULL) ? "NULL" : found);
+ return 0;
+ }
+ if (expected != NULL && 0 != strcmp(expected, found)) {
+ printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name);
+ printf("expected '%s'\n", expected);
+ printf(" found '%s'\n", found);
+ return 0;
+ }
+ return 1;
+}
+
+static inline int
+check_num_eq (const struct message *m,
+ const char *prop,
+ int expected,
+ int found) {
+ if (expected != found) {
+ printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name);
+ printf("expected %d\n", expected);
+ printf(" found %d\n", found);
+ return 0;
+ }
+ return 1;
+}
+
+#define MESSAGE_CHECK_STR_EQ(expected, found, prop) \
+ if (!check_str_eq(expected, #prop, expected->prop, found->prop)) return 0
+
+#define MESSAGE_CHECK_NUM_EQ(expected, found, prop) \
+ if (!check_num_eq(expected, #prop, expected->prop, found->prop)) return 0
+
+#define MESSAGE_CHECK_URL_EQ(u, expected, found, prop, fn) \
+do { \
+ char ubuf[256]; \
+ \
+ if ((u)->field_set & (1 << (fn))) { \
+ memcpy(ubuf, (found)->request_url + (u)->field_data[(fn)].off, \
+ (u)->field_data[(fn)].len); \
+ ubuf[(u)->field_data[(fn)].len] = '\0'; \
+ } else { \
+ ubuf[0] = '\0'; \
+ } \
+ \
+ check_str_eq(expected, #prop, expected->prop, ubuf); \
+} while(0)
+
+int
+message_eq (int index, const struct message *expected)
+{
+ int i;
+ struct message *m = &messages[index];
+
+ MESSAGE_CHECK_NUM_EQ(expected, m, http_major);
+ MESSAGE_CHECK_NUM_EQ(expected, m, http_minor);
+
+ if (expected->type == HTTP_REQUEST) {
+ MESSAGE_CHECK_NUM_EQ(expected, m, method);
+ } else {
+ MESSAGE_CHECK_NUM_EQ(expected, m, status_code);
+ MESSAGE_CHECK_STR_EQ(expected, m, response_status);
+ }
+
+ MESSAGE_CHECK_NUM_EQ(expected, m, should_keep_alive);
+ MESSAGE_CHECK_NUM_EQ(expected, m, message_complete_on_eof);
+
+ assert(m->message_begin_cb_called);
+ assert(m->headers_complete_cb_called);
+ assert(m->message_complete_cb_called);
+
+
+ MESSAGE_CHECK_STR_EQ(expected, m, request_url);
+
+ /* Check URL components; we can't do this w/ CONNECT since it doesn't
+ * send us a well-formed URL.
+ */
+ if (*m->request_url && m->method != HTTP_CONNECT) {
+ struct http_parser_url u;
+
+ if (http_parser_parse_url(m->request_url, strlen(m->request_url), 0, &u)) {
+ fprintf(stderr, "\n\n*** failed to parse URL %s ***\n\n",
+ m->request_url);
+ abort();
+ }
+
+ if (expected->host) {
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, host, UF_HOST);
+ }
+
+ if (expected->userinfo) {
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, userinfo, UF_USERINFO);
+ }
+
+ m->port = (u.field_set & (1 << UF_PORT)) ?
+ u.port : 0;
+
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, query_string, UF_QUERY);
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, fragment, UF_FRAGMENT);
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, request_path, UF_PATH);
+ MESSAGE_CHECK_NUM_EQ(expected, m, port);
+ }
+
+ if (expected->body_size) {
+ MESSAGE_CHECK_NUM_EQ(expected, m, body_size);
+ } else {
+ MESSAGE_CHECK_STR_EQ(expected, m, body);
+ }
+
+ assert(m->num_chunks == m->num_chunks_complete);
+ MESSAGE_CHECK_NUM_EQ(expected, m, num_chunks_complete);
+ for (i = 0; i < m->num_chunks && i < MAX_CHUNKS; i++) {
+ MESSAGE_CHECK_NUM_EQ(expected, m, chunk_lengths[i]);
+ }
+
+ MESSAGE_CHECK_NUM_EQ(expected, m, num_headers);
+
+ int r;
+ for (i = 0; i < m->num_headers; i++) {
+ r = check_str_eq(expected, "header field", expected->headers[i][0], m->headers[i][0]);
+ if (!r) return 0;
+ r = check_str_eq(expected, "header value", expected->headers[i][1], m->headers[i][1]);
+ if (!r) return 0;
+ }
+
+ MESSAGE_CHECK_STR_EQ(expected, m, upgrade);
+
+ return 1;
+}
+
+/* Given a sequence of varargs messages, return the number of them that the
+ * parser should successfully parse, taking into account that upgraded
+ * messages prevent all subsequent messages from being parsed.
+ */
+size_t
+count_parsed_messages(const size_t nmsgs, ...) {
+ size_t i;
+ va_list ap;
+
+ va_start(ap, nmsgs);
+
+ for (i = 0; i < nmsgs; i++) {
+ struct message *m = va_arg(ap, struct message *);
+
+ if (m->upgrade) {
+ va_end(ap);
+ return i + 1;
+ }
+ }
+
+ va_end(ap);
+ return nmsgs;
+}
+
+/* Given a sequence of bytes and the number of these that we were able to
+ * parse, verify that upgrade bodies are correct.
+ */
+void
+upgrade_message_fix(char *body, const size_t nread, const size_t nmsgs, ...) {
+ va_list ap;
+ size_t i;
+ size_t off = 0;
+
+ va_start(ap, nmsgs);
+
+ for (i = 0; i < nmsgs; i++) {
+ struct message *m = va_arg(ap, struct message *);
+
+ off += strlen(m->raw);
+
+ if (m->upgrade) {
+ off -= strlen(m->upgrade);
+
+ /* Check the portion of the response after its specified upgrade */
+ if (!check_str_eq(m, "upgrade", body + off, body + nread)) {
+ abort();
+ }
+
+ /* Fix up the response so that message_eq() will verify the beginning
+ * of the upgrade */
+ *(body + nread + strlen(m->upgrade)) = '\0';
+ messages[num_messages -1 ].upgrade = body + nread;
+
+ va_end(ap);
+ return;
+ }
+ }
+
+ va_end(ap);
+ printf("\n\n*** Error: expected a message with upgrade ***\n");
+
+ abort();
+}
+
+static void
+print_error (const char *raw, size_t error_location)
+{
+ fprintf(stderr, "\n*** %s ***\n\n",
+ http_errno_description(HTTP_PARSER_ERRNO(parser)));
+
+ int this_line = 0, char_len = 0;
+ size_t i, j, len = strlen(raw), error_location_line = 0;
+ for (i = 0; i < len; i++) {
+ if (i == error_location) this_line = 1;
+ switch (raw[i]) {
+ case '\r':
+ char_len = 2;
+ fprintf(stderr, "\\r");
+ break;
+
+ case '\n':
+ fprintf(stderr, "\\n\n");
+
+ if (this_line) goto print;
+
+ error_location_line = 0;
+ continue;
+
+ default:
+ char_len = 1;
+ fputc(raw[i], stderr);
+ break;
+ }
+ if (!this_line) error_location_line += char_len;
+ }
+
+ fprintf(stderr, "[eof]\n");
+
+ print:
+ for (j = 0; j < error_location_line; j++) {
+ fputc(' ', stderr);
+ }
+ fprintf(stderr, "^\n\nerror location: %u\n", (unsigned int)error_location);
+}
+
+void
+test_preserve_data (void)
+{
+ char my_data[] = "application-specific data";
+ http_parser parser;
+ parser.data = my_data;
+ http_parser_init(&parser, HTTP_REQUEST);
+ if (parser.data != my_data) {
+ printf("\n*** parser.data not preserved accross http_parser_init ***\n\n");
+ abort();
+ }
+}
+
+struct url_test {
+ const char *name;
+ const char *url;
+ int is_connect;
+ struct http_parser_url u;
+ int rv;
+};
+
+const struct url_test url_tests[] =
+{ {.name="proxy request"
+ ,.url="http://hostname/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 7, 8 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 15, 1 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="proxy request with port"
+ ,.url="http://hostname:444/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PORT) | (1 << UF_PATH)
+ ,.port=444
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 7, 8 } /* UF_HOST */
+ ,{ 16, 3 } /* UF_PORT */
+ ,{ 19, 1 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="CONNECT request"
+ ,.url="hostname:443"
+ ,.is_connect=1
+ ,.u=
+ {.field_set=(1 << UF_HOST) | (1 << UF_PORT)
+ ,.port=443
+ ,.field_data=
+ {{ 0, 0 } /* UF_SCHEMA */
+ ,{ 0, 8 } /* UF_HOST */
+ ,{ 9, 3 } /* UF_PORT */
+ ,{ 0, 0 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="CONNECT request but not connect"
+ ,.url="hostname:443"
+ ,.is_connect=0
+ ,.rv=1
+ }
+
+, {.name="proxy ipv6 request"
+ ,.url="http://[1:2::3:4]/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 8, 8 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 17, 1 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="proxy ipv6 request with port"
+ ,.url="http://[1:2::3:4]:67/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PORT) | (1 << UF_PATH)
+ ,.port=67
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 8, 8 } /* UF_HOST */
+ ,{ 18, 2 } /* UF_PORT */
+ ,{ 20, 1 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="CONNECT ipv6 address"
+ ,.url="[1:2::3:4]:443"
+ ,.is_connect=1
+ ,.u=
+ {.field_set=(1 << UF_HOST) | (1 << UF_PORT)
+ ,.port=443
+ ,.field_data=
+ {{ 0, 0 } /* UF_SCHEMA */
+ ,{ 1, 8 } /* UF_HOST */
+ ,{ 11, 3 } /* UF_PORT */
+ ,{ 0, 0 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="ipv4 in ipv6 address"
+ ,.url="http://[2001:0000:0000:0000:0000:0000:1.9.1.1]/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 8, 37 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 46, 1 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="extra ? in query string"
+ ,.url="http://a.tbcdn.cn/p/fp/2010c/??fp-header-min.css,fp-base-min.css,"
+ "fp-channel-min.css,fp-product-min.css,fp-mall-min.css,fp-category-min.css,"
+ "fp-sub-min.css,fp-gdp4p-min.css,fp-css3-min.css,fp-misc-min.css?t=20101022.css"
+ ,.is_connect=0
+ ,.u=
+ {.field_set=(1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_QUERY)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 7, 10 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 17, 12 } /* UF_PATH */
+ ,{ 30,187 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="space URL encoded"
+ ,.url="/toto.html?toto=a%20b"
+ ,.is_connect=0
+ ,.u=
+ {.field_set= (1<<UF_PATH) | (1<<UF_QUERY)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 0 } /* UF_SCHEMA */
+ ,{ 0, 0 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 0, 10 } /* UF_PATH */
+ ,{ 11, 10 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+
+, {.name="URL fragment"
+ ,.url="/toto.html#titi"
+ ,.is_connect=0
+ ,.u=
+ {.field_set= (1<<UF_PATH) | (1<<UF_FRAGMENT)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 0 } /* UF_SCHEMA */
+ ,{ 0, 0 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 0, 10 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 11, 4 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="complex URL fragment"
+ ,.url="http://www.webmasterworld.com/r.cgi?f=21&d=8405&url="
+ "http://www.example.com/index.html?foo=bar&hello=world#midpage"
+ ,.is_connect=0
+ ,.u=
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_QUERY) |\
+ (1<<UF_FRAGMENT)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 7, 22 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 29, 6 } /* UF_PATH */
+ ,{ 36, 69 } /* UF_QUERY */
+ ,{106, 7 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="complex URL from node js url parser doc"
+ ,.url="http://host.com:8080/p/a/t/h?query=string#hash"
+ ,.is_connect=0
+ ,.u=
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PORT) | (1<<UF_PATH) |\
+ (1<<UF_QUERY) | (1<<UF_FRAGMENT)
+ ,.port=8080
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 7, 8 } /* UF_HOST */
+ ,{ 16, 4 } /* UF_PORT */
+ ,{ 20, 8 } /* UF_PATH */
+ ,{ 29, 12 } /* UF_QUERY */
+ ,{ 42, 4 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="complex URL with basic auth from node js url parser doc"
+ ,.url="http://a:b@host.com:8080/p/a/t/h?query=string#hash"
+ ,.is_connect=0
+ ,.u=
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PORT) | (1<<UF_PATH) |\
+ (1<<UF_QUERY) | (1<<UF_FRAGMENT) | (1<<UF_USERINFO)
+ ,.port=8080
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 11, 8 } /* UF_HOST */
+ ,{ 20, 4 } /* UF_PORT */
+ ,{ 24, 8 } /* UF_PATH */
+ ,{ 33, 12 } /* UF_QUERY */
+ ,{ 46, 4 } /* UF_FRAGMENT */
+ ,{ 7, 3 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="double @"
+ ,.url="http://a:b@@hostname:443/"
+ ,.is_connect=0
+ ,.rv=1
+ }
+
+, {.name="proxy empty host"
+ ,.url="http://:443/"
+ ,.is_connect=0
+ ,.rv=1
+ }
+
+, {.name="proxy empty port"
+ ,.url="http://hostname:/"
+ ,.is_connect=0
+ ,.rv=1
+ }
+
+, {.name="CONNECT with basic auth"
+ ,.url="a:b@hostname:443"
+ ,.is_connect=1
+ ,.rv=1
+ }
+
+, {.name="CONNECT empty host"
+ ,.url=":443"
+ ,.is_connect=1
+ ,.rv=1
+ }
+
+, {.name="CONNECT empty port"
+ ,.url="hostname:"
+ ,.is_connect=1
+ ,.rv=1
+ }
+
+, {.name="CONNECT with extra bits"
+ ,.url="hostname:443/"
+ ,.is_connect=1
+ ,.rv=1
+ }
+
+, {.name="space in URL"
+ ,.url="/foo bar/"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy basic auth with space url encoded"
+ ,.url="http://a%20:b@host.com/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 14, 8 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 22, 1 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 7, 6 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="carriage return in URL"
+ ,.url="/foo\rbar/"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy double : in URL"
+ ,.url="http://hostname::443/"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy basic auth with double :"
+ ,.url="http://a::b@host.com/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 12, 8 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 20, 1 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 7, 4 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="line feed in URL"
+ ,.url="/foo\nbar/"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy empty basic auth"
+ ,.url="http://@hostname/fo"
+ ,.u=
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 8, 8 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 16, 3 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+, {.name="proxy line feed in hostname"
+ ,.url="http://host\name/fo"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy % in hostname"
+ ,.url="http://host%name/fo"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy ; in hostname"
+ ,.url="http://host;ame/fo"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy basic auth with unreservedchars"
+ ,.url="http://a!;-_!=+$@host.com/"
+ ,.is_connect=0
+ ,.u=
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
+ ,.port=0
+ ,.field_data=
+ {{ 0, 4 } /* UF_SCHEMA */
+ ,{ 17, 8 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 25, 1 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 7, 9 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="proxy only empty basic auth"
+ ,.url="http://@/fo"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy only basic auth"
+ ,.url="http://toto@/fo"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy emtpy hostname"
+ ,.url="http:///fo"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="proxy = in URL"
+ ,.url="http://host=ame/fo"
+ ,.rv=1 /* s_dead */
+ }
+
+#if HTTP_PARSER_STRICT
+
+, {.name="tab in URL"
+ ,.url="/foo\tbar/"
+ ,.rv=1 /* s_dead */
+ }
+
+, {.name="form feed in URL"
+ ,.url="/foo\fbar/"
+ ,.rv=1 /* s_dead */
+ }
+
+#else /* !HTTP_PARSER_STRICT */
+
+, {.name="tab in URL"
+ ,.url="/foo\tbar/"
+ ,.u=
+ {.field_set=(1 << UF_PATH)
+ ,.field_data=
+ {{ 0, 0 } /* UF_SCHEMA */
+ ,{ 0, 0 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 0, 9 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+
+, {.name="form feed in URL"
+ ,.url="/foo\fbar/"
+ ,.u=
+ {.field_set=(1 << UF_PATH)
+ ,.field_data=
+ {{ 0, 0 } /* UF_SCHEMA */
+ ,{ 0, 0 } /* UF_HOST */
+ ,{ 0, 0 } /* UF_PORT */
+ ,{ 0, 9 } /* UF_PATH */
+ ,{ 0, 0 } /* UF_QUERY */
+ ,{ 0, 0 } /* UF_FRAGMENT */
+ ,{ 0, 0 } /* UF_USERINFO */
+ }
+ }
+ ,.rv=0
+ }
+#endif
+};
+
+void
+dump_url (const char *url, const struct http_parser_url *u)
+{
+ unsigned int i;
+
+ printf("\tfield_set: 0x%x, port: %u\n", u->field_set, u->port);
+ for (i = 0; i < UF_MAX; i++) {
+ if ((u->field_set & (1 << i)) == 0) {
+ printf("\tfield_data[%u]: unset\n", i);
+ continue;
+ }
+
+ printf("\tfield_data[%u]: off: %u len: %u part: \"%.*s\n\"",
+ i,
+ u->field_data[i].off,
+ u->field_data[i].len,
+ u->field_data[i].len,
+ url + u->field_data[i].off);
+ }
+}
+
+void
+test_parse_url (void)
+{
+ struct http_parser_url u;
+ const struct url_test *test;
+ unsigned int i;
+ int rv;
+
+ for (i = 0; i < (sizeof(url_tests) / sizeof(url_tests[0])); i++) {
+ test = &url_tests[i];
+ memset(&u, 0, sizeof(u));
+
+ rv = http_parser_parse_url(test->url,
+ strlen(test->url),
+ test->is_connect,
+ &u);
+
+ if (test->rv == 0) {
+ if (rv != 0) {
+ printf("\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, "
+ "unexpected rv %d ***\n\n", test->url, test->name, rv);
+ abort();
+ }
+
+ if (memcmp(&u, &test->u, sizeof(u)) != 0) {
+ printf("\n*** http_parser_parse_url(\"%s\") \"%s\" failed ***\n",
+ test->url, test->name);
+
+ printf("target http_parser_url:\n");
+ dump_url(test->url, &test->u);
+ printf("result http_parser_url:\n");
+ dump_url(test->url, &u);
+
+ abort();
+ }
+ } else {
+ /* test->rv != 0 */
+ if (rv == 0) {
+ printf("\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, "
+ "unexpected rv %d ***\n\n", test->url, test->name, rv);
+ abort();
+ }
+ }
+ }
+}
+
+void
+test_method_str (void)
+{
+ assert(0 == strcmp("GET", http_method_str(HTTP_GET)));
+ assert(0 == strcmp("<unknown>", http_method_str(1337)));
+}
+
+void
+test_message (const struct message *message)
+{
+ size_t raw_len = strlen(message->raw);
+ size_t msg1len;
+ for (msg1len = 0; msg1len < raw_len; msg1len++) {
+ parser_init(message->type);
+
+ size_t read;
+ const char *msg1 = message->raw;
+ const char *msg2 = msg1 + msg1len;
+ size_t msg2len = raw_len - msg1len;
+
+ if (msg1len) {
+ read = parse(msg1, msg1len);
+
+ if (message->upgrade && parser->upgrade && num_messages > 0) {
+ messages[num_messages - 1].upgrade = msg1 + read;
+ goto test;
+ }
+
+ if (read != msg1len) {
+ print_error(msg1, read);
+ abort();
+ }
+ }
+
+
+ read = parse(msg2, msg2len);
+
+ if (message->upgrade && parser->upgrade) {
+ messages[num_messages - 1].upgrade = msg2 + read;
+ goto test;
+ }
+
+ if (read != msg2len) {
+ print_error(msg2, read);
+ abort();
+ }
+
+ read = parse(NULL, 0);
+
+ if (read != 0) {
+ print_error(message->raw, read);
+ abort();
+ }
+
+ test:
+
+ if (num_messages != 1) {
+ printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name);
+ abort();
+ }
+
+ if(!message_eq(0, message)) abort();
+
+ parser_free();
+ }
+}
+
+void
+test_message_count_body (const struct message *message)
+{
+ parser_init(message->type);
+
+ size_t read;
+ size_t l = strlen(message->raw);
+ size_t i, toread;
+ size_t chunk = 4024;
+
+ for (i = 0; i < l; i+= chunk) {
+ toread = MIN(l-i, chunk);
+ read = parse_count_body(message->raw + i, toread);
+ if (read != toread) {
+ print_error(message->raw, read);
+ abort();
+ }
+ }
+
+
+ read = parse_count_body(NULL, 0);
+ if (read != 0) {
+ print_error(message->raw, read);
+ abort();
+ }
+
+ if (num_messages != 1) {
+ printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name);
+ abort();
+ }
+
+ if(!message_eq(0, message)) abort();
+
+ parser_free();
+}
+
+void
+test_simple (const char *buf, enum http_errno err_expected)
+{
+ parser_init(HTTP_REQUEST);
+
+ enum http_errno err;
+
+ parse(buf, strlen(buf));
+ err = HTTP_PARSER_ERRNO(parser);
+ parse(NULL, 0);
+
+ parser_free();
+
+ /* In strict mode, allow us to pass with an unexpected HPE_STRICT as
+ * long as the caller isn't expecting success.
+ */
+#if HTTP_PARSER_STRICT
+ if (err_expected != err && err_expected != HPE_OK && err != HPE_STRICT) {
+#else
+ if (err_expected != err) {
+#endif
+ fprintf(stderr, "\n*** test_simple expected %s, but saw %s ***\n\n%s\n",
+ http_errno_name(err_expected), http_errno_name(err), buf);
+ abort();
+ }
+}
+
+void
+test_header_overflow_error (int req)
+{
+ http_parser parser;
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
+ size_t parsed;
+ const char *buf;
+ buf = req ? "GET / HTTP/1.1\r\n" : "HTTP/1.0 200 OK\r\n";
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
+ assert(parsed == strlen(buf));
+
+ buf = "header-key: header-value\r\n";
+ size_t buflen = strlen(buf);
+
+ int i;
+ for (i = 0; i < 10000; i++) {
+ parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
+ if (parsed != buflen) {
+ //fprintf(stderr, "error found on iter %d\n", i);
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_HEADER_OVERFLOW);
+ return;
+ }
+ }
+
+ fprintf(stderr, "\n*** Error expected but none in header overflow test ***\n");
+ abort();
+}
+
+
+void
+test_header_nread_value ()
+{
+ http_parser parser;
+ http_parser_init(&parser, HTTP_REQUEST);
+ size_t parsed;
+ const char *buf;
+ buf = "GET / HTTP/1.1\r\nheader: value\nhdr: value\r\n";
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
+ assert(parsed == strlen(buf));
+
+ assert(parser.nread == strlen(buf));
+}
+
+
+static void
+test_content_length_overflow (const char *buf, size_t buflen, int expect_ok)
+{
+ http_parser parser;
+ http_parser_init(&parser, HTTP_RESPONSE);
+ http_parser_execute(&parser, &settings_null, buf, buflen);
+
+ if (expect_ok)
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_OK);
+ else
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_INVALID_CONTENT_LENGTH);
+}
+
+void
+test_header_content_length_overflow_error (void)
+{
+#define X(size) \
+ "HTTP/1.1 200 OK\r\n" \
+ "Content-Length: " #size "\r\n" \
+ "\r\n"
+ const char a[] = X(1844674407370955160); /* 2^64 / 10 - 1 */
+ const char b[] = X(18446744073709551615); /* 2^64-1 */
+ const char c[] = X(18446744073709551616); /* 2^64 */
+#undef X
+ test_content_length_overflow(a, sizeof(a) - 1, 1); /* expect ok */
+ test_content_length_overflow(b, sizeof(b) - 1, 0); /* expect failure */
+ test_content_length_overflow(c, sizeof(c) - 1, 0); /* expect failure */
+}
+
+void
+test_chunk_content_length_overflow_error (void)
+{
+#define X(size) \
+ "HTTP/1.1 200 OK\r\n" \
+ "Transfer-Encoding: chunked\r\n" \
+ "\r\n" \
+ #size "\r\n" \
+ "..."
+ const char a[] = X(FFFFFFFFFFFFFFE); /* 2^64 / 16 - 1 */
+ const char b[] = X(FFFFFFFFFFFFFFFF); /* 2^64-1 */
+ const char c[] = X(10000000000000000); /* 2^64 */
+#undef X
+ test_content_length_overflow(a, sizeof(a) - 1, 1); /* expect ok */
+ test_content_length_overflow(b, sizeof(b) - 1, 0); /* expect failure */
+ test_content_length_overflow(c, sizeof(c) - 1, 0); /* expect failure */
+}
+
+void
+test_no_overflow_long_body (int req, size_t length)
+{
+ http_parser parser;
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
+ size_t parsed;
+ size_t i;
+ char buf1[3000];
+ size_t buf1len = sprintf(buf1, "%s\r\nConnection: Keep-Alive\r\nContent-Length: %lu\r\n\r\n",
+ req ? "POST / HTTP/1.0" : "HTTP/1.0 200 OK", (unsigned long)length);
+ parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len);
+ if (parsed != buf1len)
+ goto err;
+
+ for (i = 0; i < length; i++) {
+ char foo = 'a';
+ parsed = http_parser_execute(&parser, &settings_null, &foo, 1);
+ if (parsed != 1)
+ goto err;
+ }
+
+ parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len);
+ if (parsed != buf1len) goto err;
+ return;
+
+ err:
+ fprintf(stderr,
+ "\n*** error in test_no_overflow_long_body %s of length %lu ***\n",
+ req ? "REQUEST" : "RESPONSE",
+ (unsigned long)length);
+ abort();
+}
+
+void
+test_multiple3 (const struct message *r1, const struct message *r2, const struct message *r3)
+{
+ int message_count = count_parsed_messages(3, r1, r2, r3);
+
+ char total[ strlen(r1->raw)
+ + strlen(r2->raw)
+ + strlen(r3->raw)
+ + 1
+ ];
+ total[0] = '\0';
+
+ strcat(total, r1->raw);
+ strcat(total, r2->raw);
+ strcat(total, r3->raw);
+
+ parser_init(r1->type);
+
+ size_t read;
+
+ read = parse(total, strlen(total));
+
+ if (parser->upgrade) {
+ upgrade_message_fix(total, read, 3, r1, r2, r3);
+ goto test;
+ }
+
+ if (read != strlen(total)) {
+ print_error(total, read);
+ abort();
+ }
+
+ read = parse(NULL, 0);
+
+ if (read != 0) {
+ print_error(total, read);
+ abort();
+ }
+
+test:
+
+ if (message_count != num_messages) {
+ fprintf(stderr, "\n\n*** Parser didn't see 3 messages only %d *** \n", num_messages);
+ abort();
+ }
+
+ if (!message_eq(0, r1)) abort();
+ if (message_count > 1 && !message_eq(1, r2)) abort();
+ if (message_count > 2 && !message_eq(2, r3)) abort();
+
+ parser_free();
+}
+
+/* SCAN through every possible breaking to make sure the
+ * parser can handle getting the content in any chunks that
+ * might come from the socket
+ */
+void
+test_scan (const struct message *r1, const struct message *r2, const struct message *r3)
+{
+ char total[80*1024] = "\0";
+ char buf1[80*1024] = "\0";
+ char buf2[80*1024] = "\0";
+ char buf3[80*1024] = "\0";
+
+ strcat(total, r1->raw);
+ strcat(total, r2->raw);
+ strcat(total, r3->raw);
+
+ size_t read;
+
+ int total_len = strlen(total);
+
+ int total_ops = 2 * (total_len - 1) * (total_len - 2) / 2;
+ int ops = 0 ;
+
+ size_t buf1_len, buf2_len, buf3_len;
+ int message_count = count_parsed_messages(3, r1, r2, r3);
+
+ int i,j,type_both;
+ for (type_both = 0; type_both < 2; type_both ++ ) {
+ for (j = 2; j < total_len; j ++ ) {
+ for (i = 1; i < j; i ++ ) {
+
+ if (ops % 1000 == 0) {
+ printf("\b\b\b\b%3.0f%%", 100 * (float)ops /(float)total_ops);
+ fflush(stdout);
+ }
+ ops += 1;
+
+ parser_init(type_both ? HTTP_BOTH : r1->type);
+
+ buf1_len = i;
+ strlncpy(buf1, sizeof(buf1), total, buf1_len);
+ buf1[buf1_len] = 0;
+
+ buf2_len = j - i;
+ strlncpy(buf2, sizeof(buf1), total+i, buf2_len);
+ buf2[buf2_len] = 0;
+
+ buf3_len = total_len - j;
+ strlncpy(buf3, sizeof(buf1), total+j, buf3_len);
+ buf3[buf3_len] = 0;
+
+ read = parse(buf1, buf1_len);
+
+ if (parser->upgrade) goto test;
+
+ if (read != buf1_len) {
+ print_error(buf1, read);
+ goto error;
+ }
+
+ read += parse(buf2, buf2_len);
+
+ if (parser->upgrade) goto test;
+
+ if (read != buf1_len + buf2_len) {
+ print_error(buf2, read);
+ goto error;
+ }
+
+ read += parse(buf3, buf3_len);
+
+ if (parser->upgrade) goto test;
+
+ if (read != buf1_len + buf2_len + buf3_len) {
+ print_error(buf3, read);
+ goto error;
+ }
+
+ parse(NULL, 0);
+
+test:
+ if (parser->upgrade) {
+ upgrade_message_fix(total, read, 3, r1, r2, r3);
+ }
+
+ if (message_count != num_messages) {
+ fprintf(stderr, "\n\nParser didn't see %d messages only %d\n",
+ message_count, num_messages);
+ goto error;
+ }
+
+ if (!message_eq(0, r1)) {
+ fprintf(stderr, "\n\nError matching messages[0] in test_scan.\n");
+ goto error;
+ }
+
+ if (message_count > 1 && !message_eq(1, r2)) {
+ fprintf(stderr, "\n\nError matching messages[1] in test_scan.\n");
+ goto error;
+ }
+
+ if (message_count > 2 && !message_eq(2, r3)) {
+ fprintf(stderr, "\n\nError matching messages[2] in test_scan.\n");
+ goto error;
+ }
+
+ parser_free();
+ }
+ }
+ }
+ puts("\b\b\b\b100%");
+ return;
+
+ error:
+ fprintf(stderr, "i=%d j=%d\n", i, j);
+ fprintf(stderr, "buf1 (%u) %s\n\n", (unsigned int)buf1_len, buf1);
+ fprintf(stderr, "buf2 (%u) %s\n\n", (unsigned int)buf2_len , buf2);
+ fprintf(stderr, "buf3 (%u) %s\n", (unsigned int)buf3_len, buf3);
+ abort();
+}
+
+// user required to free the result
+// string terminated by \0
+char *
+create_large_chunked_message (int body_size_in_kb, const char* headers)
+{
+ int i;
+ size_t wrote = 0;
+ size_t headers_len = strlen(headers);
+ size_t bufsize = headers_len + (5+1024+2)*body_size_in_kb + 6;
+ char * buf = malloc(bufsize);
+
+ memcpy(buf, headers, headers_len);
+ wrote += headers_len;
+
+ for (i = 0; i < body_size_in_kb; i++) {
+ // write 1kb chunk into the body.
+ memcpy(buf + wrote, "400\r\n", 5);
+ wrote += 5;
+ memset(buf + wrote, 'C', 1024);
+ wrote += 1024;
+ strcpy(buf + wrote, "\r\n");
+ wrote += 2;
+ }
+
+ memcpy(buf + wrote, "0\r\n\r\n", 6);
+ wrote += 6;
+ assert(wrote == bufsize);
+
+ return buf;
+}
+
+/* Verify that we can pause parsing at any of the bytes in the
+ * message and still get the result that we're expecting. */
+void
+test_message_pause (const struct message *msg)
+{
+ char *buf = (char*) msg->raw;
+ size_t buflen = strlen(msg->raw);
+ size_t nread;
+
+ parser_init(msg->type);
+
+ do {
+ nread = parse_pause(buf, buflen);
+
+ // We can only set the upgrade buffer once we've gotten our message
+ // completion callback.
+ if (messages[0].message_complete_cb_called &&
+ msg->upgrade &&
+ parser->upgrade) {
+ messages[0].upgrade = buf + nread;
+ goto test;
+ }
+
+ if (nread < buflen) {
+
+ // Not much do to if we failed a strict-mode check
+ if (HTTP_PARSER_ERRNO(parser) == HPE_STRICT) {
+ parser_free();
+ return;
+ }
+
+ assert (HTTP_PARSER_ERRNO(parser) == HPE_PAUSED);
+ }
+
+ buf += nread;
+ buflen -= nread;
+ http_parser_pause(parser, 0);
+ } while (buflen > 0);
+
+ nread = parse_pause(NULL, 0);
+ assert (nread == 0);
+
+test:
+ if (num_messages != 1) {
+ printf("\n*** num_messages != 1 after testing '%s' ***\n\n", msg->name);
+ abort();
+ }
+
+ if(!message_eq(0, msg)) abort();
+
+ parser_free();
+}
+
+int
+main (void)
+{
+ parser = NULL;
+ int i, j, k;
+ int request_count;
+ int response_count;
+ unsigned long version;
+ unsigned major;
+ unsigned minor;
+ unsigned patch;
+
+ version = http_parser_version();
+ major = (version >> 16) & 255;
+ minor = (version >> 8) & 255;
+ patch = version & 255;
+ printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version);
+
+ printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser));
+
+ for (request_count = 0; requests[request_count].name; request_count++);
+ for (response_count = 0; responses[response_count].name; response_count++);
+
+ //// API
+ test_preserve_data();
+ test_parse_url();
+ test_method_str();
+
+ //// NREAD
+ test_header_nread_value();
+
+ //// OVERFLOW CONDITIONS
+
+ test_header_overflow_error(HTTP_REQUEST);
+ test_no_overflow_long_body(HTTP_REQUEST, 1000);
+ test_no_overflow_long_body(HTTP_REQUEST, 100000);
+
+ test_header_overflow_error(HTTP_RESPONSE);
+ test_no_overflow_long_body(HTTP_RESPONSE, 1000);
+ test_no_overflow_long_body(HTTP_RESPONSE, 100000);
+
+ test_header_content_length_overflow_error();
+ test_chunk_content_length_overflow_error();
+
+ //// RESPONSES
+
+ for (i = 0; i < response_count; i++) {
+ test_message(&responses[i]);
+ }
+
+ for (i = 0; i < response_count; i++) {
+ test_message_pause(&responses[i]);
+ }
+
+ for (i = 0; i < response_count; i++) {
+ if (!responses[i].should_keep_alive) continue;
+ for (j = 0; j < response_count; j++) {
+ if (!responses[j].should_keep_alive) continue;
+ for (k = 0; k < response_count; k++) {
+ test_multiple3(&responses[i], &responses[j], &responses[k]);
+ }
+ }
+ }
+
+ test_message_count_body(&responses[NO_HEADERS_NO_BODY_404]);
+ test_message_count_body(&responses[TRAILING_SPACE_ON_CHUNKED_BODY]);
+
+ // test very large chunked response
+ {
+ char * msg = create_large_chunked_message(31337,
+ "HTTP/1.0 200 OK\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "Content-Type: text/plain\r\n"
+ "\r\n");
+ struct message large_chunked =
+ {.name= "large chunked"
+ ,.type= HTTP_RESPONSE
+ ,.raw= msg
+ ,.should_keep_alive= FALSE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 0
+ ,.status_code= 200
+ ,.response_status= "OK"
+ ,.num_headers= 2
+ ,.headers=
+ { { "Transfer-Encoding", "chunked" }
+ , { "Content-Type", "text/plain" }
+ }
+ ,.body_size= 31337*1024
+ ,.num_chunks_complete= 31338
+ };
+ for (i = 0; i < MAX_CHUNKS; i++) {
+ large_chunked.chunk_lengths[i] = 1024;
+ }
+ test_message_count_body(&large_chunked);
+ free(msg);
+ }
+
+
+
+ printf("response scan 1/2 ");
+ test_scan( &responses[TRAILING_SPACE_ON_CHUNKED_BODY]
+ , &responses[NO_BODY_HTTP10_KA_204]
+ , &responses[NO_REASON_PHRASE]
+ );
+
+ printf("response scan 2/2 ");
+ test_scan( &responses[BONJOUR_MADAME_FR]
+ , &responses[UNDERSTORE_HEADER_KEY]
+ , &responses[NO_CARRIAGE_RET]
+ );
+
+ puts("responses okay");
+
+
+ /// REQUESTS
+
+ test_simple("GET / HTP/1.1\r\n\r\n", HPE_INVALID_VERSION);
+
+ // Well-formed but incomplete
+ test_simple("GET / HTTP/1.1\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Length: 6\r\n"
+ "\r\n"
+ "fooba",
+ HPE_OK);
+
+ static const char *all_methods[] = {
+ "DELETE",
+ "GET",
+ "HEAD",
+ "POST",
+ "PUT",
+ //"CONNECT", //CONNECT can't be tested like other methods, it's a tunnel
+ "OPTIONS",
+ "TRACE",
+ "COPY",
+ "LOCK",
+ "MKCOL",
+ "MOVE",
+ "PROPFIND",
+ "PROPPATCH",
+ "UNLOCK",
+ "REPORT",
+ "MKACTIVITY",
+ "CHECKOUT",
+ "MERGE",
+ "M-SEARCH",
+ "NOTIFY",
+ "SUBSCRIBE",
+ "UNSUBSCRIBE",
+ "PATCH",
+ 0 };
+ const char **this_method;
+ for (this_method = all_methods; *this_method; this_method++) {
+ char buf[200];
+ sprintf(buf, "%s / HTTP/1.1\r\n\r\n", *this_method);
+ test_simple(buf, HPE_OK);
+ }
+
+ static const char *bad_methods[] = {
+ "ASDF",
+ "C******",
+ "COLA",
+ "GEM",
+ "GETA",
+ "M****",
+ "MKCOLA",
+ "PROPPATCHA",
+ "PUN",
+ "PX",
+ "SA",
+ "hello world",
+ 0 };
+ for (this_method = bad_methods; *this_method; this_method++) {
+ char buf[200];
+ sprintf(buf, "%s / HTTP/1.1\r\n\r\n", *this_method);
+ test_simple(buf, HPE_INVALID_METHOD);
+ }
+
+ // illegal header field name line folding
+ test_simple("GET / HTTP/1.1\r\n"
+ "name\r\n"
+ " : value\r\n"
+ "\r\n",
+ HPE_INVALID_HEADER_TOKEN);
+
+ const char *dumbfuck2 =
+ "GET / HTTP/1.1\r\n"
+ "X-SSL-Bullshit: -----BEGIN CERTIFICATE-----\r\n"
+ "\tMIIFbTCCBFWgAwIBAgICH4cwDQYJKoZIhvcNAQEFBQAwcDELMAkGA1UEBhMCVUsx\r\n"
+ "\tETAPBgNVBAoTCGVTY2llbmNlMRIwEAYDVQQLEwlBdXRob3JpdHkxCzAJBgNVBAMT\r\n"
+ "\tAkNBMS0wKwYJKoZIhvcNAQkBFh5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMu\r\n"
+ "\tdWswHhcNMDYwNzI3MTQxMzI4WhcNMDcwNzI3MTQxMzI4WjBbMQswCQYDVQQGEwJV\r\n"
+ "\tSzERMA8GA1UEChMIZVNjaWVuY2UxEzARBgNVBAsTCk1hbmNoZXN0ZXIxCzAJBgNV\r\n"
+ "\tBAcTmrsogriqMWLAk1DMRcwFQYDVQQDEw5taWNoYWVsIHBhcmQYJKoZIhvcNAQEB\r\n"
+ "\tBQADggEPADCCAQoCggEBANPEQBgl1IaKdSS1TbhF3hEXSl72G9J+WC/1R64fAcEF\r\n"
+ "\tW51rEyFYiIeZGx/BVzwXbeBoNUK41OK65sxGuflMo5gLflbwJtHBRIEKAfVVp3YR\r\n"
+ "\tgW7cMA/s/XKgL1GEC7rQw8lIZT8RApukCGqOVHSi/F1SiFlPDxuDfmdiNzL31+sL\r\n"
+ "\t0iwHDdNkGjy5pyBSB8Y79dsSJtCW/iaLB0/n8Sj7HgvvZJ7x0fr+RQjYOUUfrePP\r\n"
+ "\tu2MSpFyf+9BbC/aXgaZuiCvSR+8Snv3xApQY+fULK/xY8h8Ua51iXoQ5jrgu2SqR\r\n"
+ "\twgA7BUi3G8LFzMBl8FRCDYGUDy7M6QaHXx1ZWIPWNKsCAwEAAaOCAiQwggIgMAwG\r\n"
+ "\tA1UdEwEB/wQCMAAwEQYJYIZIAYb4QgHTTPAQDAgWgMA4GA1UdDwEB/wQEAwID6DAs\r\n"
+ "\tBglghkgBhvhCAQ0EHxYdVUsgZS1TY2llbmNlIFVzZXIgQ2VydGlmaWNhdGUwHQYD\r\n"
+ "\tVR0OBBYEFDTt/sf9PeMaZDHkUIldrDYMNTBZMIGaBgNVHSMEgZIwgY+AFAI4qxGj\r\n"
+ "\tloCLDdMVKwiljjDastqooXSkcjBwMQswCQYDVQQGEwJVSzERMA8GA1UEChMIZVNj\r\n"
+ "\taWVuY2UxEjAQBgNVBAsTCUF1dGhvcml0eTELMAkGA1UEAxMCQ0ExLTArBgkqhkiG\r\n"
+ "\t9w0BCQEWHmNhLW9wZXJhdG9yQGdyaWQtc3VwcG9ydC5hYy51a4IBADApBgNVHRIE\r\n"
+ "\tIjAggR5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMudWswGQYDVR0gBBIwEDAO\r\n"
+ "\tBgwrBgEEAdkvAQEBAQYwPQYJYIZIAYb4QgEEBDAWLmh0dHA6Ly9jYS5ncmlkLXN1\r\n"
+ "\tcHBvcnQuYWMudmT4sopwqlBWsvcHViL2NybC9jYWNybC5jcmwwPQYJYIZIAYb4QgEDBDAWLmh0\r\n"
+ "\tdHA6Ly9jYS5ncmlkLXN1cHBvcnQuYWMudWsvcHViL2NybC9jYWNybC5jcmwwPwYD\r\n"
+ "\tVR0fBDgwNjA0oDKgMIYuaHR0cDovL2NhLmdyaWQt5hYy51ay9wdWIv\r\n"
+ "\tY3JsL2NhY3JsLmNybDANBgkqhkiG9w0BAQUFAAOCAQEAS/U4iiooBENGW/Hwmmd3\r\n"
+ "\tXCy6Zrt08YjKCzGNjorT98g8uGsqYjSxv/hmi0qlnlHs+k/3Iobc3LjS5AMYr5L8\r\n"
+ "\tUO7OSkgFFlLHQyC9JzPfmLCAugvzEbyv4Olnsr8hbxF1MbKZoQxUZtMVu29wjfXk\r\n"
+ "\thTeApBv7eaKCWpSp7MCbvgzm74izKhu3vlDk9w6qVrxePfGgpKPqfHiOoGhFnbTK\r\n"
+ "\twTC6o2xq5y0qZ03JonF7OJspEd3I5zKY3E+ov7/ZhW6DqT8UFvsAdjvQbXyhV8Eu\r\n"
+ "\tYhixw1aKEPzNjNowuIseVogKOLXxWI5vAi5HgXdS0/ES5gDGsABo4fqovUKlgop3\r\n"
+ "\tRA==\r\n"
+ "\t-----END CERTIFICATE-----\r\n"
+ "\r\n";
+ test_simple(dumbfuck2, HPE_OK);
+
+ const char *corrupted_connection =
+ "GET / HTTP/1.1\r\n"
+ "Host: www.example.com\r\n"
+ "Connection\r\033\065\325eep-Alive\r\n"
+ "Accept-Encoding: gzip\r\n"
+ "\r\n";
+ test_simple(corrupted_connection, HPE_INVALID_HEADER_TOKEN);
+
+ const char *corrupted_header_name =
+ "GET / HTTP/1.1\r\n"
+ "Host: www.example.com\r\n"
+ "X-Some-Header\r\033\065\325eep-Alive\r\n"
+ "Accept-Encoding: gzip\r\n"
+ "\r\n";
+ test_simple(corrupted_header_name, HPE_INVALID_HEADER_TOKEN);
+
+#if 0
+ // NOTE(Wed Nov 18 11:57:27 CET 2009) this seems okay. we just read body
+ // until EOF.
+ //
+ // no content-length
+ // error if there is a body without content length
+ const char *bad_get_no_headers_no_body = "GET /bad_get_no_headers_no_body/world HTTP/1.1\r\n"
+ "Accept: */*\r\n"
+ "\r\n"
+ "HELLO";
+ test_simple(bad_get_no_headers_no_body, 0);
+#endif
+ /* TODO sending junk and large headers gets rejected */
+
+
+ /* check to make sure our predefined requests are okay */
+ for (i = 0; requests[i].name; i++) {
+ test_message(&requests[i]);
+ }
+
+ for (i = 0; i < request_count; i++) {
+ test_message_pause(&requests[i]);
+ }
+
+ for (i = 0; i < request_count; i++) {
+ if (!requests[i].should_keep_alive) continue;
+ for (j = 0; j < request_count; j++) {
+ if (!requests[j].should_keep_alive) continue;
+ for (k = 0; k < request_count; k++) {
+ test_multiple3(&requests[i], &requests[j], &requests[k]);
+ }
+ }
+ }
+
+ printf("request scan 1/4 ");
+ test_scan( &requests[GET_NO_HEADERS_NO_BODY]
+ , &requests[GET_ONE_HEADER_NO_BODY]
+ , &requests[GET_NO_HEADERS_NO_BODY]
+ );
+
+ printf("request scan 2/4 ");
+ test_scan( &requests[POST_CHUNKED_ALL_YOUR_BASE]
+ , &requests[POST_IDENTITY_BODY_WORLD]
+ , &requests[GET_FUNKY_CONTENT_LENGTH]
+ );
+
+ printf("request scan 3/4 ");
+ test_scan( &requests[TWO_CHUNKS_MULT_ZERO_END]
+ , &requests[CHUNKED_W_TRAILING_HEADERS]
+ , &requests[CHUNKED_W_BULLSHIT_AFTER_LENGTH]
+ );
+
+ printf("request scan 4/4 ");
+ test_scan( &requests[QUERY_URL_WITH_QUESTION_MARK_GET]
+ , &requests[PREFIX_NEWLINE_GET ]
+ , &requests[CONNECT_REQUEST]
+ );
+
+ puts("requests okay");
+
+ return 0;
+}
diff --git a/3rdparty/libuv/.gitignore b/3rdparty/libuv/.gitignore
new file mode 100644
index 00000000000..86a8a5b7b85
--- /dev/null
+++ b/3rdparty/libuv/.gitignore
@@ -0,0 +1,75 @@
+*.swp
+*.[oa]
+*.l[oa]
+*.opensdf
+*.orig
+*.pyc
+*.sdf
+*.suo
+core
+vgcore.*
+.buildstamp
+.dirstamp
+.deps/
+/.libs/
+/aclocal.m4
+/ar-lib
+/autom4te.cache/
+/compile
+/config.guess
+/config.log
+/config.status
+/config.sub
+/configure
+/depcomp
+/install-sh
+/libtool
+/libuv.a
+/libuv.dylib
+/libuv.pc
+/libuv.so
+/ltmain.sh
+/missing
+/test-driver
+Makefile
+Makefile.in
+
+# Generated by gyp for android
+*.target.mk
+
+/out/
+/build/gyp
+
+/test/.libs/
+/test/run-tests
+/test/run-tests.exe
+/test/run-tests.dSYM
+/test/run-benchmarks
+/test/run-benchmarks.exe
+/test/run-benchmarks.dSYM
+
+*.sln
+*.sln.cache
+*.ncb
+*.vcproj
+*.vcproj*.user
+*.vcxproj
+*.vcxproj.filters
+*.vcxproj.user
+_UpgradeReport_Files/
+UpgradeLog*.XML
+Debug
+Release
+ipch
+
+# sphinx generated files
+/docs/build/
+
+# Clion / IntelliJ project files
+/.idea/
+
+*.xcodeproj
+*.xcworkspace
+
+# make dist output
+libuv-*.tar.*
diff --git a/3rdparty/libuv/.mailmap b/3rdparty/libuv/.mailmap
new file mode 100644
index 00000000000..7a51588c0b7
--- /dev/null
+++ b/3rdparty/libuv/.mailmap
@@ -0,0 +1,39 @@
+Aaron Bieber <qbit@deftly.net> <deftly@gmail.com>
+Alan Gutierrez <alan@prettyrobots.com> <alan@blogometer.com>
+Andrius Bentkus <andrius.bentkus@gmail.com> <toxedvirus@gmail.com>
+Bert Belder <bertbelder@gmail.com> <info@2bs.nl>
+Bert Belder <bertbelder@gmail.com> <user@ChrUbuntu.(none)>
+Brandon Philips <brandon.philips@rackspace.com> <brandon@ifup.org>
+Brian White <mscdex@mscdex.net>
+Brian White <mscdex@mscdex.net> <mscdex@gmail.com>
+Caleb James DeLisle <cjd@hyperboria.ca> <cjd@cjdns.fr>
+Christoph Iserlohn <christoph.iserlohn@innoq.com>
+Devchandra Meetei Leishangthem <dlmeetei@gmail.com>
+Fedor Indutny <fedor.indutny@gmail.com> <fedor@indutny.com>
+Frank Denis <github@pureftpd.org>
+Isaac Z. Schlueter <i@izs.me>
+Jason Williams <necmon@yahoo.com>
+Justin Venus <justin.venus@gmail.com> <justin.venus@orbitz.com>
+Keno Fischer <kenof@stanford.edu> <kfischer+github@college.harvard.edu>
+Keno Fischer <kenof@stanford.edu> <kfischer@college.harvard.edu>
+Leith Bade <leith@leithalweapon.geek.nz> <leith@mapbox.com>
+Leonard Hecker <leonard.hecker91@gmail.com> <leonard@hecker.io>
+Maciej Małecki <maciej.malecki@notimplemented.org> <me@mmalecki.com>
+Marc Schlaich <marc.schlaich@googlemail.com> <marc.schlaich@gmail.com>
+Michael <michael_dawson@ca.ibm.com>
+Michael Neumann <mneumann@think.localnet> <mneumann@ntecs.de>
+Nicholas Vavilov <vvnicholas@gmail.com>
+Rasmus Christian Pedersen <zerhacken@yahoo.com>
+Rasmus Christian Pedersen <zerhacken@yahoo.com> <ruysch@outlook.com>
+Robert Mustacchi <rm@joyent.com> <rm@fingolfin.org>
+Ryan Dahl <ryan@joyent.com> <ry@tinyclouds.org>
+Ryan Emery <seebees@gmail.com>
+Sam Roberts <vieuxtech@gmail.com> <sam@strongloop.com>
+San-Tai Hsu <vanilla@fatpipi.com>
+Santiago Gimeno <santiago.gimeno@quantion.es> <santiago.gimeno@gmail.com>
+Saúl Ibarra Corretgé <saghul@gmail.com>
+Shigeki Ohtsu <ohtsu@iij.ad.jp> <ohtsu@ohtsu.org>
+Timothy J. Fontaine <tjfontaine@gmail.com>
+Yasuhiro Matsumoto <mattn.jp@gmail.com>
+Yazhong Liu <yorkiefixer@gmail.com>
+Yuki Okumura <mjt@cltn.org>
diff --git a/3rdparty/libuv/AUTHORS b/3rdparty/libuv/AUTHORS
new file mode 100644
index 00000000000..8dc3955cad5
--- /dev/null
+++ b/3rdparty/libuv/AUTHORS
@@ -0,0 +1,242 @@
+# Authors ordered by first contribution.
+Ryan Dahl <ryan@joyent.com>
+Bert Belder <bertbelder@gmail.com>
+Josh Roesslein <jroesslein@gmail.com>
+Alan Gutierrez <alan@prettyrobots.com>
+Joshua Peek <josh@joshpeek.com>
+Igor Zinkovsky <igorzi@microsoft.com>
+San-Tai Hsu <vanilla@fatpipi.com>
+Ben Noordhuis <info@bnoordhuis.nl>
+Henry Rawas <henryr@schakra.com>
+Robert Mustacchi <rm@joyent.com>
+Matt Stevens <matt@alloysoft.com>
+Paul Querna <pquerna@apache.org>
+Shigeki Ohtsu <ohtsu@iij.ad.jp>
+Tom Hughes <tom.hughes@palm.com>
+Peter Bright <drpizza@quiscalusmexicanus.org>
+Jeroen Janssen <jeroen.janssen@gmail.com>
+Andrea Lattuada <ndr.lattuada@gmail.com>
+Augusto Henrique Hentz <ahhentz@gmail.com>
+Clifford Heath <clifford.heath@gmail.com>
+Jorge Chamorro Bieling <jorge@jorgechamorro.com>
+Luis Lavena <luislavena@gmail.com>
+Matthew Sporleder <msporleder@gmail.com>
+Erick Tryzelaar <erick.tryzelaar@gmail.com>
+Isaac Z. Schlueter <i@izs.me>
+Pieter Noordhuis <pcnoordhuis@gmail.com>
+Marek Jelen <marek@jelen.biz>
+Fedor Indutny <fedor.indutny@gmail.com>
+Saúl Ibarra Corretgé <saghul@gmail.com>
+Felix Geisendörfer <felix@debuggable.com>
+Yuki Okumura <mjt@cltn.org>
+Roman Shtylman <shtylman@gmail.com>
+Frank Denis <github@pureftpd.org>
+Carter Allen <CarterA@opt-6.com>
+Tj Holowaychuk <tj@vision-media.ca>
+Shimon Doodkin <helpmepro1@gmail.com>
+Ryan Emery <seebees@gmail.com>
+Bruce Mitchener <bruce.mitchener@gmail.com>
+Maciej Małecki <maciej.malecki@notimplemented.org>
+Yasuhiro Matsumoto <mattn.jp@gmail.com>
+Daisuke Murase <typester@cpan.org>
+Paddy Byers <paddy.byers@gmail.com>
+Dan VerWeire <dverweire@gmail.com>
+Brandon Benvie <brandon@bbenvie.com>
+Brandon Philips <brandon.philips@rackspace.com>
+Nathan Rajlich <nathan@tootallnate.net>
+Charlie McConnell <charlie@charlieistheman.com>
+Vladimir Dronnikov <dronnikov@gmail.com>
+Aaron Bieber <qbit@deftly.net>
+Bulat Shakirzyanov <mallluhuct@gmail.com>
+Brian White <mscdex@mscdex.net>
+Erik Dubbelboer <erik@dubbelboer.com>
+Keno Fischer <kenof@stanford.edu>
+Ira Cooper <Ira.Cooper@mathworks.com>
+Andrius Bentkus <andrius.bentkus@gmail.com>
+Iñaki Baz Castillo <ibc@aliax.net>
+Mark Cavage <mark.cavage@joyent.com>
+George Yohng <georgegh@oss3d.com>
+Xidorn Quan <quanxunzhen@gmail.com>
+Roman Neuhauser <rneuhauser@suse.cz>
+Shuhei Tanuma <shuhei.tanuma@gmail.com>
+Bryan Cantrill <bcantrill@acm.org>
+Trond Norbye <trond.norbye@gmail.com>
+Tim Holy <holy@wustl.edu>
+Prancesco Pertugio <meh@schizofreni.co>
+Leonard Hecker <leonard.hecker91@gmail.com>
+Andrew Paprocki <andrew@ishiboo.com>
+Luigi Grilli <luigi.grilli@gmail.com>
+Shannen Saez <shannenlaptop@gmail.com>
+Artur Adib <arturadib@gmail.com>
+Hiroaki Nakamura <hnakamur@gmail.com>
+Ting-Yu Lin <ph.minamo@cytisan.com>
+Stephen Gallagher <sgallagh@redhat.com>
+Shane Holloway <shane.holloway@ieee.org>
+Andrew Shaffer <darawk@gmail.com>
+Vlad Tudose <vlad.tudose@intel.com>
+Ben Leslie <benno@benno.id.au>
+Tim Bradshaw <tfb@cley.com>
+Timothy J. Fontaine <tjfontaine@gmail.com>
+Marc Schlaich <marc.schlaich@googlemail.com>
+Brian Mazza <louseman@gmail.com>
+Elliot Saba <staticfloat@gmail.com>
+Ben Kelly <ben@wanderview.com>
+Nils Maier <maierman@web.de>
+Nicholas Vavilov <vvnicholas@gmail.com>
+Miroslav Bajtoš <miro.bajtos@gmail.com>
+Sean Silva <chisophugis@gmail.com>
+Wynn Wilkes <wynnw@movenetworks.com>
+Andrei Sedoi <bsnote@gmail.com>
+Alex Crichton <alex@alexcrichton.com>
+Brent Cook <brent@boundary.com>
+Brian Kaisner <bkize1@gmail.com>
+Luca Bruno <lucab@debian.org>
+Reini Urban <rurban@cpanel.net>
+Maks Naumov <maksqwe1@ukr.net>
+Sean Farrell <sean.farrell@rioki.org>
+Chris Bank <cbank@adobe.com>
+Geert Jansen <geertj@gmail.com>
+Christoph Iserlohn <christoph.iserlohn@innoq.com>
+Steven Kabbes <stevenkabbes@gmail.com>
+Alex Gaynor <alex.gaynor@gmail.com>
+huxingyi <huxingyi@msn.com>
+Tenor Biel <tenorbiel@gmail.com>
+Andrej Manduch <AManduch@gmail.com>
+Joshua Neuheisel <joshua@neuheisel.us>
+Alexis Campailla <alexis@janeasystems.com>
+Yazhong Liu <yorkiefixer@gmail.com>
+Sam Roberts <vieuxtech@gmail.com>
+River Tarnell <river@loreley.flyingparchment.org.uk>
+Nathan Sweet <nathanjsweet@gmail.com>
+Trevor Norris <trev.norris@gmail.com>
+Oguz Bastemur <obastemur@gmail.com>
+Dylan Cali <calid1984@gmail.com>
+Austin Foxley <austinf@cetoncorp.com>
+Benjamin Saunders <ben.e.saunders@gmail.com>
+Geoffry Song <goffrie@gmail.com>
+Rasmus Christian Pedersen <ruysch@outlook.com>
+William Light <wrl@illest.net>
+Oleg Efimov <o.efimov@corp.badoo.com>
+Lars Gierth <larsg@systemli.org>
+Rasmus Christian Pedersen <zerhacken@yahoo.com>
+Justin Venus <justin.venus@gmail.com>
+Kristian Evensen <kristian.evensen@gmail.com>
+Linus Mårtensson <linus.martensson@sonymobile.com>
+Navaneeth Kedaram Nambiathan <navaneethkn@gmail.com>
+Yorkie <yorkiefixer@gmail.com>
+StarWing <weasley.wx@gmail.com>
+thierry-FreeBSD <thierry@FreeBSD.org>
+Isaiah Norton <isaiah.norton@gmail.com>
+Raul Martins <raulms.martins@gmail.com>
+David Capello <davidcapello@gmail.com>
+Paul Tan <pyokagan@gmail.com>
+Javier Hernández <jhernandez@emergya.com>
+Tonis Tiigi <tonistiigi@gmail.com>
+Norio Kobota <nori.0428@gmail.com>
+李港平 <chopdown@gmail.com>
+Chernyshev Viacheslav <astellar@ro.ru>
+Stephen von Takach <steve@advancedcontrol.com.au>
+JD Ballard <jd@pixelandline.com>
+Luka Perkov <luka.perkov@sartura.hr>
+Ryan Cole <ryan@rycole.com>
+HungMingWu <u9089000@gmail.com>
+Jay Satiro <raysatiro@yahoo.com>
+Leith Bade <leith@leithalweapon.geek.nz>
+Peter Atashian <retep998@gmail.com>
+Tim Cooper <tim.cooper@layeh.com>
+Caleb James DeLisle <cjd@hyperboria.ca>
+Jameson Nash <vtjnash@gmail.com>
+Graham Lee <ghmlee@ghmlee.com>
+Andrew Low <Andrew_Low@ca.ibm.com>
+Pavel Platto <hinidu@gmail.com>
+Tony Kelman <tony@kelman.net>
+John Firebaugh <john.firebaugh@gmail.com>
+lilohuang <lilohuang@hotmail.com>
+Paul Goldsmith <paul.goldsmith@aplink.net>
+Julien Gilli <julien.gilli@joyent.com>
+Michael Hudson-Doyle <michael.hudson@linaro.org>
+Recep ASLANTAS <m@recp.me>
+Rob Adams <readams@readams.net>
+Zachary Newman <znewman01@gmail.com>
+Robin Hahling <robin.hahling@gw-computing.net>
+Jeff Widman <jeff@jeffwidman.com>
+cjihrig <cjihrig@gmail.com>
+Tomasz Kołodziejski <tkolodziejski@mozilla.com>
+Unknown W. Brackets <checkins@unknownbrackets.org>
+Emmanuel Odeke <odeke@ualberta.ca>
+Mikhail Mukovnikov <yndi@me.com>
+Thorsten Lorenz <thlorenz@gmx.de>
+Yuri D'Elia <yuri.delia@eurac.edu>
+Manos Nikolaidis <manos@shadowrobot.com>
+Elijah Andrews <elijah@busbud.com>
+Michael Ira Krufky <m.krufky@samsung.com>
+Helge Deller <deller@gmx.de>
+Joey Geralnik <jgeralnik@gmail.com>
+Tim Caswell <tim@creationix.com>
+Logan Rosen <loganrosen@gmail.com>
+Kenneth Perry <thothonegan@gmail.com>
+John Marino <marino@FreeBSD.org>
+Alexey Melnichuk <mimir@newmail.ru>
+Johan Bergström <bugs@bergstroem.nu>
+Alex Mo <almosnow@gmail.com>
+Luis Martinez de Bartolome <lasote@gmail.com>
+Michael Penick <michael.penick@datastax.com>
+Michael <michael_dawson@ca.ibm.com>
+Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
+TomCrypto <thomas.beneteau@yahoo.fr>
+Brett Vickers <brett@beevik.com>
+Ole André Vadla Ravnås <oleavr@gmail.com>
+Kazuho Oku <kazuhooku@gmail.com>
+Ryan Phillips <ryan.phillips@rackspace.com>
+Brian Green <briangreenery@gmail.com>
+Devchandra Meetei Leishangthem <dlmeetei@gmail.com>
+Corey Farrell <git@cfware.com>
+Per Nilsson <pni@qlik.com>
+Alan Rogers <alanjrogers@me.com>
+Daryl Haresign <github@daryl.haresign.com>
+Rui Abreu Ferreira <raf-ep@gmx.com>
+João Reis <reis@janeasystems.com>
+farblue68 <farblue68@gmail.com>
+Jason Williams <necmon@yahoo.com>
+Igor Soarez <igorsoarez@gmail.com>
+Miodrag Milanovic <mmicko@gmail.com>
+Cheng Zhao <zcbenz@gmail.com>
+Michael Neumann <mneumann@think.localnet>
+Stefano Cristiano <stefanocristiano82@gmail.com>
+heshamsafi <hesham.safi.eldeen@gmail.com>
+A. Hauptmann <andreashauptmann@t-online.de>
+John McNamee <jpm@microwiz.com>
+Yosuke Furukawa <yosuke.furukawa@gmail.com>
+Santiago Gimeno <santiago.gimeno@quantion.es>
+guworks <ground.up.works@gmail.com>
+RossBencina <rossb@audiomulch.com>
+Roger A. Light <roger@atchoo.org>
+chenttuuvv <chenttuuvv@yahoo.com>
+Richard Lau <riclau@uk.ibm.com>
+ronkorving <rkorving@wizcorp.jp>
+Corbin Simpson <MostAwesomeDude@gmail.com>
+Zachary Hamm <zsh@imipolexg.org>
+Karl Skomski <karl@skomski.com>
+Jeremy Whitlock <jwhitlock@apache.org>
+Willem Thiart <himself@willemthiart.com>
+Ben Trask <bentrask@comcast.net>
+Jianghua Yang <jianghua.yjh@alibaba-inc.com>
+Colin Snover <github.com@zetafleet.com>
+Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
+Eli Skeggs <skeggse@gmail.com>
+nmushell <nmushell@bloomberg.net>
+Gireesh Punathil <gpunathi@in.ibm.com>
+Ryan Johnston <ryan@mediapixel.co.nz>
+Adam Stylinski <stylinae@mail.uc.edu>
+Nathan Corvino <nathan@corvino.com>
+Wink Saville <wink@saville.com>
+Angel Leon <gubatron@gmail.com>
+Louis DeJardin <lodejard@microsoft.com>
+Imran Iqbal <imrani@ca.ibm.com>
+Petka Antonov <petka_antonov@hotmail.com>
+Ian Kronquist <iankronquist@teleport.com>
+kkdaemon <kkdaemon@gmail.com>
+Yuval Brik <yuval@brik.org.il>
+Joran Dirk Greef <joran@ronomon.com>
+Andrey Mazo <andrey.mazo@fidelissecurity.com>
+sztomi <hello.sztomi@gmail.com>
diff --git a/3rdparty/libuv/CONTRIBUTING.md b/3rdparty/libuv/CONTRIBUTING.md
new file mode 100644
index 00000000000..b46edd492aa
--- /dev/null
+++ b/3rdparty/libuv/CONTRIBUTING.md
@@ -0,0 +1,166 @@
+# CONTRIBUTING
+
+The libuv project welcomes new contributors. This document will guide you
+through the process.
+
+
+### FORK
+
+Fork the project [on GitHub](https://github.com/libuv/libuv) and check out
+your copy.
+
+```
+$ git clone https://github.com/username/libuv.git
+$ cd libuv
+$ git remote add upstream https://github.com/libuv/libuv.git
+```
+
+Now decide if you want your feature or bug fix to go into the master branch
+or the stable branch. As a rule of thumb, bug fixes go into the stable branch
+while new features go into the master branch.
+
+The stable branch is effectively frozen; patches that change the libuv
+API/ABI or affect the run-time behavior of applications get rejected.
+
+In case of doubt, open an issue in the [issue tracker][], post your question
+to the [libuv mailing list], or contact one of project maintainers
+(@bnoordhuis, @piscisaureus, @indutny or @saghul) on [IRC][].
+
+Especially do so if you plan to work on something big. Nothing is more
+frustrating than seeing your hard work go to waste because your vision
+does not align with that of a project maintainers.
+
+
+### BRANCH
+
+Okay, so you have decided on the proper branch. Create a feature branch
+and start hacking:
+
+```
+$ git checkout -b my-feature-branch -t origin/v1.x
+```
+
+(Where v1.x is the latest stable branch as of this writing.)
+
+### CODE
+
+Please adhere to libuv's code style. In general it follows the conventions from
+the [Google C/C++ style guide]. Some of the key points, as well as some
+additional guidelines, are enumerated below.
+
+* Code that is specific to unix-y platforms should be placed in `src/unix`, and
+ declarations go into `include/uv-unix.h`.
+
+* Source code that is Windows-specific goes into `src/win`, and related
+ publicly exported types, functions and macro declarations should generally
+ be declared in `include/uv-win.h`.
+
+* Names should be descriptive and concise.
+
+* All the symbols and types that libuv makes available publicly should be
+ prefixed with `uv_` (or `UV_` in case of macros).
+
+* Internal, non-static functions should be prefixed with `uv__`.
+
+* Use two spaces and no tabs.
+
+* Lines should be wrapped at 80 characters.
+
+* Ensure that lines have no trailing whitespace, and use unix-style (LF) line
+ endings.
+
+* Use C89-compliant syntax. In other words, variables can only be declared at
+ the top of a scope (function, if/for/while-block).
+
+* When writing comments, use properly constructed sentences, including
+ punctuation.
+
+* When documenting APIs and/or source code, don't make assumptions or make
+ implications about race, gender, religion, political orientation or anything
+ else that isn't relevant to the project.
+
+* Remember that source code usually gets written once and read often: ensure
+ the reader doesn't have to make guesses. Make sure that the purpose and inner
+ logic are either obvious to a reasonably skilled professional, or add a
+ comment that explains it.
+
+
+### COMMIT
+
+Make sure git knows your name and email address:
+
+```
+$ git config --global user.name "J. Random User"
+$ git config --global user.email "j.random.user@example.com"
+```
+
+Writing good commit logs is important. A commit log should describe what
+changed and why. Follow these guidelines when writing one:
+
+1. The first line should be 50 characters or less and contain a short
+ description of the change prefixed with the name of the changed
+ subsystem (e.g. "net: add localAddress and localPort to Socket").
+2. Keep the second line blank.
+3. Wrap all other lines at 72 columns.
+
+A good commit log looks like this:
+
+```
+subsystem: explaining the commit in one line
+
+Body of commit message is a few lines of text, explaining things
+in more detail, possibly giving some background about the issue
+being fixed, etc etc.
+
+The body of the commit message can be several paragraphs, and
+please do proper word-wrap and keep columns shorter than about
+72 characters or so. That way `git log` will show things
+nicely even when it is indented.
+```
+
+The header line should be meaningful; it is what other people see when they
+run `git shortlog` or `git log --oneline`.
+
+Check the output of `git log --oneline files_that_you_changed` to find out
+what subsystem (or subsystems) your changes touch.
+
+
+### REBASE
+
+Use `git rebase` (not `git merge`) to sync your work from time to time.
+
+```
+$ git fetch upstream
+$ git rebase upstream/v1.x # or upstream/master
+```
+
+
+### TEST
+
+Bug fixes and features should come with tests. Add your tests in the
+`test/` directory. Tests also need to be registered in `test/test-list.h`.
+Look at other tests to see how they should be structured (license boilerplate,
+the way entry points are declared, etc.).
+
+Check README.md file to find out how to run the test suite and make sure that
+there are no test regressions.
+
+### PUSH
+
+```
+$ git push origin my-feature-branch
+```
+
+Go to https://github.com/username/libuv and select your feature branch. Click
+the 'Pull Request' button and fill out the form.
+
+Pull requests are usually reviewed within a few days. If there are comments
+to address, apply your changes in a separate commit and push that to your
+feature branch. Post a comment in the pull request afterwards; GitHub does
+not send out notifications when you add commits.
+
+
+[issue tracker]: https://github.com/libuv/libuv/issues
+[libuv mailing list]: http://groups.google.com/group/libuv
+[IRC]: http://webchat.freelibuv.net/?channels=libuv
+[Google C/C++ style guide]: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
diff --git a/3rdparty/libuv/ChangeLog b/3rdparty/libuv/ChangeLog
new file mode 100644
index 00000000000..d5f95404a56
--- /dev/null
+++ b/3rdparty/libuv/ChangeLog
@@ -0,0 +1,2372 @@
+2015.12.15, Version 1.8.0 (Stable)
+
+Changes since version 1.7.5:
+
+* unix: fix memory leak in uv_interface_addresses (Jianghua Yang)
+
+* unix: make uv_guess_handle work properly for AIX (Gireesh Punathil)
+
+* fs: undo uv__req_init when uv__malloc failed (Jianghua Yang)
+
+* build: remove unused 'component' GYP option (Saúl Ibarra Corretgé)
+
+* include: remove duplicate extern declaration (Jianghua Yang)
+
+* win: use the MSVC provided snprintf where possible (Jason Williams)
+
+* win, test: fix compilation warning (Saúl Ibarra Corretgé)
+
+* win: fix compilation with VS < 2012 (Ryan Johnston)
+
+* stream: support empty uv_try_write on unix (Fedor Indutny)
+
+* unix: fix request handle leak in uv__udp_send (Jianghua Yang)
+
+* src: replace QUEUE_SPLIT with QUEUE_MOVE (Ben Noordhuis)
+
+* unix: use QUEUE_MOVE when iterating over lists (Ben Noordhuis)
+
+* unix: squelch harmless valgrind warning (Ben Noordhuis)
+
+* test: don't abort on setrlimit() failure (Ben Noordhuis)
+
+* unix: only undo fs req registration in async mode (Ben Noordhuis)
+
+* unix: fix uv__getiovmax return value (HungMingWu)
+
+* unix: make work with Solaris Studio. (Adam Stylinski)
+
+* test: fix fs_event_watch_file_currentdir flakiness (Santiago Gimeno)
+
+* unix: skip prohibited syscalls on tvOS and watchOS (Nathan Corvino)
+
+* test: use FQDN in getaddrinfo_fail test (Wink Saville)
+
+* docs: clarify documentation of uv_tcp_init_ex (Andrius Bentkus)
+
+* win: fix comment (Miodrag Milanovic)
+
+* doc: fix typo in README (Angel Leon)
+
+* darwin: abort() if (un)locking fs mutex fails (Ben Noordhuis)
+
+* pipe: enable inprocess uv_write2 on Windows (Louis DeJardin)
+
+* win: properly return UV_EBADF when _close() fails (Nicholas Vavilov)
+
+* test: skip process_title for AIX (Imran Iqbal)
+
+* misc: expose handle print APIs (Petka Antonov)
+
+* include: add stdio.h to uv.h (Saúl Ibarra Corretgé)
+
+* misc: remove unnecessary null pointer checks (Ian Kronquist)
+
+* test,freebsd: skip udp_dual_stack if not supported (Santiago Gimeno)
+
+* linux: don't retry dup2/dup3 on EINTR (Ben Noordhuis)
+
+* unix: don't retry dup2/dup3 on EINTR (Ben Noordhuis)
+
+* test: fix -Wtautological-pointer-compare warnings (Saúl Ibarra Corretgé)
+
+* win: map ERROR_BAD_PATHNAME to UV_ENOENT (Tony Kelman)
+
+* test: fix test/test-tty.c for AIX (Imran Iqbal)
+
+* android: support api level less than 21 (kkdaemon)
+
+* fsevents: fix race on simultaneous init+close (Fedor Indutny)
+
+* linux,fs: fix p{read,write}v with a 64bit offset (Saúl Ibarra Corretgé)
+
+* fs: add uv_fs_realpath() (Yuval Brik)
+
+* win: fix path for removed and renamed fs events (Joran Dirk Greef)
+
+* win: do not read more from stream than available (Jeremy Whitlock)
+
+* test: test that uv_close() doesn't corrupt QUEUE (Andrey Mazo)
+
+* unix: fix uv_fs_event_stop() from fs_event_cb (Andrey Mazo)
+
+* test: fix self-deadlocks in thread_rwlock_trylock (Ben Noordhuis)
+
+* src: remove non ascii character (sztomi)
+
+* test: fix test udp_multicast_join6 for AIX (Imran Iqbal)
+
+
+2015.09.23, Version 1.7.5 (Stable), a8c1136de2cabf25b143021488cbaab05834daa8
+
+Changes since version 1.7.4:
+
+* unix: Support atomic compare & swap xlC on AIX (nmushell)
+
+* unix: Fix including uv-aix.h on AIX (nmushell)
+
+* unix: consolidate rwlock tryrdlock trywrlock errors (Saúl Ibarra Corretgé)
+
+* unix, win: consolidate mutex trylock errors (Saúl Ibarra Corretgé)
+
+* darwin: fix memory leak in uv_cpu_info (Jianghua Yang)
+
+* test: add tests for the uv_rwlock implementation (Bert Belder)
+
+* win: redo/fix the uv_rwlock APIs (Bert Belder)
+
+* win: don't fetch function pointers to SRWLock APIs (Bert Belder)
+
+
+2015.09.12, Version 1.7.4 (Stable), a7ad4f52189d89cfcba35f78bfc5ff3b1f4105c4
+
+Changes since version 1.7.3:
+
+* doc: uv_read_start and uv_read_cb clarifications (Ben Trask)
+
+* freebsd: obtain true uptime through clock_gettime() (Jianghua Yang)
+
+* win, tty: do not convert \r to \r\n (Colin Snover)
+
+* build,gyp: add DragonFly to the list of OSes (Michael Neumann)
+
+* fs: fix bug in sendfile for DragonFly (Michael Neumann)
+
+* doc: add uv_dlsym() return type (Brian White)
+
+* tests: fix fs tests run w/o full getdents support (Jeremy Whitlock)
+
+* doc: fix typo (Devchandra Meetei Leishangthem)
+
+* doc: fix uv-unix.h location (Sakthipriyan Vairamani)
+
+* unix: fix error check when closing process pipe fd (Ben Noordhuis)
+
+* test,freebsd: fix ipc_listen_xx_write tests (Santiago Gimeno)
+
+* win: fix unsavory rwlock fallback implementation (Bert Belder)
+
+* doc: clarify repeat timer behavior (Eli Skeggs)
+
+
+2015.08.28, Version 1.7.3 (Stable), 93877b11c8b86e0a6befcda83a54555c1e36e4f0
+
+Changes since version 1.7.2:
+
+* threadpool: fix thread starvation bug (Ben Noordhuis)
+
+
+2015.08.25, Version 1.7.2 (Stable), 4d13a013fcfa72311f0102751fdc7951873f466c
+
+Changes since version 1.7.1:
+
+* unix, win: make uv_loop_init return on error (Willem Thiart)
+
+* win: reset pipe handle for pipe servers (Saúl Ibarra Corretgé)
+
+* win: fix replacing pipe handle for pipe servers (Saúl Ibarra Corretgé)
+
+* win: fix setting pipe pending instances after bind (Saúl Ibarra Corretgé)
+
+
+2015.08.20, Version 1.7.1 (Stable), 44f4b6bd82d8ae4583ccc4768a83af778ef69f85
+
+Changes since version 1.7.0:
+
+* doc: document the procedure for verifying releases (Saúl Ibarra Corretgé)
+
+* doc: add note about Windows binaries to the README (Saúl Ibarra Corretgé)
+
+* doc: use long GPG IDs in MAINTAINERS.md (Saúl Ibarra Corretgé)
+
+* Revert "stream: squelch ECONNRESET error if already closed" (Saúl Ibarra
+ Corretgé)
+
+* doc: clarify uv_read_stop() is idempotent (Corbin Simpson)
+
+* unix: OpenBSD's setsockopt needs an unsigned char for multicast (Zachary
+ Hamm)
+
+* test: Fix two memory leaks (Karl Skomski)
+
+* unix,win: return EINVAL on nullptr args in uv_fs_{read,write} (Karl Skomski)
+
+* win: set accepted TCP sockets as non-inheritable (Saúl Ibarra Corretgé)
+
+* unix: remove superfluous parentheses in fs macros (Ben Noordhuis)
+
+* unix: don't copy arguments for sync fs requests (Ben Noordhuis)
+
+* test: plug small memory leak in unix test runner (Ben Noordhuis)
+
+* unix,windows: allow NULL loop for sync fs requests (Ben Noordhuis)
+
+* unix,windows: don't assert on unknown error code (Ben Noordhuis)
+
+* stream: retry write on EPROTOTYPE on OSX (Brian White)
+
+* common: fix use of snprintf on Windows (Saúl Ibarra Corretgé)
+
+* tests: refactored fs watch_dir tests for stability (Jeremy Whitlock)
+
+
+2015.08.06, Version 1.7.0 (Stable), 415a865d6365ba58d02b92b89d46ba5d7744ec8b
+
+Changes since version 1.6.1:
+
+* win,stream: add slot to remember CRT fd (Bert Belder)
+
+* win,pipe: properly close when created from CRT fd (Bert Belder)
+
+* win,pipe: don't close fd 0-2 (Bert Belder)
+
+* win,tty: convert fd -> handle safely (Bert Belder)
+
+* win,tty: properly close when created from CRT fd (Bert Belder)
+
+* win,tty: don't close fd 0-2 (Bert Belder)
+
+* win,fs: don't close fd 0-2 (Bert Belder)
+
+* win: include "malloc.h" (Cheng Zhao)
+
+* windows: MSVC 2015 has C99 inline (Jason Williams)
+
+* dragonflybsd: fixes for nonblocking and cloexec (Michael Neumann)
+
+* dragonflybsd: use sendfile(2) for uv_fs_sendfile (Michael Neumann)
+
+* dragonflybsd: fix uv_exepath (Michael Neumann)
+
+* win,fs: Fixes align(8) directive on mingw (Stefano Cristiano)
+
+* unix, win: prevent replacing fd in uv_{udp,tcp,pipe}_t (Saúl Ibarra Corretgé)
+
+* win: move logic to set socket non-inheritable to uv_tcp_set_socket (Saúl
+ Ibarra Corretgé)
+
+* unix, win: add ability to create tcp/udp sockets early (Saúl Ibarra Corretgé)
+
+* test: retry select() on EINTR, honor milliseconds (Ben Noordhuis)
+
+* unix: consolidate tcp and udp bind error (Saúl Ibarra Corretgé)
+
+* test: conditionally skip udp_ipv6_multicast_join6 (heshamsafi)
+
+* core: add UV_VERSION_HEX macro (Saúl Ibarra Corretgé)
+
+* doc: add section with version-checking macros and functions (Saúl Ibarra
+ Corretgé)
+
+* tty: cleanup handle if uv_tty_init fails (Saúl Ibarra Corretgé)
+
+* darwin: save a fd when FSEvents is used (Saúl Ibarra Corretgé)
+
+* win: fix returning thread id in uv_thread_self (Saúl Ibarra Corretgé)
+
+* common: use offsetof for QUEUE_DATA (Saúl Ibarra Corretgé)
+
+* win: remove UV_HANDLE_CONNECTED (A. Hauptmann)
+
+* docs: add Windows specific note for uv_fs_open (Saúl Ibarra Corretgé)
+
+* doc: add note about uv_fs_scandir (Saúl Ibarra Corretgé)
+
+* test,unix: reduce stack size of watchdog threads (Ben Noordhuis)
+
+* win: add support for recursive file watching (Saúl Ibarra Corretgé)
+
+* win,tty: support consoles with non-default colors (John McNamee)
+
+* doc: add missing variable name (Yosuke Furukawa)
+
+* stream: squelch ECONNRESET error if already closed (Santiago Gimeno)
+
+* build: remove ancient condition from common.gypi (Saúl Ibarra Corretgé)
+
+* tests: skip some tests when network is unreachable (Luca Bruno)
+
+* build: proper support for android cross compilation (guworks)
+
+* android: add missing include to pthread-fixes.c (RossBencina)
+
+* test: fix compilation warning (Saúl Ibarra Corretgé)
+
+* doc: add a note about uv_dirent_t.type (Saúl Ibarra Corretgé)
+
+* win,test: fix shared library build (Saúl Ibarra Corretgé)
+
+* test: fix compilation warning (Santiago Gimeno)
+
+* build: add experimental Windows installer (Roger A. Light)
+
+* threadpool: send signal only when queue is empty (chenttuuvv)
+
+* aix: fix uv_exepath with relative paths (Richard Lau)
+
+* build: fix version syntax in AppVeyor file (Saúl Ibarra Corretgé)
+
+* unix: allow nbufs > IOV_MAX in uv_fs_{read,write} (ronkorving)
+
+
+2015.06.06, Version 1.6.1 (Stable), 30c8be07bb78a66fdee5141626bf53a49a17094a
+
+Changes since version 1.6.0:
+
+* unix: handle invalid _SC_GETPW_R_SIZE_MAX values (cjihrig)
+
+
+2015.06.04, Version 1.6.0 (Stable), adfccad76456061dfcf79b8df8e7dbfee51791d7
+
+Changes since version 1.5.0:
+
+* aix: fix setsockopt for multicast options (Michael)
+
+* unix: don't block for io if any io handle is primed (Saúl Ibarra Corretgé)
+
+* windows: MSVC 2015 has snprintf() (Rui Abreu Ferreira)
+
+* windows: Add VS2015 support to vcbuild.bat (Jason Williams)
+
+* doc: fix typo in tcp.rst (Igor Soarez)
+
+* linux: work around epoll bug in kernels < 2.6.37 (Ben Noordhuis)
+
+* unix,win: add uv_os_homedir() (cjihrig)
+
+* stream: fix `select()` race condition (Fedor Indutny)
+
+* unix: prevent infinite loop in uv__run_pending (Saúl Ibarra Corretgé)
+
+* unix: make sure UDP send callbacks are asynchronous (Saúl Ibarra Corretgé)
+
+* test: fix `platform_output` netmask printing. (Andrew Paprocki)
+
+* aix: add ahafs autoconf detection and README notes (Andrew Paprocki)
+
+* core: add ability to customize memory allocator (Saúl Ibarra Corretgé)
+
+
+2015.05.07, Version 1.5.0 (Stable), 4e77f74c7b95b639b3397095db1bc5bcc016c203
+
+Changes since version 1.4.2:
+
+* doc: clarify that the thread pool primites are not thread safe (Andrius
+ Bentkus)
+
+* aix: always deregister closing fds from epoll (Michael)
+
+* unix: fix glibc-2.20+ macro incompatibility (Massimiliano Torromeo)
+
+* doc: add Sphinx plugin for generating links to man pages (Saúl Ibarra
+ Corretgé)
+
+* doc: link system and library calls to man pages (Saúl Ibarra Corretgé)
+
+* doc: document uv_getnameinfo_t.{host|service} (Saúl Ibarra Corretgé)
+
+* build: update the location of gyp (Stephen von Takach)
+
+* win: name all anonymous structs and unions (TomCrypto)
+
+* linux: work around epoll bug in kernels 3.10-3.19 (Ben Noordhuis)
+
+* darwin: fix size calculation in select() fallback (Ole André Vadla Ravnås)
+
+* solaris: fix setsockopt for multicast options (Julien Gilli)
+
+* test: fix race condition in multithreaded test (Ben Noordhuis)
+
+* doc: fix long lines in tty.rst (Ben Noordhuis)
+
+* test: use UV_TTY_MODE_* values in tty test (Ben Noordhuis)
+
+* unix: don't clobber errno in uv_tty_reset_mode() (Ben Noordhuis)
+
+* unix: reject non-tty fds in uv_tty_init() (Ben Noordhuis)
+
+* win: fix pipe blocking writes (Alexis Campailla)
+
+* build: fix cross-compiling for iOS (Steven Kabbes)
+
+* win: remove unnecessary malloc.h
+
+* include: use `extern "c++"` for defining C++ code (Kazuho Oku)
+
+* unix: reap child on execvp() failure (Ryan Phillips)
+
+* windows: fix handle leak on EMFILE (Brian Green)
+
+* test: fix tty_file, close handle if initialized (Saúl Ibarra Corretgé)
+
+* doc: clarify what uv_*_open accepts (Saúl Ibarra Corretgé)
+
+* doc: clarify that we don't maintain external doc resources (Saúl Ibarra
+ Corretgé)
+
+* build: add documentation for ninja support (Devchandra Meetei Leishangthem)
+
+* doc: document uv_buf_t members (Corey Farrell)
+
+* linux: fix epoll_pwait() fallback on arm64 (Ben Noordhuis)
+
+* android: fix compilation warning (Saúl Ibarra Corretgé)
+
+* unix: don't close the fds we just setup (Sam Roberts)
+
+* test: spawn child replacing std{out,err} to stderr (Saúl Ibarra Corretgé)
+
+* unix: fix swapping fds order in uv_spawn (Saúl Ibarra Corretgé)
+
+* unix: fix potential bug if dup2 fails in uv_spawn (Saúl Ibarra Corretgé)
+
+* test: remove LOG and LOGF variadic macros (Saúl Ibarra Corretgé)
+
+* win: fix uv_fs_access on directories (Saúl Ibarra Corretgé)
+
+* win: fix of double free in uv_uptime (Per Nilsson)
+
+* unix: open "/dev/null" instead of "/" for emfile_fd (Alan Rogers)
+
+* docs: add some missing words (Daryl Haresign)
+
+* unix: clean up uv_fs_open() O_CLOEXEC logic (Ben Noordhuis)
+
+* build: set SONAME for shared library in uv.gyp (Rui Abreu Ferreira)
+
+* windows: define snprintf replacement as inline instead of static (Rui Abreu
+ Ferreira)
+
+* win: fix unlink of readonly files (João Reis)
+
+* doc: fix uv_run(UV_RUN_DEFAULT) description (Ben Noordhuis)
+
+* linux: intercept syscall when running under memory sanitizer (Keno Fischer)
+
+* aix: fix uv_interface_addresses return value (farblue68)
+
+* windows: defer reporting TCP write failure until next tick (Saúl Ibarra
+ Corretgé)
+
+* test: add test for deferred TCP write failure (Saúl Ibarra Corretgé)
+
+
+2015.02.27, Version 1.4.2 (Stable), 1a7391348a11d5450c0f69c828d5302e2cb842eb
+
+Changes since version 1.4.1:
+
+* stream: ignore EINVAL for SO_OOBINLINE on OS X (Fedor Indutny)
+
+
+2015.02.25, Version 1.4.1 (Stable), e8e3fc5789cc0f02937879d141cca0411274093c
+
+Changes since version 1.4.0:
+
+* win: don't use inline keyword in thread.c (Ben Noordhuis)
+
+* windows: fix setting dirent types on uv_fs_scandir_next (Saúl Ibarra
+ Corretgé)
+
+* unix,windows: make uv_thread_create() return errno (Ben Noordhuis)
+
+* tty: fix build for SmartOS (Julien Gilli)
+
+* unix: fix for uv_async data race (Michael Penick)
+
+* unix, windows: map EHOSTDOWN errno (Ben Noordhuis)
+
+* stream: use SO_OOBINLINE on OS X (Fedor Indutny)
+
+
+2015.02.10, Version 1.4.0 (Stable), 19fb8a90648f3763240db004b77ab984264409be
+
+Changes since version 1.3.0:
+
+* unix: check Android support for pthread_cond_timedwait_monotonic_np (Leith
+ Bade)
+
+* test: use modified path in test (cjihrig)
+
+* unix: implement uv_stream_set_blocking() (Ben Noordhuis)
+
+
+2015.01.29, Version 1.3.0 (Stable), 165685b2a9a42cf96501d79cd6d48a18aaa16e3b
+
+Changes since version 1.2.1:
+
+* unix, windows: set non-block mode in uv_poll_init (Saúl Ibarra Corretgé)
+
+* doc: clarify which flags are supported in uv_fs_event_start (Saúl Ibarra
+ Corretgé)
+
+* win,unix: move loop functions which have identical implementations (Andrius
+ Bentkus)
+
+* doc: explain how the threadpool is allocated (Alex Mo)
+
+* doc: clarify uv_default_loop (Saúl Ibarra Corretgé)
+
+* unix: fix implicit declaration compiler warning (Ben Noordhuis)
+
+* unix: fix long line introduced in commit 94e628fa (Ben Noordhuis)
+
+* unix, win: add synchronous uv_get{addr,name}info (Saúl Ibarra Corretgé)
+
+* linux: fix epoll_pwait() regression with < 2.6.19 (Ben Noordhuis)
+
+* build: compile -D_GNU_SOURCE on linux (Ben Noordhuis)
+
+* build: use -fvisibility=hidden in autotools build (Ben Noordhuis)
+
+* fs, pipe: no trailing terminator in exact sized buffers (Andrius Bentkus)
+
+* style: rename buf to buffer and len to size for consistency (Andrius Bentkus)
+
+* test: fix test-spawn on MinGW32 (Luis Martinez de Bartolome)
+
+* win, pipe: fix assertion when destroying timer (Andrius Bentkus)
+
+* win, unix: add pipe_peername implementation (Andrius Bentkus)
+
+
+2015.01.29, Version 0.10.33 (Stable), 7a2253d33ad8215a26c1b34f1952aee7242dd687
+
+Changes since version 0.10.32:
+
+* linux: fix epoll_pwait() regression with < 2.6.19 (Ben Noordhuis)
+
+* test: back-port uv_loop_configure() test (Ben Noordhuis)
+
+
+2015.01.15, Version 1.2.1 (Stable), 4ca78e989062a1099dc4b9ad182a98e8374134b1
+
+Changes since version 1.2.0:
+
+* unix: remove unused dtrace file (Saúl Ibarra Corretgé)
+
+* test: skip TTY select test if /dev/tty can't be opened (Saúl Ibarra Corretgé)
+
+* doc: clarify the behavior of uv_tty_init (Saúl Ibarra Corretgé)
+
+* doc: clarify how uv_async_send behaves (Saúl Ibarra Corretgé)
+
+* build: make dist now generates a full tarball (Johan Bergström)
+
+* freebsd: make uv_exepath more resilient (Saúl Ibarra Corretgé)
+
+* unix: make setting the tty mode to the same value a no-op (Saúl Ibarra
+ Corretgé)
+
+* win,tcp: support uv_try_write (Bert Belder)
+
+* test: enable test-tcp-try-write on windows (Bert Belder)
+
+* win,tty: support uv_try_write (Bert Belder)
+
+* unix: set non-block mode in uv_{pipe,tcp,udp}_open (Ben Noordhuis)
+
+
+2015.01.06, Version 1.2.0 (Stable), 09f25b13cd149c7981108fc1a75611daf1277f83
+
+Changes since version 1.1.0:
+
+* linux: fix epoll_pwait() sigmask size calculation (Ben Noordhuis)
+
+* tty: implement binary I/O terminal mode (Yuri D'Elia)
+
+* test: fix spawn test with autotools build (Ben Noordhuis)
+
+* test: skip ipv6 tests when ipv6 is not supported (Ben Noordhuis)
+
+* common: move STATIC_ASSERT to uv-common.h (Alexey Melnichuk)
+
+* win/thread: store thread handle in a TLS slot (Alexey Melnichuk)
+
+* unix: fix ttl, multicast ttl and loop options on IPv6 (Saúl Ibarra Corretgé)
+
+* linux: fix support for preadv/pwritev-less kernels (Ben Noordhuis)
+
+* unix: make uv_exepath(size=0) return UV_EINVAL (Ben Noordhuis)
+
+* darwin: fix uv_exepath(smallbuf) UV_EPERM error (Ben Noordhuis)
+
+* openbsd: fix uv_exepath(smallbuf) UV_EINVAL error (Ben Noordhuis)
+
+* linux: fix uv_exepath(size=1) UV_EINVAL error (Ben Noordhuis)
+
+* sunos: preemptively fix uv_exepath(size=1) (Ben Noordhuis)
+
+* win: fix and clarify comments in winapi.h (Bert Belder)
+
+* win: make available NtQueryDirectoryFile (Bert Belder)
+
+* win: add definitions for directory information types (Bert Belder)
+
+* win: use NtQueryDirectoryFile to implement uv_fs_scandir (Bert Belder)
+
+* unix: don't unlink unix socket on bind error (Ben Noordhuis)
+
+* build: fix bad comment in autogen.sh (Ben Noordhuis)
+
+* build: add AC_PROG_LIBTOOL to configure.ac (Ben Noordhuis)
+
+* test: skip udp_options6 if there no IPv6 support (Saúl Ibarra Corretgé)
+
+* win: add definitions for MUI errors mingw lacks (Bert Belder)
+
+* build: enable warnings in autotools build (Ben Noordhuis)
+
+* build: remove -Wno-dollar-in-identifier-extension (Ben Noordhuis)
+
+* build: move flags from Makefile.am to configure.ac (Ben Noordhuis)
+
+
+2015.01.06, Version 0.10.32 (Stable), 378de30c59aef5fdb6d130fa5cfcb0a68fce571c
+
+Changes since version 0.10.31:
+
+* linux: fix epoll_pwait() sigmask size calculation (Ben Noordhuis)
+
+
+2014.12.25, Version 1.1.0 (Stable), 9572f3e74a167f59a8017e57ca3ebe91ffd88e18
+
+Changes since version 1.0.2:
+
+* test: test that closing a poll handle doesn't corrupt the stack (Bert Belder)
+
+* win: fix compilation of tests (Marc Schlaich)
+
+* Revert "win: keep a reference to AFD_POLL_INFO in cancel poll" (Bert Belder)
+
+* win: avoid stack corruption when closing a poll handle (Bert Belder)
+
+* test: fix test-fs-file-loop on Windows (Bert Belder)
+
+* test: fix test-cwd-and-chdir (Bert Belder)
+
+* doc: indicate what version uv_loop_configure was added on (Saúl Ibarra
+ Corretgé)
+
+* doc: fix sphinx warning (Saúl Ibarra Corretgé)
+
+* test: skip spawn_setuid_setgid if we get EACCES (Saúl Ibarra Corretgé)
+
+* test: silence some Clang warnings (Saúl Ibarra Corretgé)
+
+* test: relax osx_select_many_fds (Saúl Ibarra Corretgé)
+
+* test: fix compilation warnings when building with Clang (Saúl Ibarra
+ Corretgé)
+
+* win: fix autotools build of tests (Luis Lavena)
+
+* gitignore: ignore Visual Studio files (Marc Schlaich)
+
+* win: set fallback message if FormatMessage fails (Marc Schlaich)
+
+* win: fall back to default language in uv_dlerror (Marc Schlaich)
+
+* test: improve compatibility for dlerror test (Marc Schlaich)
+
+* test: check dlerror is "no error" in no error case (Marc Schlaich)
+
+* unix: change uv_cwd not to return a trailing slash (Saúl Ibarra Corretgé)
+
+* test: fix cwd_and_chdir test on Unix (Saúl Ibarra Corretgé)
+
+* test: add uv_cwd output to platform_output test (Saúl Ibarra Corretgé)
+
+* build: fix dragonflybsd autotools build (John Marino)
+
+* win: scandir use 'ls' for formatting long strings (Kenneth Perry)
+
+* build: remove clang and gcc_version gyp defines (Ben Noordhuis)
+
+* unix, windows: don't treat uv_run_mode as a bitmask (Saúl Ibarra Corretgé)
+
+* unix, windows: fix UV_RUN_ONCE mode if progress was made (Saúl Ibarra
+ Corretgé)
+
+
+2014.12.25, Version 0.10.31 (Stable), 4dbd27e2219069a6daa769fb37f98673b77b4261
+
+Changes since version 0.10.30:
+
+* test: test that closing a poll handle doesn't corrupt the stack (Bert Belder)
+
+* win: fix compilation of tests (Marc Schlaich)
+
+* Revert "win: keep a reference to AFD_POLL_INFO in cancel poll" (Bert Belder)
+
+* win: avoid stack corruption when closing a poll handle (Bert Belder)
+
+* gitignore: ignore Visual Studio files (Marc Schlaich)
+
+* win: set fallback message if FormatMessage fails (Marc Schlaich)
+
+* win: fall back to default language in uv_dlerror (Marc Schlaich)
+
+* test: improve compatibility for dlerror test (Marc Schlaich)
+
+* test: check dlerror is "no error" in no error case (Marc Schlaich)
+
+* build: link against -pthread (Logan Rosen)
+
+* win: scandir use 'ls' for formatting long strings (Kenneth Perry)
+
+
+2014.12.10, Version 1.0.2 (Stable), eec671f0059953505f9a3c9aeb7f9f31466dd7cd
+
+Changes since version 1.0.1:
+
+* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)
+
+* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)
+
+* doc: fix spelling (Joey Geralnik)
+
+* unix, windows: fix typos in comments (Joey Geralnik)
+
+* test: canonicalize test runner path (Ben Noordhuis)
+
+* test: fix compilation warnings (Saúl Ibarra Corretgé)
+
+* test: skip tty test if detected width and height are 0 (Saúl Ibarra Corretgé)
+
+* doc: update README with IRC channel (Saúl Ibarra Corretgé)
+
+* Revert "unix: use cfmakeraw() for setting raw TTY mode" (Ben Noordhuis)
+
+* doc: document how to get result of uv_fs_mkdtemp (Tim Caswell)
+
+* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)
+
+* unix, windows: add uv_loop_configure() function (Ben Noordhuis)
+
+* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)
+
+* test: raise fd limit for OSX select test (Saúl Ibarra Corretgé)
+
+* unix: remove overzealous assert in uv_read_stop (Saúl Ibarra Corretgé)
+
+* unix: reset the reading flag when a stream gets EOF (Saúl Ibarra Corretgé)
+
+* unix: stop reading if an error is produced (Saúl Ibarra Corretgé)
+
+* cleanup: remove all dead assignments (Maciej Małecki)
+
+* linux: return early if we have no interfaces (Maciej Małecki)
+
+* cleanup: remove a dead increment (Maciej Małecki)
+
+
+2014.12.10, Version 0.10.30 (Stable), 5a63f5e9546dca482eeebc3054139b21f509f21f
+
+Changes since version 0.10.29:
+
+* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)
+
+* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)
+
+* doc: update project links (Ben Noordhuis)
+
+* windows: fix compilation of tests (Marc Schlaich)
+
+* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)
+
+* unix, windows: add uv_loop_configure() function (Ben Noordhuis)
+
+* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)
+
+
+2014.11.27, Version 1.0.1 (Stable), 0a8e81374e861d425b56c45c8599595d848911d2
+
+Changes since version 1.0.0:
+
+* readme: remove Rust from users (Elijah Andrews)
+
+* doc,build,include: update project links (Ben Noordhuis)
+
+* doc: fix typo: Strcutures -> Structures (Michael Ira Krufky)
+
+* unix: fix processing process handles queue (Saúl Ibarra Corretgé)
+
+* win: replace non-ansi characters in source file (Bert Belder)
+
+
+2014.11.21, Version 1.0.0 (Stable), feb2a9e6947d892f449b2770c4090f7d8c88381b
+
+Changes since version 1.0.0-rc2:
+
+* doc: fix git/svn url for gyp repo in README (Emmanuel Odeke)
+
+* windows: fix fs_read with nbufs > 1 and offset (Unknown W. Brackets)
+
+* win: add missing IP_ADAPTER_UNICAST_ADDRESS_LH definition for MinGW
+ (huxingyi)
+
+* doc: mention homebrew in README (Mikhail Mukovnikov)
+
+* doc: add learnuv workshop to README (Thorsten Lorenz)
+
+* doc: fix parameter name in uv_fs_access (Saúl Ibarra Corretgé)
+
+* unix: use cfmakeraw() for setting raw TTY mode (Yuri D'Elia)
+
+* win: fix uv_thread_self() (Alexis Campailla)
+
+* build: add x32 support to gyp build (Ben Noordhuis)
+
+* build: remove dtrace probes (Ben Noordhuis)
+
+* doc: fix link in misc.rst (Manos Nikolaidis)
+
+* mailmap: remove duplicated entries (Saúl Ibarra Corretgé)
+
+* gyp: fix comment regarding version info location (Saúl Ibarra Corretgé)
+
+
+2014.10.21, Version 1.0.0-rc2 (Pre-release)
+
+Changes since version 1.0.0-rc1:
+
+* build: add missing fixtures to distribution tarball (Rob Adams)
+
+* doc: update references to current stable branch (Zachary Newman)
+
+* fs: fix readdir on empty directory (Fedor Indutny)
+
+* fs: rename uv_fs_readdir to uv_fs_scandir (Saúl Ibarra Corretgé)
+
+* doc: document uv_alloc_cb (Saúl Ibarra Corretgé)
+
+* doc: add migration guide from version 0.10 (Saúl Ibarra Corretgé)
+
+* build: add DragonFly BSD support in autotools (Robin Hahling)
+
+* doc: document missing stream related structures (Saúl Ibarra Corretgé)
+
+* doc: clarify uv_loop_t.data field lifetime (Saúl Ibarra Corretgé)
+
+* doc: add documentation for missing functions and structures (Saúl Ibarra
+ Corretgé)
+
+* doc: fix punctuation and grammar in README (Jeff Widman)
+
+* windows: return libuv error codes in uv_poll_init() (cjihrig)
+
+* unix, windows: add uv_fs_access() (cjihrig)
+
+* windows: fix netmask detection (Alexis Campailla)
+
+* unix, windows: don't include null byte in uv_cwd size (Saúl Ibarra Corretgé)
+
+* unix, windows: add uv_thread_equal (Tomasz Kołodziejski)
+
+* windows: fix fs_write with nbufs > 1 and offset (Unknown W. Brackets)
+
+
+2014.10.21, Version 0.10.29 (Stable), 2d728542d3790183417f8f122a110693cd85db14
+
+Changes since version 0.10.28:
+
+* darwin: allocate enough space for select() hack (Fedor Indutny)
+
+* linux: try epoll_pwait if epoll_wait is missing (Michael Hudson-Doyle)
+
+* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé)
+
+
+2014.09.18, Version 1.0.0-rc1 (Unstable), 0c28bbf7b42882853d1799ab96ff68b07f7f8d49
+
+Changes since version 0.11.29:
+
+* windows: improve timer precision (Alexis Campailla)
+
+* build, gyp: set xcode flags (Recep ASLANTAS)
+
+* ignore: include m4 files which are created manually (Recep ASLANTAS)
+
+* build: add m4 for feature/flag-testing (Recep ASLANTAS)
+
+* ignore: ignore Xcode project and workspace files (Recep ASLANTAS)
+
+* unix: fix warnings about dollar symbol usage in identifiers (Recep ASLANTAS)
+
+* unix: fix warnings when loading functions with dlsym (Recep ASLANTAS)
+
+* linux: try epoll_pwait if epoll_wait is missing (Michael Hudson-Doyle)
+
+* test: add test for closing and recreating default loop (Saúl Ibarra Corretgé)
+
+* windows: properly close the default loop (Saúl Ibarra Corretgé)
+
+* version: add ability to specify a version suffix (Saúl Ibarra Corretgé)
+
+* doc: add API documentation (Saúl Ibarra Corretgé)
+
+* test: don't close connection on write error (Trevor Norris)
+
+* windows: further simplify the code for timers (Saúl Ibarra Corretgé)
+
+* gyp: remove UNLIMITED_SELECT from dependent define (Fedor Indutny)
+
+* darwin: allocate enough space for select() hack (Fedor Indutny)
+
+* unix, windows: don't allow a NULL callback on timers (Saúl Ibarra Corretgé)
+
+* windows: simplify code in uv_timer_again (Saúl Ibarra Corretgé)
+
+* test: use less requests on tcp-write-queue-order (Saúl Ibarra Corretgé)
+
+* unix: stop child process watcher after last one exits (Saúl Ibarra Corretgé)
+
+* unix: simplify how process handle queue is managed (Saúl Ibarra Corretgé)
+
+* windows: remove duplicated field (mattn)
+
+* core: add a reserved field to uv_handle_t and uv_req_t (Saúl Ibarra Corretgé)
+
+* windows: fix buffer leak after failed udp send (Bert Belder)
+
+* windows: make sure sockets and handles are reset on close (Saúl Ibarra Corretgé)
+
+* unix, windows: add uv_fileno (Saúl Ibarra Corretgé)
+
+* build: use same CFLAGS in autotools build as in gyp (Saúl Ibarra Corretgé)
+
+* build: remove unneeded define in uv.gyp (Saúl Ibarra Corretgé)
+
+* test: fix watcher_cross_stop on Windows (Saúl Ibarra Corretgé)
+
+* unix, windows: move includes for EAI constants (Saúl Ibarra Corretgé)
+
+* unix: fix exposing EAI_* glibc-isms (Saúl Ibarra Corretgé)
+
+* unix: fix tcp write after bad connect freezing (Andrius Bentkus)
+
+
+2014.08.20, Version 0.11.29 (Unstable), 35451fed830807095bbae8ef981af004a4b9259e
+
+Changes since version 0.11.28:
+
+* windows: make uv_read_stop immediately stop reading (Jameson Nash)
+
+* windows: fix uv__getaddrinfo_translate_error (Alexis Campailla)
+
+* netbsd: fix build (Saúl Ibarra Corretgé)
+
+* unix, windows: add uv_recv_buffer_size and uv_send_buffer_size (Andrius
+ Bentkus)
+
+* windows: add support for UNC paths on uv_spawn (Paul Goldsmith)
+
+* windows: replace use of inet_addr with uv_inet_pton (Saúl Ibarra Corretgé)
+
+* unix: replace some asserts with returning errors (Andrius Bentkus)
+
+* windows: use OpenBSD implementation for uv_fs_mkdtemp (Pavel Platto)
+
+* windows: fix GetNameInfoW error handling (Alexis Campailla)
+
+* fs: introduce uv_readdir_next() and report types (Fedor Indutny)
+
+* fs: extend reported types in uv_fs_readdir_next (Saúl Ibarra Corretgé)
+
+* unix: read on stream even when UV__POLLHUP set. (Julien Gilli)
+
+
+2014.08.08, Version 0.11.28 (Unstable), fc9e2a0bc487b299c0cd3b2c9a23aeb554b5d8d1
+
+Changes since version 0.11.27:
+
+* unix, windows: const-ify handle in uv_udp_getsockname (Rasmus Pedersen)
+
+* windows: use UV_ECANCELED for aborted TCP writes (Saúl Ibarra Corretgé)
+
+* windows: add more required environment variables (Jameson Nash)
+
+* windows: sort environment variables before calling CreateProcess (Jameson
+ Nash)
+
+* unix, windows: move uv_loop_close out of assert (John Firebaugh)
+
+* windows: fix buffer overflow on uv__getnameinfo_work() (lilohuang)
+
+* windows: add uv_backend_timeout (Jameson Nash)
+
+* test: disable tcp_close_accept on Windows (Saúl Ibarra Corretgé)
+
+* windows: read the PATH env var of the child (Alex Crichton)
+
+* include: avoid using C++ 'template' reserved word (Iñaki Baz Castillo)
+
+* include: fix version number (Saúl Ibarra Corretgé)
+
+
+2014.07.32, Version 0.11.27 (Unstable), ffe24f955032d060968ea0289af365006afed55e
+
+Changes since version 0.11.26:
+
+* unix, windows: use the same threadpool implementation (Saúl Ibarra Corretgé)
+
+* unix: use struct sockaddr_storage for target UDP addr (Saúl Ibarra Corretgé)
+
+* doc: add documentation to uv_udp_start_recv (Andrius Bentkus)
+
+* common: use common uv__count_bufs code (Andrius Bentkus)
+
+* unix, win: add send_queue_size and send_queue_count to uv_udp_t (Andrius
+ Bentkus)
+
+* unix, win: add uv_udp_try_send (Andrius Bentkus)
+
+* unix: return UV_EAGAIN if uv_try_write cannot write any data (Saúl Ibarra
+ Corretgé)
+
+* windows: fix compatibility with cygwin pipes (Jameson Nash)
+
+* windows: count queued bytes even if request completed immediately (Saúl
+ Ibarra Corretgé)
+
+* windows: disable CRT debug handler on MinGW32 (Saúl Ibarra Corretgé)
+
+* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé)
+
+* unix: try to write immediately in uv_udp_send (Saúl Ibarra Corretgé)
+
+* unix: remove incorrect assert (Saúl Ibarra Corretgé)
+
+* openbsd: avoid requiring privileges for uv_resident_set_memory (Aaron Bieber)
+
+* unix: guarantee write queue cb execution order in streams (Andrius Bentkus)
+
+* img: add logo files (Saúl Ibarra Corretgé)
+
+* aix: improve AIX compatibility (Andrew Low)
+
+* windows: return bind error immediately when implicitly binding (Saúl Ibarra
+ Corretgé)
+
+* windows: don't use atexit for cleaning up the threadpool (Saúl Ibarra
+ Corretgé)
+
+* windows: destroy work queue elements when colsing a loop (Saúl Ibarra
+ Corretgé)
+
+* unix, windows: add uv_fs_mkdtemp (Pavel Platto)
+
+* build: handle platforms without multiprocessing.synchronize (Saúl Ibarra
+ Corretgé)
+
+* windows: change GENERIC_ALL to GENERIC_WRITE in fs__create_junction (Tony
+ Kelman)
+
+* windows: relay TCP bind errors via ipc (Alexis Campailla)
+
+
+2014.07.32, Version 0.10.28 (Stable), 9c14b616f5fb84bfd7d45707bab4bbb85894443e
+
+Changes since version 0.10.27:
+
+* windows: fix handling closed socket while poll handle is closing (Saúl Ibarra
+ Corretgé)
+
+* unix: return system error on EAI_SYSTEM (Saúl Ibarra Corretgé)
+
+* unix: fix bogus structure field name (Saúl Ibarra Corretgé)
+
+* darwin: invoke `mach_timebase_info` only once (Fedor Indutny)
+
+
+2014.06.28, Version 0.11.26 (Unstable), 115281a1058c4034d5c5ccedacb667fe3f6327ea
+
+Changes since version 0.11.25:
+
+* windows: add VT100 codes ?25l and ?25h (JD Ballard)
+
+* windows: add invert ANSI (7 / 27) emulation (JD Ballard)
+
+* unix: fix handling error on UDP socket creation (Saúl Ibarra Corretgé)
+
+* unix, windows: getnameinfo implementation (Rasmus Pedersen)
+
+* heap: fix `heap_remove()` (Fedor Indutny)
+
+* unix, windows: fix parsing scoped IPv6 addresses (Saúl Ibarra Corretgé)
+
+* windows: fix handling closed socket while poll handle is closing (Saúl Ibarra
+ Corretgé)
+
+* thread: barrier functions (Ben Noordhuis)
+
+* windows: fix PYTHON environment variable usage (Jay Satiro)
+
+* unix, windows: return system error on EAI_SYSTEM (Saúl Ibarra Corretgé)
+
+* windows: fix handling closed socket while poll handle is closing (Saúl Ibarra
+ Corretgé)
+
+* unix: don't run i/o callbacks after prepare callbacks (Saúl Ibarra Corretgé)
+
+* windows: add tty unicode support for input (Peter Atashian)
+
+* header: introduce `uv_loop_size()` (Andrius Bentkus)
+
+* darwin: invoke `mach_timebase_info` only once (Fedor Indutny)
+
+
+2014.05.02, Version 0.11.25 (Unstable), 2acd544cff7142e06aa3b09ec64b4a33dd9ab996
+
+Changes since version 0.11.24:
+
+* osx: pass const handle pointer to uv___stream_fd (Chernyshev Viacheslav)
+
+* unix, windows: pass const handle ptr to uv_tcp_get*name (Chernyshev
+ Viacheslav)
+
+* common: pass const sockaddr ptr to uv_ip*_name (Chernyshev Viacheslav)
+
+* unix, windows: validate flags on uv_udp|tcp_bind (Saúl Ibarra Corretgé)
+
+* unix: handle case when addr is not initialized after recvmsg (Saúl Ibarra
+ Corretgé)
+
+* unix, windows: uv_now constness (Rasmus Pedersen)
+
+
+2014.04.15, Version 0.11.24 (Unstable), ed948c29f6e8c290f79325a6f0bc9ef35bcde644
+
+Changes since version 0.11.23:
+
+* linux: reduce file descriptor count of async pipe (Ben Noordhuis)
+
+* sunos: support IPv6 qualified link-local addresses (Saúl Ibarra Corretgé)
+
+* windows: fix opening of read-only stdin pipes (Alexis Campailla)
+
+* windows: Fix an infinite loop in uv_spawn (Alex Crichton)
+
+* windows: fix console signal handler refcount (李港平)
+
+* inet: allow scopeid in uv_inet_pton (Fedor Indutny)
+
+
+2014.04.07, Version 0.11.23 (Unstable), e54de537efcacd593f36fcaaf8b4cb9e64313275
+
+Changes since version 0.11.22:
+
+* fs: avoid using readv/writev where possible (Fedor Indutny)
+
+* mingw: fix build with autotools (Saúl Ibarra Corretgé)
+
+* bsd: support IPv6 qualified link-local addresses (Saúl Ibarra Corretgé)
+
+* unix: add UV_HANDLE_IPV6 flag to tcp and udp handles (Saúl Ibarra Corretgé)
+
+* unix, windows: do not set SO_REUSEADDR by default on udp (Saúl Ibarra
+ Corretgé)
+
+* windows: fix check in uv_tty_endgame() (Maks Naumov)
+
+* unix, windows: add IPv6 support for uv_udp_multicast_interface (Saúl Ibarra
+ Corretgé)
+
+* unix: fallback to blocking writes if reopening a tty fails (Saúl Ibarra
+ Corretgé)
+
+* unix: fix handling uv__open_cloexec failure (Saúl Ibarra Corretgé)
+
+* unix, windows: add IPv6 support to uv_udp_set_membership (Saúl Ibarra
+ Corretgé)
+
+* unix, windows: removed unused status parameter (Saúl Ibarra Corretgé)
+
+* android: add support of ifaddrs in android (Javier Hernández)
+
+* build: fix SunOS and AIX build with autotools (Saúl Ibarra Corretgé)
+
+* build: freebsd link with libelf if dtrace enabled (Saúl Ibarra Corretgé)
+
+* stream: do not leak `alloc_cb` buffers on error (Fedor Indutny)
+
+* unix: fix setting written size on uv_wd (Saúl Ibarra Corretgé)
+
+
+2014.03.11, Version 0.11.22 (Unstable), cd0c19b1d3c56acf0ade7687006e12e75fbda36d
+
+Changes since version 0.11.21:
+
+* unix, windows: map ERANGE errno (Saúl Ibarra Corretgé)
+
+* unix, windows: make uv_cwd be consistent with uv_exepath (Saúl Ibarra
+ Corretgé)
+
+* process: remove debug perror() prints (Fedor Indutny)
+
+* windows: fall back for volume info query (Isaiah Norton)
+
+* pipe: allow queueing pending handles (Fedor Indutny)
+
+* windows: fix winsock status codes for address errors (Raul Martins)
+
+* windows: Remove unused variable from uv__pipe_insert_pending_socket (David
+ Capello)
+
+* unix: workaround broken pthread_sigmask on Android (Paul Tan)
+
+* error: add ENXIO for O_NONBLOCK FIFO open() (Fedor Indutny)
+
+* freebsd: use accept4, introduced in version 10 (Saúl Ibarra Corretgé)
+
+* windows: fix warnings of MinGW -Wall -O3 (StarWing)
+
+* openbsd, osx: fix compilation warning on scandir (Saúl Ibarra Corretgé)
+
+* linux: always deregister closing fds from epoll (Geoffry Song)
+
+* unix: reopen tty as /dev/tty (Saúl Ibarra Corretgé)
+
+* kqueue: invalidate fd in uv_fs_event_t (Fedor Indutny)
+
+
+2014.02.28, Version 0.11.21 (Unstable), 3ef958158ae1019e027ebaa93114160099db5206
+
+Changes since version 0.11.20:
+
+* unix: fix uv_fs_write when using an empty buffer (Saúl Ibarra Corretgé)
+
+* unix, windows: add assertion in uv_loop_delete (Saúl Ibarra Corretgé)
+
+
+2014.02.27, Version 0.11.20 (Unstable), 88355e081b51c69ee1e2b6b0015a4e3d38bd0579
+
+Changes since version 0.11.19:
+
+* stream: start thread after assignments (Oguz Bastemur)
+
+* fs: `uv__cloexec()` opened fd (Fedor Indutny)
+
+* gyp: qualify `library` variable (Fedor Indutny)
+
+* unix, win: add uv_udp_set_multicast_interface() (Austin Foxley)
+
+* unix: fix uv_tcp_nodelay return value in case of error (Saúl Ibarra Corretgé)
+
+* unix: call setgoups before calling setuid/setgid (Saúl Ibarra Corretgé)
+
+* include: mark close_cb field as private (Saúl Ibarra Corretgé)
+
+* unix, windows: map EFBIG errno (Saúl Ibarra Corretgé)
+
+* unix: correct error when calling uv_shutdown twice (Keno Fischer)
+
+* windows: fix building on MinGW (Alex Crichton)
+
+* windows: always initialize uv_process_t (Alex Crichton)
+
+* include: expose libuv version in header files (Saúl Ibarra Corretgé)
+
+* fs: vectored IO API for filesystem read/write (Benjamin Saunders)
+
+* windows: freeze in uv_tcp_endgame (Alexis Campailla)
+
+* sunos: handle rearm errors (Fedor Indutny)
+
+* unix: use a heap for timers (Ben Noordhuis)
+
+* linux: always deregister closing fds from epoll (Geoffry Song)
+
+* linux: include grp.h for setgroups() (William Light)
+
+* unix, windows: add uv_loop_init and uv_loop_close (Saúl Ibarra Corretgé)
+
+* unix, windows: add uv_getrusage() function (Oleg Efimov)
+
+* win: minor error handle fix to uv_pipe_write_impl (Rasmus Pedersen)
+
+* heap: fix node removal (Keno Fischer)
+
+* win: fix C99/C++ comment (Rasmus Pedersen)
+
+* fs: vectored IO API for filesystem read/write (Benjamin Saunders)
+
+* unix, windows: add uv_pipe_getsockname (Saúl Ibarra Corretgé)
+
+* unix, windows: map ENOPROTOOPT errno (Saúl Ibarra Corretgé)
+
+* errno: add ETXTBSY (Fedor Indutny)
+
+* fsevent: rename filename field to path (Saúl Ibarra Corretgé)
+
+* unix, windows: add uv_fs_event_getpath (Saúl Ibarra Corretgé)
+
+* unix, windows: add uv_fs_poll_getpath (Saúl Ibarra Corretgé)
+
+* unix, windows: map ERANGE errno (Saúl Ibarra Corretgé)
+
+* unix, windows: set required size on UV_ENOBUFS (Saúl Ibarra Corretgé)
+
+* unix, windows: clarify what uv_stream_set_blocking does (Saúl Ibarra
+ Corretgé)
+
+* fs: use preadv on Linux if available (Brian White)
+
+
+2014.01.30, Version 0.11.19 (Unstable), 336a1825309744f920230ec3e427e78571772347
+
+Changes since version 0.11.18:
+
+* linux: move sscanf() out of the assert() (Trevor Norris)
+
+* linux: fix C99/C++ comment (Fedor Indutny)
+
+
+2014.05.02, Version 0.10.27 (Stable), 6e24ce23b1e7576059f85a608eca13b766458a01
+
+Changes since version 0.10.26:
+
+* windows: fix console signal handler refcount (Saúl Ibarra Corretgé)
+
+* win: always leave crit section in get_proc_title (Fedor Indutny)
+
+
+2014.04.07, Version 0.10.26 (Stable), d864907611c25ec986c5e77d4d6d6dee88f26926
+
+Changes since version 0.10.25:
+
+* process: don't close stdio fds during spawn (Tonis Tiigi)
+
+* build, windows: do not fail on Windows SDK Prompt (Marc Schlaich)
+
+* build, windows: fix x64 configuration issue (Marc Schlaich)
+
+* win: fix buffer leak on error in pipe.c (Fedor Indutny)
+
+* kqueue: invalidate fd in uv_fs_event_t (Fedor Indutny)
+
+* linux: always deregister closing fds from epoll (Geoffry Song)
+
+* error: add ENXIO for O_NONBLOCK FIFO open() (Fedor Indutny)
+
+
+2014.02.19, Version 0.10.25 (Stable), d778dc588507588b12b9f9d2905078db542ed751
+
+Changes since version 0.10.24:
+
+* stream: start thread after assignments (Oguz Bastemur)
+
+* unix: correct error when calling uv_shutdown twice (Saúl Ibarra Corretgé)
+
+2014.01.30, Version 0.10.24 (Stable), aecd296b6bce9b40f06a61c5c94e43d45ac7308a
+
+Changes since version 0.10.23:
+
+* linux: move sscanf() out of the assert() (Trevor Norris)
+
+* linux: fix C99/C++ comment (Fedor Indutny)
+
+
+2014.01.23, Version 0.11.18 (Unstable), d47962e9d93d4a55a9984623feaf546406c9cdbb
+
+Changes since version 0.11.17:
+
+* osx: Fix a possible segfault in uv__io_poll (Alex Crichton)
+
+* windows: improved handling of invalid FDs (Alexis Campailla)
+
+* doc: adding ARCHS flag to OS X build command (Nathan Sweet)
+
+* tcp: reveal bind-time errors before listen (Alexis Campailla)
+
+* tcp: uv_tcp_dualstack() (Fedor Indutny)
+
+* linux: relax assumption on /proc/stat parsing (Luca Bruno)
+
+* openbsd: fix obvious bug in uv_cpu_info (Fedor Indutny)
+
+* process: close stdio after dup2'ing it (Fedor Indutny)
+
+* linux: move sscanf() out of the assert() (Trevor Norris)
+
+
+2014.01.23, Version 0.10.23 (Stable), dbd218e699fec8be311d85e4788be9e28ae884f8
+
+Changes since version 0.10.22:
+
+* linux: relax assumption on /proc/stat parsing (Luca Bruno)
+
+* openbsd: fix obvious bug in uv_cpu_info (Fedor Indutny)
+
+* process: close stdio after dup2'ing it (Fedor Indutny)
+
+
+2014.01.08, Version 0.10.22 (Stable), f526c90eeff271d9323a9107b9a64a4671fd3103
+
+Changes since version 0.10.21:
+
+* windows: avoid assertion failure when pipe server is closed (Bert Belder)
+
+
+2013.12.32, Version 0.11.17 (Unstable), 589c224d4c2e79fec65db01d361948f1e4976858
+
+Changes since version 0.11.16:
+
+* stream: allow multiple buffers for uv_try_write (Fedor Indutny)
+
+* unix: fix a possible memory leak in uv_fs_readdir (Alex Crichton)
+
+* unix, windows: add uv_loop_alive() function (Sam Roberts)
+
+* windows: avoid assertion failure when pipe server is closed (Bert Belder)
+
+* osx: Fix a possible segfault in uv__io_poll (Alex Crichton)
+
+* stream: fix uv__stream_osx_select (Fedor Indutny)
+
+
+2013.12.14, Version 0.11.16 (Unstable), ae0ed8c49d0d313c935c22077511148b6e8408a4
+
+Changes since version 0.11.15:
+
+* fsevents: remove kFSEventStreamCreateFlagNoDefer polyfill (ci-innoq)
+
+* libuv: add more getaddrinfo errors (Steven Kabbes)
+
+* unix: fix accept() EMFILE error handling (Ben Noordhuis)
+
+* linux: fix up SO_REUSEPORT back-port (Ben Noordhuis)
+
+* fsevents: fix subfolder check (Fedor Indutny)
+
+* fsevents: fix invalid memory access (huxingyi)
+
+* windows/timer: fix uv_hrtime discontinuity (Bert Belder)
+
+* unix: fix various memory leaks and undef behavior (Fedor Indutny)
+
+* unix, windows: always update loop time (Saúl Ibarra Corretgé)
+
+* windows: translate system errors in uv_spawn (Alexis Campailla)
+
+* windows: uv_spawn code refactor (Alexis Campailla)
+
+* unix, windows: detect errors in uv_ip4/6_addr (Yorkie)
+
+* stream: introduce uv_try_write(...) (Fedor Indutny)
+
+
+2013.12.13, Version 0.10.20 (Stable), 04141464dd0fba90ace9aa6f7003ce139b888a40
+
+Changes since version 0.10.19:
+
+* linux: fix up SO_REUSEPORT back-port (Ben Noordhuis)
+
+* fs-event: fix invalid memory access (huxingyi)
+
+
+2013.11.21, Version 0.11.15 (Unstable), bfe645ed7e99ca5670d9279ad472b604c129d2e5
+
+Changes since version 0.11.14:
+
+* fsevents: report errors to user (Fedor Indutny)
+
+* include: UV_FS_EVENT_RECURSIVE is a flag (Fedor Indutny)
+
+* linux: use CLOCK_MONOTONIC_COARSE if available (Ben Noordhuis)
+
+* build: make systemtap probes work with gyp build (Ben Noordhuis)
+
+* unix: update events from pevents between polls (Fedor Indutny)
+
+* fsevents: support japaneese characters in path (Chris Bank)
+
+* linux: don't turn on SO_REUSEPORT socket option (Ben Noordhuis)
+
+* queue: strengthen type checks (Ben Noordhuis)
+
+* include: remove uv_strlcat() and uv_strlcpy() (Ben Noordhuis)
+
+* build: fix windows smp build with gyp (Geert Jansen)
+
+* unix: return exec errors from uv_spawn, not async (Alex Crichton)
+
+* fsevents: use native character encoding file paths (Ben Noordhuis)
+
+* linux: handle EPOLLHUP without EPOLLIN/EPOLLOUT (Ben Noordhuis)
+
+* windows: use _snwprintf(), not swprintf() (Ben Noordhuis)
+
+* fsevents: use FlagNoDefer for FSEventStreamCreate (Fedor Indutny)
+
+* unix: fix reopened fd bug (Fedor Indutny)
+
+* core: fix fake watcher list and count preservation (Fedor Indutny)
+
+* unix: set close-on-exec flag on received fds (Ben Noordhuis)
+
+* netbsd, openbsd: enable futimes() wrapper (Ben Noordhuis)
+
+* unix: nicer error message when kqueue() fails (Ben Noordhuis)
+
+* samples: add socks5 proxy sample application (Ben Noordhuis)
+
+
+2013.11.13, Version 0.10.19 (Stable), 33959f7524090b8d2c6c41e2400ca77e31755059
+
+Changes since version 0.10.18:
+
+* darwin: avoid calling GetCurrentProcess (Fedor Indutny)
+
+* unix: update events from pevents between polls (Fedor Indutny)
+
+* fsevents: support japaneese characters in path (Chris Bank)
+
+* linux: don't turn on SO_REUSEPORT socket option (Ben Noordhuis)
+
+* build: fix windows smp build with gyp (Geert Jansen)
+
+* linux: handle EPOLLHUP without EPOLLIN/EPOLLOUT (Ben Noordhuis)
+
+* unix: fix reopened fd bug (Fedor Indutny)
+
+* core: fix fake watcher list and count preservation (Fedor Indutny)
+
+
+2013.10.30, Version 0.11.14 (Unstable), d7a6482f45c1b4eb4a853dbe1a9ce8090a35633a
+
+Changes since version 0.11.13:
+
+* darwin: create fsevents thread on demand (Ben Noordhuis)
+
+* fsevents: FSEvents is most likely not thread-safe (Fedor Indutny)
+
+* fsevents: use shared FSEventStream (Fedor Indutny)
+
+* windows: make uv_fs_chmod() report errors correctly (Bert Belder)
+
+* windows: make uv_shutdown() for write-only pipes work (Bert Belder)
+
+* windows/fs: wrap multi-statement macros in do..while block (Bert Belder)
+
+* windows/fs: make uv_fs_open() report EINVAL correctly (Bert Belder)
+
+* windows/fs: handle _open_osfhandle() failure correctly (Bert Belder)
+
+* windows/fs: wrap multi-statement macros in do..while block (Bert Belder)
+
+* windows/fs: make uv_fs_open() report EINVAL correctly (Bert Belder)
+
+* windows/fs: handle _open_osfhandle() failure correctly (Bert Belder)
+
+* build: clarify instructions for Windows (Brian Kaisner)
+
+* build: remove GCC_WARN_ABOUT_MISSING_NEWLINE (Ben Noordhuis)
+
+* darwin: fix 10.6 build error in fsevents.c (Ben Noordhuis)
+
+* windows: run close callbacks after polling for i/o (Saúl Ibarra Corretgé)
+
+* include: clarify uv_tcp_bind() behavior (Ben Noordhuis)
+
+* include: clean up includes in uv.h (Ben Noordhuis)
+
+* include: remove UV_IO_PRIVATE_FIELDS macro (Ben Noordhuis)
+
+* include: fix typo in comment in uv.h (Ben Noordhuis)
+
+* include: update uv_is_active() documentation (Ben Noordhuis)
+
+* include: make uv_process_options_t.cwd const (Ben Noordhuis)
+
+* unix: wrap long lines at 80 columns (Ben Noordhuis)
+
+* unix, windows: make uv_is_*() always return 0 or 1 (Ben Noordhuis)
+
+* bench: measure total/init/dispatch/cleanup times (Ben Noordhuis)
+
+* build: use -pthread on sunos (Timothy J. Fontaine)
+
+* windows: remove duplicate check in stream.c (Ben Noordhuis)
+
+* unix: sanity-check fds before closing (Ben Noordhuis)
+
+* unix: remove uv__pipe_accept() (Ben Noordhuis)
+
+* unix: fix uv_spawn() NULL pointer deref on ENOMEM (Ben Noordhuis)
+
+* unix: don't close inherited fds on uv_spawn() fail (Ben Noordhuis)
+
+* unix: revert recent FSEvent changes (Ben Noordhuis)
+
+* fsevents: fix clever rescheduling (Fedor Indutny)
+
+* linux: ignore fractional time in uv_uptime() (Ben Noordhuis)
+
+* unix: fix SIGCHLD waitpid() race in process.c (Ben Noordhuis)
+
+* unix, windows: add uv_fs_event_start/stop functions (Saúl Ibarra Corretgé)
+
+* unix: fix non-synchronized access in signal.c (Ben Noordhuis)
+
+* unix: add atomic-ops.h (Ben Noordhuis)
+
+* unix: add spinlock.h (Ben Noordhuis)
+
+* unix: clean up uv_tty_set_mode() a little (Ben Noordhuis)
+
+* unix: make uv_tty_reset_mode() async signal-safe (Ben Noordhuis)
+
+* include: add E2BIG status code mapping (Ben Noordhuis)
+
+* windows: fix duplicate case build error (Ben Noordhuis)
+
+* windows: remove unneeded check (Saúl Ibarra Corretgé)
+
+* include: document pipe path truncation behavior (Ben Noordhuis)
+
+* fsevents: increase stack size for OSX 10.9 (Fedor Indutny)
+
+* windows: _snprintf expected wrong parameter type in string (Maks Naumov)
+
+* windows: "else" keyword is missing (Maks Naumov)
+
+* windows: incorrect check for SOCKET_ERROR (Maks Naumov)
+
+* windows: add stdlib.h to satisfy reference to abort (Sean Farrell)
+
+* build: fix check target for mingw (Sean Farrell)
+
+* unix: move uv_shutdown() assertion (Keno Fischer)
+
+* darwin: avoid calling GetCurrentProcess (Fedor Indutny)
+
+
+2013.10.19, Version 0.10.18 (Stable), 9ec52963b585e822e87bdc5de28d6143aff0d2e5
+
+Changes since version 0.10.17:
+
+* unix: fix uv_spawn() NULL pointer deref on ENOMEM (Ben Noordhuis)
+
+* unix: don't close inherited fds on uv_spawn() fail (Ben Noordhuis)
+
+* unix: revert recent FSEvent changes (Ben Noordhuis)
+
+* unix: fix non-synchronized access in signal.c (Ben Noordhuis)
+
+
+2013.09.25, Version 0.10.17 (Stable), 9670e0a93540c2f0d86c84a375f2303383c11e7e
+
+Changes since version 0.10.16:
+
+* build: remove GCC_WARN_ABOUT_MISSING_NEWLINE (Ben Noordhuis)
+
+* darwin: fix 10.6 build error in fsevents.c (Ben Noordhuis)
+
+
+2013.09.06, Version 0.10.16 (Stable), 2bce230d81f4853a23662cbeb26fe98010b1084b
+
+Changes since version 0.10.15:
+
+* windows: make uv_shutdown() for write-only pipes work (Bert Belder)
+
+* windows: make uv_fs_open() report EINVAL when invalid arguments are passed
+ (Bert Belder)
+
+* windows: make uv_fs_open() report _open_osfhandle() failure correctly (Bert
+ Belder)
+
+* windows: make uv_fs_chmod() report errors correctly (Bert Belder)
+
+* windows: wrap multi-statement macros in do..while block (Bert Belder)
+
+
+2013.09.05, Version 0.11.13 (Unstable), f5b6db6c1d7f93d28281207fd47c3841c9a9792e
+
+Changes since version 0.11.12:
+
+* unix: define _GNU_SOURCE, exposes glibc-isms (Ben Noordhuis)
+
+* windows: check for nonconforming swprintf arguments (Brent Cook)
+
+* build: include internal headers in source list (Brent Cook)
+
+* include: merge uv_tcp_bind and uv_tcp_bind6 (Ben Noordhuis)
+
+* include: merge uv_tcp_connect and uv_tcp_connect6 (Ben Noordhuis)
+
+* include: merge uv_udp_bind and uv_udp_bind6 (Ben Noordhuis)
+
+* include: merge uv_udp_send and uv_udp_send6 (Ben Noordhuis)
+
+
+2013.09.03, Version 0.11.12 (Unstable), 82d01d5f6780d178f5176a01425ec297583c0811
+
+Changes since version 0.11.11:
+
+* test: fix epoll_wait() usage in test-embed.c (Ben Noordhuis)
+
+* include: uv_alloc_cb now takes uv_buf_t* (Ben Noordhuis)
+
+* include: uv_read{2}_cb now takes const uv_buf_t* (Ben Noordhuis)
+
+* include: uv_ip[46]_addr now takes sockaddr_in* (Ben Noordhuis)
+
+* include: uv_tcp_bind{6} now takes sockaddr_in* (Ben Noordhuis)
+
+* include: uv_tcp_connect{6} now takes sockaddr_in* (Ben Noordhuis)
+
+* include: uv_udp_recv_cb now takes const uv_buf_t* (Ben Noordhuis)
+
+* include: uv_udp_bind{6} now takes sockaddr_in* (Ben Noordhuis)
+
+* include: uv_udp_send{6} now takes sockaddr_in* (Ben Noordhuis)
+
+* include: uv_spawn takes const uv_process_options_t* (Ben Noordhuis)
+
+* include: make uv_write{2} const correct (Ben Noordhuis)
+
+* windows: fix flags assignment in uv_fs_readdir() (Ben Noordhuis)
+
+* windows: fix stray comments (Ben Noordhuis)
+
+* windows: remove unused is_path_dir() function (Ben Noordhuis)
+
+
+2013.08.30, Version 0.11.11 (Unstable), ba876d53539ed0427c52039012419cd9374c6f0d
+
+Changes since version 0.11.10:
+
+* unix, windows: add thread-local storage API (Ben Noordhuis)
+
+* linux: don't turn on SO_REUSEPORT socket option (Ben Noordhuis)
+
+* darwin: fix 10.6 build error in fsevents.c (Ben Noordhuis)
+
+* windows: make uv_shutdown() for write-only pipes work (Bert Belder)
+
+* include: update uv_udp_open() / uv_udp_bind() docs (Ben Noordhuis)
+
+* unix: req queue must be empty when destroying loop (Ben Noordhuis)
+
+* unix: move loop functions from core.c to loop.c (Ben Noordhuis)
+
+* darwin: remove CoreFoundation dependency (Ben Noordhuis)
+
+* windows: make autotools build system work with mingw (Keno Fischer)
+
+* windows: fix mingw build (Alex Crichton)
+
+* windows: tweak Makefile.mingw for easier usage (Alex Crichton)
+
+* build: remove _GNU_SOURCE macro definition (Ben Noordhuis)
+
+
+2013.08.25, Version 0.11.10 (Unstable), 742dadcb7154cc7bb89c0c228a223b767a36cf0d
+
+* windows: Re-implement uv_fs_stat. The st_ctime field now contains the change
+ time, not the creation time, like on unix systems. st_dev, st_ino, st_blocks
+ and st_blksize are now also filled out. (Bert Belder)
+
+* linux: fix setsockopt(SO_REUSEPORT) error handling (Ben Noordhuis)
+
+* windows: report uv_process_t exit code correctly (Bert Belder)
+
+* windows: make uv_fs_chmod() report errors correctly (Bert Belder)
+
+* windows: make some more NT apis available for libuv's internal use (Bert
+ Belder)
+
+* windows: squelch some compiler warnings (Bert Belder)
+
+
+2013.08.24, Version 0.11.9 (Unstable), a2d29b5b068cbac93dc16138fb30a74e2669daad
+
+Changes since version 0.11.8:
+
+* fsevents: share FSEventStream between multiple FS watchers, which removes a
+ limit on the maximum number of file watchers that can be created on OS X.
+ (Fedor Indutny)
+
+* process: the `exit_status` parameter for a uv_process_t's exit callback now
+ is an int64_t, and no longer an int. (Bert Belder)
+
+* process: make uv_spawn() return some types of errors immediately on windows,
+ instead of passing the error code the the exit callback. This brings it on
+ par with libuv's behavior on unix. (Bert Belder)
+
+
+2013.08.24, Version 0.10.15 (Stable), 221078a8fdd9b853c6b557b3d9a5dd744b4fdd6b
+
+Changes since version 0.10.14:
+
+* fsevents: create FSEvents thread on demand (Ben Noordhuis)
+
+* fsevents: use a single thread for interacting with FSEvents, because it's not
+ thread-safe. (Fedor Indutny)
+
+* fsevents: share FSEventStream between multiple FS watchers, which removes a
+ limit on the maximum number of file watchers that can be created on OS X.
+ (Fedor Indutny)
+
+
+2013.08.22, Version 0.11.8 (Unstable), a5260462db80ab0deab6b9e6a8991dd8f5a9a2f8
+
+Changes since version 0.11.7:
+
+* unix: fix missing return value warning in stream.c (Ben Noordhuis)
+
+* build: serial-tests was added in automake v1.12 (Ben Noordhuis)
+
+* windows: fix uninitialized local variable warning (Ben Noordhuis)
+
+* windows: fix missing return value warning (Ben Noordhuis)
+
+* build: fix string comparisons in autogen.sh (Ben Noordhuis)
+
+* windows: move INLINE macro, remove UNUSED (Ben Noordhuis)
+
+* unix: clean up __attribute__((quux)) usage (Ben Noordhuis)
+
+* sunos: remove futimes() macro (Ben Noordhuis)
+
+* unix: fix uv__signal_unlock() prototype (Ben Noordhuis)
+
+* unix, windows: allow NULL async callback (Ben Noordhuis)
+
+* build: apply dtrace -G to all object files (Timothy J. Fontaine)
+
+* darwin: fix indentation in uv__hrtime() (Ben Noordhuis)
+
+* darwin: create fsevents thread on demand (Ben Noordhuis)
+
+* darwin: reduce fsevents thread stack size (Ben Noordhuis)
+
+* darwin: call pthread_setname_np() if available (Ben Noordhuis)
+
+* build: fix automake serial-tests check again (Ben Noordhuis)
+
+* unix: retry waitpid() on EINTR (Ben Noordhuis)
+
+* darwin: fix ios build error (Ben Noordhuis)
+
+* darwin: fix ios compiler warning (Ben Noordhuis)
+
+* test: simplify test-ip6-addr.c (Ben Noordhuis)
+
+* unix, windows: fix ipv6 link-local address parsing (Ben Noordhuis)
+
+* fsevents: FSEvents is most likely not thread-safe (Fedor Indutny)
+
+* windows: omit stdint.h, fix msvc 2008 build error (Ben Noordhuis)
+
+
+2013.08.22, Version 0.10.14 (Stable), 15d64132151c18b26346afa892444b95e2addad0
+
+Changes since version 0.10.13:
+
+* unix: retry waitpid() on EINTR (Ben Noordhuis)
+
+
+2013.08.07, Version 0.11.7 (Unstable), 3cad361f8776f70941b39d65bd9426bcb1aa817b
+
+Changes since version 0.11.6:
+
+* unix, windows: fix uv_fs_chown() function prototype (Ben Noordhuis)
+
+* unix, windows: remove unused variables (Brian White)
+
+* test: fix signed/unsigned comparison warnings (Ben Noordhuis)
+
+* build: dtrace shouldn't break out of tree builds (Timothy J. Fontaine)
+
+* unix, windows: don't read/recv if buf.len==0 (Ben Noordhuis)
+
+* build: add mingw makefile (Ben Noordhuis)
+
+* unix, windows: add MAC to uv_interface_addresses() (Brian White)
+
+* build: enable AM_INIT_AUTOMAKE([subdir-objects]) (Ben Noordhuis)
+
+* unix, windows: make buf arg to uv_fs_write const (Ben Noordhuis)
+
+* sunos: fix build breakage introduced in e3a657c (Ben Noordhuis)
+
+* aix: fix build breakage introduced in 3ee4d3f (Ben Noordhuis)
+
+* windows: fix mingw32 build, define JOB_OBJECT_XXX (Yasuhiro Matsumoto)
+
+* windows: fix mingw32 build, include limits.h (Yasuhiro Matsumoto)
+
+* test: replace sprintf() with snprintf() (Ben Noordhuis)
+
+* test: replace strcpy() with strncpy() (Ben Noordhuis)
+
+* openbsd: fix uv_ip6_addr() unused variable warnings (Ben Noordhuis)
+
+* openbsd: fix dlerror() const correctness warning (Ben Noordhuis)
+
+* openbsd: fix uv_fs_sendfile() unused variable warnings (Ben Noordhuis)
+
+* build: disable parallel automake tests (Ben Noordhuis)
+
+* test: add windows-only snprintf() function (Ben Noordhuis)
+
+* build: add automake serial-tests version check (Ben Noordhuis)
+
+
+2013.07.26, Version 0.10.13 (Stable), 381312e1fe6fecbabc943ccd56f0e7d114b3d064
+
+Changes since version 0.10.12:
+
+* unix, windows: fix uv_fs_chown() function prototype (Ben Noordhuis)
+
+
+2013.07.21, Version 0.11.6 (Unstable), 6645b93273e0553d23823c576573b82b129bf28c
+
+Changes since version 0.11.5:
+
+* test: open stdout fd in write-only mode (Ben Noordhuis)
+
+* windows: uv_spawn shouldn't reject reparse points (Bert Belder)
+
+* windows: use WSAGetLastError(), not errno (Ben Noordhuis)
+
+* build: darwin: disable -fstrict-aliasing warnings (Ben Noordhuis)
+
+* test: fix signed/unsigned compiler warning (Ben Noordhuis)
+
+* test: add 'start timer from check handle' test (Ben Noordhuis)
+
+* build: `all` now builds static and dynamic lib (Ben Noordhuis)
+
+* unix, windows: add extra fields to uv_stat_t (Saúl Ibarra Corretgé)
+
+* build: add install target to the makefile (Navaneeth Kedaram Nambiathan)
+
+* build: switch to autotools (Ben Noordhuis)
+
+* build: use AM_PROG_AR conditionally (Ben Noordhuis)
+
+* test: fix fs_fstat test on sunos (Ben Noordhuis)
+
+* test: fix fs_chown when running as root (Ben Noordhuis)
+
+* test: fix spawn_setgid_fails and spawn_setuid_fails (Ben Noordhuis)
+
+* build: use AM_SILENT_RULES conditionally (Ben Noordhuis)
+
+* build: add DTrace detection for autotools (Timothy J. Fontaine)
+
+* linux,darwin,win: link-local IPv6 addresses (Miroslav Bajtoš)
+
+* unix: fix build when !defined(PTHREAD_MUTEX_ERRORCHECK) (Ben Noordhuis)
+
+* unix, windows: return error codes directly (Ben Noordhuis)
+
+
+2013.07.10, Version 0.10.12 (Stable), 58a46221bba726746887a661a9f36fe9ff204209
+
+Changes since version 0.10.11:
+
+* linux: add support for MIPS (Andrei Sedoi)
+
+* windows: uv_spawn shouldn't reject reparse points (Bert Belder)
+
+* windows: use WSAGetLastError(), not errno (Ben Noordhuis)
+
+* build: darwin: disable -fstrict-aliasing warnings (Ben Noordhuis)
+
+* build: `all` now builds static and dynamic lib (Ben Noordhuis)
+
+* unix: fix build when !defined(PTHREAD_MUTEX_ERRORCHECK) (Ben Noordhuis)
+
+
+2013.06.27, Version 0.11.5 (Unstable), e3c63ff1627a14e96f54c1c62b0d68b446d8425b
+
+Changes since version 0.11.4:
+
+* build: remove CSTDFLAG, use only CFLAGS (Ben Noordhuis)
+
+* unix: support for android builds (Linus Mårtensson)
+
+* unix: avoid extra read, short-circuit on POLLHUP (Ben Noordhuis)
+
+* uv: support android libuv standalone build (Linus Mårtensson)
+
+* src: make queue.h c++ compatible (Ben Noordhuis)
+
+* unix: s/ngx-queue.h/queue.h/ in checksparse.sh (Ben Noordhuis)
+
+* unix: unconditionally stop handle on close (Ben Noordhuis)
+
+* freebsd: don't enable dtrace if it's not available (Brian White)
+
+* build: make HAVE_DTRACE=0 should disable dtrace (Timothy J. Fontaine)
+
+* unix: remove overzealous assert (Ben Noordhuis)
+
+* unix: remove unused function uv_fatal_error() (Ben Noordhuis)
+
+* unix, windows: clean up uv_thread_create() (Ben Noordhuis)
+
+* queue: fix pointer truncation on LLP64 platforms (Bert Belder)
+
+* build: set OS=="android" for android builds (Linus Mårtensson)
+
+* windows: don't use uppercase in include filename (Ben Noordhuis)
+
+* stream: add an API to make streams do blocking writes (Henry Rawas)
+
+* windows: use WSAGetLastError(), not errno (Ben Noordhuis)
+
+
+2013.06.13, Version 0.10.11 (Stable), c3b75406a66a10222a589cb173e8f469e9665c7e
+
+Changes since version 0.10.10:
+
+* unix: unconditionally stop handle on close (Ben Noordhuis)
+
+* freebsd: don't enable dtrace if it's not available (Brian White)
+
+* build: make HAVE_DTRACE=0 should disable dtrace (Timothy J. Fontaine)
+
+* unix: remove overzealous assert (Ben Noordhuis)
+
+* unix: clear UV_STREAM_SHUTTING after shutdown() (Ben Noordhuis)
+
+* unix: fix busy loop, write if POLLERR or POLLHUP (Ben Noordhuis)
+
+
+2013.06.05, Version 0.10.10 (Stable), 0d95a88bd35fce93863c57a460be613aea34d2c5
+
+Changes since version 0.10.9:
+
+* include: document uv_update_time() and uv_now() (Ben Noordhuis)
+
+* linux: fix cpu model parsing on newer arm kernels (Ben Noordhuis)
+
+* linux: fix a memory leak in uv_cpu_info() error path (Ben Noordhuis)
+
+* linux: don't ignore out-of-memory errors in uv_cpu_info() (Ben Noordhuis)
+
+* unix, windows: move uv_now() to uv-common.c (Ben Noordhuis)
+
+* test: fix a compilation problem in test-osx-select.c that was caused by the
+ use of c-style comments (Bert Belder)
+
+* darwin: use uv_fs_sendfile() use the sendfile api correctly (Wynn Wilkes)
+
+
+2013.05.30, Version 0.11.4 (Unstable), e43e5b3d954a0989db5588aa110e1fe4fe6e0219
+
+Changes since version 0.11.3:
+
+* windows: make uv_spawn not fail when the libuv embedding application is run
+ under external job control (Bert Belder)
+
+* darwin: assume CFRunLoopStop() isn't thread-safe, fixing a race condition
+ when stopping the 'stdin select hack' thread (Fedor Indutny)
+
+* win: fix UV_EALREADY not being reported correctly to the libuv user in some
+ cases (Bert Belder)
+
+* darwin: make the uv__cf_loop_runner and uv__cf_loop_cb functions static (Ben
+ Noordhuis)
+
+* darwin: task_info() cannot fail (Ben Noordhuis)
+
+* unix: add error mapping for ENETDOWN (Ben Noordhuis)
+
+* unix: implicitly signal write errors to the libuv user (Ben Noordhuis)
+
+* unix: fix assertion error on signal pipe overflow (Bert Belder)
+
+* unix: turn off POLLOUT after stream connect (Ben Noordhuis)
+
+* unix: fix stream refcounting buglet (Ben Noordhuis)
+
+* unix: remove assert statements that are no longer correct (Ben Noordhuis)
+
+* unix: appease warning about non-standard `inline` (Sean Silva)
+
+* unix: add uv__is_closing() macro (Ben Noordhuis)
+
+* unix: stop stream POLLOUT watcher on write error (Ben Noordhuis)
+
+* include: document uv_update_time() and uv_now() (Ben Noordhuis)
+
+* linux: fix cpu model parsing on newer arm kernels (Ben Noordhuis)
+
+* linux: fix a memory leak in uv_cpu_info() error path (Ben Noordhuis)
+
+* linux: don't ignore out-of-memory errors in uv_cpu_info() (Ben Noordhuis)
+
+* unix, windows: move uv_now() to uv-common.c (Ben Noordhuis)
+
+* test: fix a compilation problem in test-osx-select.c that was caused by the
+ use of c-style comments (Bert Belder)
+
+* darwin: use uv_fs_sendfile() use the sendfile api correctly (Wynn Wilkes)
+
+* windows: call idle handles on every loop iteration, something the unix
+ implementation already did (Bert Belder)
+
+* test: update the idle-starvation test to verify that idle handles are called
+ in every loop iteration (Bert Belder)
+
+* unix, windows: ensure that uv_run() in RUN_ONCE mode calls timers that expire
+ after blocking (Ben Noordhuis)
+
+
+2013.05.29, Version 0.10.9 (Stable), a195f9ace23d92345baf57582678bfc3017e6632
+
+Changes since version 0.10.8:
+
+* unix: fix stream refcounting buglet (Ben Noordhuis)
+
+* unix: remove erroneous asserts (Ben Noordhuis)
+
+* unix: add uv__is_closing() macro (Ben Noordhuis)
+
+* unix: stop stream POLLOUT watcher on write error (Ben Noordhuis)
+
+
+2013.05.25, Version 0.10.8 (Stable), 0f39be12926fe2d8766a9f025797a473003e6504
+
+Changes since version 0.10.7:
+
+* windows: make uv_spawn not fail under job control (Bert Belder)
+
+* darwin: assume CFRunLoopStop() isn't thread-safe (Fedor Indutny)
+
+* win: fix UV_EALREADY incorrectly set (Bert Belder)
+
+* darwin: make two uv__cf_*() functions static (Ben Noordhuis)
+
+* darwin: task_info() cannot fail (Ben Noordhuis)
+
+* unix: add mapping for ENETDOWN (Ben Noordhuis)
+
+* unix: implicitly signal write errors to libuv user (Ben Noordhuis)
+
+* unix: fix assert on signal pipe overflow (Bert Belder)
+
+* unix: turn off POLLOUT after stream connect (Ben Noordhuis)
+
+
+2013.05.16, Version 0.11.3 (Unstable), 0a48c05b5988aea84c605751900926fa25443b34
+
+Changes since version 0.11.2:
+
+* unix: clean up uv_accept() (Ben Noordhuis)
+
+* unix: remove errno preserving code (Ben Noordhuis)
+
+* darwin: fix ios build, don't require ApplicationServices (Ben Noordhuis)
+
+* windows: kill child processes when the parent dies (Bert Belder)
+
+* build: set soname in shared library (Ben Noordhuis)
+
+* build: make `make test` link against .a again (Ben Noordhuis)
+
+* build: only set soname on shared object builds (Timothy J. Fontaine)
+
+* build: convert predefined $PLATFORM to lower case (Elliot Saba)
+
+* test: fix process_title failing on linux (Miroslav Bajtoš)
+
+* test, sunos: disable process_title test (Miroslav Bajtoš)
+
+* test: add error logging to tty unit test (Miroslav Bajtoš)
+
+
+2013.05.15, Version 0.10.7 (Stable), 028baaf0846b686a81e992cb2f2f5a9b8e841fcf
+
+Changes since version 0.10.6:
+
+* windows: kill child processes when the parent dies (Bert Belder)
+
+
+2013.05.15, Version 0.10.6 (Stable), 11e6613e6260d95c8cf11bf89a2759c24649319a
+
+Changes since version 0.10.5:
+
+* stream: fix osx select hack (Fedor Indutny)
+
+* stream: fix small nit in select hack, add test (Fedor Indutny)
+
+* build: link with libkvm on openbsd (Ben Noordhuis)
+
+* stream: use harder sync restrictions for osx-hack (Fedor Indutny)
+
+* unix: fix EMFILE error handling (Ben Noordhuis)
+
+* darwin: fix unnecessary include headers (Daisuke Murase)
+
+* darwin: rename darwin-getproctitle.m (Ben Noordhuis)
+
+* build: convert predefined $PLATFORM to lower case (Elliot Saba)
+
+* build: set soname in shared library (Ben Noordhuis)
+
+* build: make `make test` link against .a again (Ben Noordhuis)
+
+* darwin: fix ios build, don't require ApplicationServices (Ben Noordhuis)
+
+* build: only set soname on shared object builds (Timothy J. Fontaine)
+
+
+2013.05.11, Version 0.11.2 (Unstable), 3fba0bf65f091b91a9760530c05c6339c658d88b
+
+Changes since version 0.11.1:
+
+* darwin: look up file path with F_GETPATH (Ben Noordhuis)
+
+* unix, windows: add uv_has_ref() function (Saúl Ibarra Corretgé)
+
+* build: avoid double / in paths for dtrace (Timothy J. Fontaine)
+
+* unix: remove src/unix/cygwin.c (Ben Noordhuis)
+
+* windows: deal with the fact that GetTickCount might lag (Bert Belder)
+
+* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis)
+
+* linux: don't use fopen() in uv_resident_set_memory() (Ben Noordhuis)
+
+
+2013.04.24, Version 0.10.5 (Stable), 6595a7732c52eb4f8e57c88655f72997a8567a67
+
+Changes since version 0.10.4:
+
+* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis)
+
+* windows: make timers handle large timeouts (Miroslav Bajtoš)
+
+* windows: remove superfluous assert statement (Bert Belder)
+
+* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis)
+
+* linux: don't use fopen() in uv_resident_set_memory() (Ben Noordhuis)
+
+
+2013.04.12, Version 0.10.4 (Stable), 85827e26403ac6dfa331af8ec9916ea7e27bd833
+
+Changes since version 0.10.3:
+
+* include: update uv_backend_fd() documentation (Ben Noordhuis)
+
+* unix: include uv.h in src/version.c (Ben Noordhuis)
+
+* unix: don't write more than IOV_MAX iovecs (Fedor Indutny)
+
+* mingw-w64: don't call _set_invalid_parameter_handler (Nils Maier)
+
+* build: gyp disable thin archives (Timothy J. Fontaine)
+
+* sunos: re-export entire library when static (Timothy J. Fontaine)
+
+* unix: dtrace probes for tick-start and tick-stop (Timothy J. Fontaine)
+
+* windows: fix memory leak in fs__sendfile (Shannen Saez)
+
+* windows: remove double initialization in uv_tty_init (Shannen Saez)
+
+* build: fix dtrace-enabled out of tree build (Ben Noordhuis)
+
+* build: squelch -Wdollar-in-identifier-extension warnings (Ben Noordhuis)
+
+* inet: snprintf returns int, not size_t (Brian White)
+
+* win: refactor uv_cpu_info (Bert Belder)
+
+* build: add support for Visual Studio 2012 (Nicholas Vavilov)
+
+* build: -Wno-dollar-in-identifier-extension is clang only (Ben Noordhuis)
+
+
+2013.04.11, Version 0.11.1 (Unstable), 5c10e82ae0bc99eff86d4b9baff1f1aa0bf84c0a
+
+This is the first versioned release from the current unstable libuv branch.
+
+Changes since Node.js v0.11.0:
+
+* all platforms: nanosecond resolution support for uv_fs_[fl]stat (Timothy J.
+ Fontaine)
+
+* all platforms: add netmask to uv_interface_address (Ben Kelly)
+
+* unix: make sure the `status` parameter passed to the `uv_getaddrinfo` is 0 or
+ -1 (Ben Noordhuis)
+
+* unix: limit the number of iovecs written in a single `writev` syscall to
+ IOV_MAX (Fedor Indutny)
+
+* unix: add dtrace probes for tick-start and tick-stop (Timothy J. Fontaine)
+
+* mingw-w64: don't call _set_invalid_parameter_handler (Nils Maier)
+
+* windows: fix memory leak in fs__sendfile (Shannen Saez)
+
+* windows: fix edge case bugs in uv_cpu_info (Bert Belder)
+
+* include: no longer ship with / include ngx-queue.h (Ben Noordhuis)
+
+* include: remove UV_VERSION_* macros from uv.h (Ben Noordhuis)
+
+* documentation updates (Kristian Evensen, Ben Kelly, Ben Noordhuis)
+
+* build: fix dtrace-enabled builds (Ben Noordhuis, Timothy J. Fontaine)
+
+* build: gyp disable thin archives (Timothy J. Fontaine)
+
+* build: add support for Visual Studio 2012 (Nicholas Vavilov)
+
+
+2013.03.28, Version 0.10.3 (Stable), 31ebe23973dd98fd8a24c042b606f37a794e99d0
+
+Changes since version 0.10.2:
+
+* include: remove extraneous const from uv_version() (Ben Noordhuis)
+
+* doc: update README, replace `OS` by `PLATFORM` (Ben Noordhuis)
+
+* build: simplify .buildstamp rule (Ben Noordhuis)
+
+* build: disable -Wstrict-aliasing on darwin (Ben Noordhuis)
+
+* darwin: don't select(&exceptfds) in fallback path (Ben Noordhuis)
+
+* unix: don't clear flags after closing UDP handle (Saúl Ibarra Corretgé)
+
+
+2013.03.25, Version 0.10.2 (Stable), 0f36a00568f3e7608f97f6c6cdb081f4800a50c9
+
+This is the first officially versioned release of libuv. Starting now
+libuv will make releases independently of Node.js.
+
+Changes since Node.js v0.10.0:
+
+* test: add tap output for windows (Timothy J. Fontaine)
+
+* unix: fix uv_tcp_simultaneous_accepts() logic (Ben Noordhuis)
+
+* include: bump UV_VERSION_MINOR (Ben Noordhuis)
+
+* unix: improve uv_guess_handle() implementation (Ben Noordhuis)
+
+* stream: run try_select only for pipes and ttys (Fedor Indutny)
+
+Changes since Node.js v0.10.1:
+
+* build: rename OS to PLATFORM (Ben Noordhuis)
+
+* unix: make uv_timer_init() initialize repeat (Brian Mazza)
+
+* unix: make timers handle large timeouts (Ben Noordhuis)
+
+* build: add OBJC makefile var (Ben Noordhuis)
+
+* Add `uv_version()` and `uv_version_string()` APIs (Bert Belder)
diff --git a/3rdparty/libuv/android-configure b/3rdparty/libuv/android-configure
new file mode 100644
index 00000000000..e0b250fb634
--- /dev/null
+++ b/3rdparty/libuv/android-configure
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+export TOOLCHAIN=$PWD/android-toolchain
+mkdir -p $TOOLCHAIN
+$1/build/tools/make-standalone-toolchain.sh \
+ --toolchain=arm-linux-androideabi-4.8 \
+ --arch=arm \
+ --install-dir=$TOOLCHAIN \
+ --platform=android-21
+export PATH=$TOOLCHAIN/bin:$PATH
+export AR=arm-linux-androideabi-ar
+export CC=arm-linux-androideabi-gcc
+export CXX=arm-linux-androideabi-g++
+export LINK=arm-linux-androideabi-g++
+export PLATFORM=android
+
+if [ $2 -a $2 == 'gyp' ]
+ then
+ ./gyp_uv.py -Dtarget_arch=arm -DOS=android -f make-android
+fi
diff --git a/3rdparty/libuv/appveyor.yml b/3rdparty/libuv/appveyor.yml
new file mode 100644
index 00000000000..9aa63c5a5d2
--- /dev/null
+++ b/3rdparty/libuv/appveyor.yml
@@ -0,0 +1,36 @@
+version: v1.8.0.build{build}
+
+install:
+ - cinst -y nsis
+
+matrix:
+ fast_finish: true
+ allow_failures:
+ - platform: x86
+ configuration: Release
+ - platform: x64
+ configuration: Release
+
+platform:
+ - x86
+ - x64
+
+configuration:
+ - Release
+
+build_script:
+ # Fixed tag version number if using a tag.
+ - cmd: if "%APPVEYOR_REPO_TAG%" == "true" set APPVEYOR_BUILD_VERSION=%APPVEYOR_REPO_TAG_NAME%
+ # vcbuild overwrites the platform variable.
+ - cmd: set ARCH=%platform%
+ - cmd: vcbuild.bat release %ARCH% shared
+
+after_build:
+ - '"%PROGRAMFILES(x86)%\NSIS\makensis" /DVERSION=%APPVEYOR_BUILD_VERSION% /DARCH=%ARCH% libuv.nsi'
+
+artifacts:
+ - name: Installer
+ path: 'libuv-*.exe'
+
+cache:
+ - C:\projects\libuv\build\gyp
diff --git a/3rdparty/libuv/autogen.sh b/3rdparty/libuv/autogen.sh
new file mode 100644
index 00000000000..0574778a4e1
--- /dev/null
+++ b/3rdparty/libuv/autogen.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+cd `dirname "$0"`
+
+if [ "$LIBTOOLIZE" = "" ] && [ "`uname`" = "Darwin" ]; then
+ LIBTOOLIZE=glibtoolize
+fi
+
+ACLOCAL=${ACLOCAL:-aclocal}
+AUTOCONF=${AUTOCONF:-autoconf}
+AUTOMAKE=${AUTOMAKE:-automake}
+LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
+
+automake_version=`"$AUTOMAKE" --version | head -n 1 | sed 's/[^.0-9]//g'`
+automake_version_major=`echo "$automake_version" | cut -d. -f1`
+automake_version_minor=`echo "$automake_version" | cut -d. -f2`
+
+UV_EXTRA_AUTOMAKE_FLAGS=
+if test "$automake_version_major" -gt 1 || \
+ test "$automake_version_major" -eq 1 && \
+ test "$automake_version_minor" -gt 11; then
+ # serial-tests is available in v1.12 and newer.
+ UV_EXTRA_AUTOMAKE_FLAGS="$UV_EXTRA_AUTOMAKE_FLAGS serial-tests"
+fi
+echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [$UV_EXTRA_AUTOMAKE_FLAGS])" \
+ > m4/libuv-extra-automake-flags.m4
+
+set -ex
+"$LIBTOOLIZE"
+"$ACLOCAL" -I m4
+"$AUTOCONF"
+"$AUTOMAKE" --add-missing --copy
diff --git a/3rdparty/libuv/checksparse.sh b/3rdparty/libuv/checksparse.sh
new file mode 100644
index 00000000000..619cf6f8b67
--- /dev/null
+++ b/3rdparty/libuv/checksparse.sh
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+# Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+SPARSE=${SPARSE:-sparse}
+
+SPARSE_FLAGS=${SPARSE_FLAGS:-"
+-D__POSIX__
+-Wsparse-all
+-Wno-do-while
+-Wno-transparent-union
+-Iinclude
+-Isrc
+"}
+
+SOURCES="
+include/tree.h
+include/uv-unix.h
+include/uv.h
+src/fs-poll.c
+src/inet.c
+src/queue.h
+src/unix/async.c
+src/unix/core.c
+src/unix/dl.c
+src/unix/fs.c
+src/unix/getaddrinfo.c
+src/unix/internal.h
+src/unix/loop-watcher.c
+src/unix/loop.c
+src/unix/pipe.c
+src/unix/poll.c
+src/unix/process.c
+src/unix/signal.c
+src/unix/stream.c
+src/unix/tcp.c
+src/unix/thread.c
+src/unix/threadpool.c
+src/unix/timer.c
+src/unix/tty.c
+src/unix/udp.c
+src/uv-common.c
+src/uv-common.h
+"
+
+TESTS="
+test/benchmark-async-pummel.c
+test/benchmark-async.c
+test/benchmark-fs-stat.c
+test/benchmark-getaddrinfo.c
+test/benchmark-loop-count.c
+test/benchmark-million-async.c
+test/benchmark-million-timers.c
+test/benchmark-multi-accept.c
+test/benchmark-ping-pongs.c
+test/benchmark-pound.c
+test/benchmark-pump.c
+test/benchmark-sizes.c
+test/benchmark-spawn.c
+test/benchmark-tcp-write-batch.c
+test/benchmark-thread.c
+test/benchmark-udp-pummel.c
+test/blackhole-server.c
+test/dns-server.c
+test/echo-server.c
+test/run-benchmarks.c
+test/run-tests.c
+test/runner-unix.c
+test/runner-unix.h
+test/runner.c
+test/runner.h
+test/task.h
+test/test-active.c
+test/test-async.c
+test/test-barrier.c
+test/test-callback-order.c
+test/test-callback-stack.c
+test/test-condvar.c
+test/test-connection-fail.c
+test/test-cwd-and-chdir.c
+test/test-delayed-accept.c
+test/test-dlerror.c
+test/test-embed.c
+test/test-error.c
+test/test-fail-always.c
+test/test-fs-event.c
+test/test-fs-poll.c
+test/test-fs.c
+test/test-get-currentexe.c
+test/test-get-loadavg.c
+test/test-get-memory.c
+test/test-getaddrinfo.c
+test/test-getsockname.c
+test/test-homedir.c
+test/test-hrtime.c
+test/test-idle.c
+test/test-ip6-addr.c
+test/test-ipc-send-recv.c
+test/test-ipc.c
+test/test-loop-handles.c
+test/test-multiple-listen.c
+test/test-mutexes.c
+test/test-pass-always.c
+test/test-ping-pong.c
+test/test-pipe-bind-error.c
+test/test-pipe-connect-error.c
+test/test-pipe-sendmsg.c
+test/test-pipe-server-close.c
+test/test-platform-output.c
+test/test-poll-close.c
+test/test-poll.c
+test/test-process-title.c
+test/test-ref.c
+test/test-run-nowait.c
+test/test-run-once.c
+test/test-semaphore.c
+test/test-shutdown-close.c
+test/test-shutdown-eof.c
+test/test-signal-multiple-loops.c
+test/test-signal.c
+test/test-spawn.c
+test/test-stdio-over-pipes.c
+test/test-tcp-bind-error.c
+test/test-tcp-bind6-error.c
+test/test-tcp-close-while-connecting.c
+test/test-tcp-close-accept.c
+test/test-tcp-close.c
+test/test-tcp-connect-error-after-write.c
+test/test-tcp-connect-error.c
+test/test-tcp-connect-timeout.c
+test/test-tcp-connect6-error.c
+test/test-tcp-flags.c
+test/test-tcp-open.c
+test/test-tcp-read-stop.c
+test/test-tcp-shutdown-after-write.c
+test/test-tcp-unexpected-read.c
+test/test-tcp-oob.c
+test/test-tcp-write-error.c
+test/test-tcp-write-to-half-open-connection.c
+test/test-tcp-writealot.c
+test/test-thread.c
+test/test-threadpool-cancel.c
+test/test-threadpool.c
+test/test-timer-again.c
+test/test-timer.c
+test/test-tty.c
+test/test-udp-dgram-too-big.c
+test/test-udp-ipv6.c
+test/test-udp-multicast-join.c
+test/test-udp-multicast-ttl.c
+test/test-udp-open.c
+test/test-udp-options.c
+test/test-udp-send-and-recv.c
+test/test-walk-handles.c
+test/test-watcher-cross-stop.c
+"
+
+case `uname -s` in
+AIX)
+ SPARSE_FLAGS="$SPARSE_FLAGS -D_AIX=1"
+ SOURCES="$SOURCES
+ src/unix/aix.c"
+ ;;
+Darwin)
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__APPLE__=1"
+ SOURCES="$SOURCES
+ include/uv-bsd.h
+ src/unix/darwin.c
+ src/unix/kqueue.c
+ src/unix/fsevents.c"
+ ;;
+DragonFly)
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__DragonFly__=1"
+ SOURCES="$SOURCES
+ include/uv-bsd.h
+ src/unix/kqueue.c
+ src/unix/freebsd.c"
+ ;;
+FreeBSD)
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__FreeBSD__=1"
+ SOURCES="$SOURCES
+ include/uv-bsd.h
+ src/unix/kqueue.c
+ src/unix/freebsd.c"
+ ;;
+Linux)
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__linux__=1"
+ SOURCES="$SOURCES
+ include/uv-linux.h
+ src/unix/linux-inotify.c
+ src/unix/linux-core.c
+ src/unix/linux-syscalls.c
+ src/unix/linux-syscalls.h"
+ ;;
+NetBSD)
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__NetBSD__=1"
+ SOURCES="$SOURCES
+ include/uv-bsd.h
+ src/unix/kqueue.c
+ src/unix/netbsd.c"
+ ;;
+OpenBSD)
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__OpenBSD__=1"
+ SOURCES="$SOURCES
+ include/uv-bsd.h
+ src/unix/kqueue.c
+ src/unix/openbsd.c"
+ ;;
+SunOS)
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__sun=1"
+ SOURCES="$SOURCES
+ include/uv-sunos.h
+ src/unix/sunos.c"
+ ;;
+esac
+
+for ARCH in __i386__ __x86_64__ __arm__ __mips__; do
+ $SPARSE $SPARSE_FLAGS -D$ARCH=1 $SOURCES
+done
+
+# Tests are architecture independent.
+$SPARSE $SPARSE_FLAGS -Itest $TESTS
diff --git a/3rdparty/libuv/common.gypi b/3rdparty/libuv/common.gypi
new file mode 100644
index 00000000000..7cebcde5f89
--- /dev/null
+++ b/3rdparty/libuv/common.gypi
@@ -0,0 +1,210 @@
+{
+ 'variables': {
+ 'visibility%': 'hidden', # V8's visibility setting
+ 'target_arch%': 'ia32', # set v8's target architecture
+ 'host_arch%': 'ia32', # set v8's host architecture
+ 'uv_library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
+ 'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
+ },
+
+ 'target_defaults': {
+ 'default_configuration': 'Debug',
+ 'configurations': {
+ 'Debug': {
+ 'defines': [ 'DEBUG', '_DEBUG' ],
+ 'cflags': [ '-g', '-O0', '-fwrapv' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'target_conditions': [
+ ['uv_library=="static_library"', {
+ 'RuntimeLibrary': 1, # static debug
+ }, {
+ 'RuntimeLibrary': 3, # DLL debug
+ }],
+ ],
+ 'Optimization': 0, # /Od, no optimization
+ 'MinimalRebuild': 'false',
+ 'OmitFramePointers': 'false',
+ 'BasicRuntimeChecks': 3, # /RTC1
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': 2, # enable incremental linking
+ },
+ },
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '0',
+ 'OTHER_CFLAGS': [ '-Wno-strict-aliasing' ],
+ },
+ 'conditions': [
+ ['OS == "android"', {
+ 'cflags': [ '-fPIE' ],
+ 'ldflags': [ '-fPIE', '-pie' ]
+ }]
+ ]
+ },
+ 'Release': {
+ 'defines': [ 'NDEBUG' ],
+ 'cflags': [
+ '-O3',
+ '-fstrict-aliasing',
+ '-fomit-frame-pointer',
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'target_conditions': [
+ ['uv_library=="static_library"', {
+ 'RuntimeLibrary': 0, # static release
+ }, {
+ 'RuntimeLibrary': 2, # debug release
+ }],
+ ],
+ 'Optimization': 3, # /Ox, full optimization
+ 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
+ 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
+ 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
+ 'OmitFramePointers': 'true',
+ 'EnableFunctionLevelLinking': 'true',
+ 'EnableIntrinsicFunctions': 'true',
+ },
+ 'VCLibrarianTool': {
+ 'AdditionalOptions': [
+ '/LTCG', # link time code generation
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkTimeCodeGeneration': 1, # link-time code generation
+ 'OptimizeReferences': 2, # /OPT:REF
+ 'EnableCOMDATFolding': 2, # /OPT:ICF
+ 'LinkIncremental': 1, # disable incremental linking
+ },
+ },
+ }
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'StringPooling': 'true', # pool string literals
+ 'DebugInformationFormat': 3, # Generate a PDB
+ 'WarningLevel': 3,
+ 'BufferSecurityCheck': 'true',
+ 'ExceptionHandling': 1, # /EHsc
+ 'SuppressStartupBanner': 'true',
+ 'WarnAsError': 'false',
+ 'AdditionalOptions': [
+ '/MP', # compile across multiple CPUs
+ ],
+ },
+ 'VCLibrarianTool': {
+ },
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ 'RandomizedBaseAddress': 2, # enable ASLR
+ 'DataExecutionPrevention': 2, # enable DEP
+ 'AllowIsolation': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'target_conditions': [
+ ['_type=="executable"', {
+ 'SubSystem': 1, # console executable
+ }],
+ ],
+ },
+ },
+ 'conditions': [
+ ['OS == "win"', {
+ 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
+ 'defines': [
+ 'WIN32',
+ # we don't really want VC++ warning us about
+ # how dangerous C functions are...
+ '_CRT_SECURE_NO_DEPRECATE',
+ # ... or that C implementations shouldn't use
+ # POSIX names
+ '_CRT_NONSTDC_NO_DEPRECATE',
+ ],
+ 'target_conditions': [
+ ['target_arch=="x64"', {
+ 'msvs_configuration_platform': 'x64'
+ }]
+ ]
+ }],
+ ['OS in "freebsd dragonflybsd linux openbsd solaris android"', {
+ 'cflags': [ '-Wall' ],
+ 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
+ 'target_conditions': [
+ ['_type=="static_library"', {
+ 'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
+ }],
+ ],
+ 'conditions': [
+ [ 'host_arch != target_arch and target_arch=="ia32"', {
+ 'cflags': [ '-m32' ],
+ 'ldflags': [ '-m32' ],
+ }],
+ [ 'target_arch=="x32"', {
+ 'cflags': [ '-mx32' ],
+ 'ldflags': [ '-mx32' ],
+ }],
+ [ 'OS=="linux"', {
+ 'cflags': [ '-ansi' ],
+ }],
+ [ 'OS=="solaris"', {
+ 'cflags': [ '-pthreads' ],
+ 'ldflags': [ '-pthreads' ],
+ }],
+ [ 'OS not in "solaris android"', {
+ 'cflags': [ '-pthread' ],
+ 'ldflags': [ '-pthread' ],
+ }],
+ [ 'visibility=="hidden"', {
+ 'cflags': [ '-fvisibility=hidden' ],
+ }],
+ ],
+ }],
+ ['OS=="mac"', {
+ 'xcode_settings': {
+ 'ALWAYS_SEARCH_USER_PATHS': 'NO',
+ 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
+ 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
+ # (Equivalent to -fPIC)
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
+ 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
+ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
+ # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
+ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
+ 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
+ 'PREBINDING': 'NO', # No -Wl,-prebind
+ 'USE_HEADERMAP': 'NO',
+ 'OTHER_CFLAGS': [
+ '-fstrict-aliasing',
+ ],
+ 'WARNING_CFLAGS': [
+ '-Wall',
+ '-Wendif-labels',
+ '-W',
+ '-Wno-unused-parameter',
+ ],
+ },
+ 'conditions': [
+ ['target_arch=="ia32"', {
+ 'xcode_settings': {'ARCHS': ['i386']},
+ }],
+ ['target_arch=="x64"', {
+ 'xcode_settings': {'ARCHS': ['x86_64']},
+ }],
+ ],
+ 'target_conditions': [
+ ['_type!="static_library"', {
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
+ }],
+ ],
+ }],
+ ['OS=="solaris"', {
+ 'cflags': [ '-fno-omit-frame-pointer' ],
+ # pull in V8's postmortem metadata
+ 'ldflags': [ '-Wl,-z,allextract' ]
+ }],
+ ],
+ },
+}
diff --git a/3rdparty/libuv/configure.ac b/3rdparty/libuv/configure.ac
new file mode 100644
index 00000000000..011bee2a891
--- /dev/null
+++ b/3rdparty/libuv/configure.ac
@@ -0,0 +1,68 @@
+# Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+AC_PREREQ(2.57)
+AC_INIT([libuv], [1.8.0], [https://github.com/libuv/libuv/issues])
+AC_CONFIG_MACRO_DIR([m4])
+m4_include([m4/libuv-extra-automake-flags.m4])
+m4_include([m4/as_case.m4])
+m4_include([m4/libuv-check-flags.m4])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects] UV_EXTRA_AUTOMAKE_FLAGS)
+AC_CANONICAL_HOST
+AC_ENABLE_SHARED
+AC_ENABLE_STATIC
+AC_PROG_CC
+AM_PROG_CC_C_O
+CC_CHECK_CFLAGS_APPEND([-fvisibility=hidden])
+CC_CHECK_CFLAGS_APPEND([-g])
+CC_CHECK_CFLAGS_APPEND([-std=gnu89])
+CC_CHECK_CFLAGS_APPEND([-pedantic])
+CC_CHECK_CFLAGS_APPEND([-Wall])
+CC_CHECK_CFLAGS_APPEND([-Wextra])
+CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter])
+# AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12.
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+# autoconf complains if AC_PROG_LIBTOOL precedes AM_PROG_AR.
+AC_PROG_LIBTOOL
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+LT_INIT
+# TODO(bnoordhuis) Check for -pthread vs. -pthreads
+AC_CHECK_LIB([dl], [dlopen])
+AC_CHECK_LIB([kstat], [kstat_lookup])
+AC_CHECK_LIB([kvm], [kvm_open])
+AC_CHECK_LIB([nsl], [gethostbyname])
+AC_CHECK_LIB([perfstat], [perfstat_cpu])
+AC_CHECK_LIB([pthread], [pthread_mutex_init])
+AC_CHECK_LIB([rt], [clock_gettime])
+AC_CHECK_LIB([sendfile], [sendfile])
+AC_CHECK_LIB([socket], [socket])
+AC_SYS_LARGEFILE
+AM_CONDITIONAL([AIX], [AS_CASE([$host_os],[aix*], [true], [false])])
+AM_CONDITIONAL([ANDROID], [AS_CASE([$host_os],[linux-android*],[true], [false])])
+AM_CONDITIONAL([DARWIN], [AS_CASE([$host_os],[darwin*], [true], [false])])
+AM_CONDITIONAL([DRAGONFLY],[AS_CASE([$host_os],[dragonfly*], [true], [false])])
+AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os],[freebsd*], [true], [false])])
+AM_CONDITIONAL([LINUX], [AS_CASE([$host_os],[linux*], [true], [false])])
+AM_CONDITIONAL([NETBSD], [AS_CASE([$host_os],[netbsd*], [true], [false])])
+AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])])
+AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])])
+AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])])
+AC_CHECK_HEADERS([sys/ahafs_evProds.h])
+AC_CHECK_PROG(PKG_CONFIG, pkg-config, yes)
+AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "x"])
+AS_IF([test "x$PKG_CONFIG" != "x"], [
+ AC_CONFIG_FILES([libuv.pc])
+])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/3rdparty/libuv/docs/make.bat b/3rdparty/libuv/docs/make.bat
new file mode 100644
index 00000000000..10eb94b013b
--- /dev/null
+++ b/3rdparty/libuv/docs/make.bat
@@ -0,0 +1,243 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=build
+set SRCDIR=src
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% %SRCDIR%
+set I18NSPHINXOPTS=%SPHINXOPTS% %SRCDIR%
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^<target^>` where ^<target^> is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. texinfo to make Texinfo files
+ echo. gettext to make PO message catalogs
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. xml to make Docutils-native XML files
+ echo. pseudoxml to make pseudoxml-XML files for display purposes
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+
+%SPHINXBUILD% 2> nul
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "singlehtml" (
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\libuv.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\libuv.ghc
+ goto end
+)
+
+if "%1" == "devhelp" (
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
+)
+
+if "%1" == "epub" (
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdf" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdfja" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf-ja
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "text" (
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
+)
+
+if "%1" == "man" (
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
+)
+
+if "%1" == "texinfo" (
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+ goto end
+)
+
+if "%1" == "gettext" (
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+if "%1" == "xml" (
+ %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The XML files are in %BUILDDIR%/xml.
+ goto end
+)
+
+if "%1" == "pseudoxml" (
+ %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
+ goto end
+)
+
+:end